OLD | NEW |
1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # This script will check out llvm and clang into third_party/llvm and build it. | 6 # This script will check out llvm and clang into third_party/llvm and build it. |
7 | 7 |
8 # Do NOT CHANGE this if you don't know what you're doing -- see | 8 # Do NOT CHANGE this if you don't know what you're doing -- see |
9 # https://code.google.com/p/chromium/wiki/UpdatingClang | 9 # https://code.google.com/p/chromium/wiki/UpdatingClang |
10 # Reverting problematic clang rolls is safe, though. | 10 # Reverting problematic clang rolls is safe, though. |
11 CLANG_REVISION=230914 | 11 CLANG_REVISION=223108 |
12 | |
13 # This is incremented when pushing a new build of Clang at the same revision. | |
14 CLANG_SUB_REVISION=1 | |
15 | |
16 PACKAGE_VERSION="${CLANG_REVISION}-${CLANG_SUB_REVISION}" | |
17 | 12 |
18 THIS_DIR="$(dirname "${0}")" | 13 THIS_DIR="$(dirname "${0}")" |
19 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" | 14 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" |
20 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts" | 15 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts" |
21 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt" | 16 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt" |
22 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" | 17 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" |
23 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" | 18 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" |
24 CLANG_DIR="${LLVM_DIR}/tools/clang" | 19 CLANG_DIR="${LLVM_DIR}/tools/clang" |
25 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt" | 20 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt" |
26 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx" | 21 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 --bootstrap) | 81 --bootstrap) |
87 bootstrap=yes | 82 bootstrap=yes |
88 ;; | 83 ;; |
89 --if-needed) | 84 --if-needed) |
90 if_needed=yes | 85 if_needed=yes |
91 ;; | 86 ;; |
92 --force-local-build) | 87 --force-local-build) |
93 force_local_build=yes | 88 force_local_build=yes |
94 ;; | 89 ;; |
95 --print-revision) | 90 --print-revision) |
96 echo $PACKAGE_VERSION | 91 echo $CLANG_REVISION |
97 exit 0 | 92 exit 0 |
98 ;; | 93 ;; |
99 --run-tests) | 94 --run-tests) |
100 run_tests=yes | 95 run_tests=yes |
101 ;; | 96 ;; |
102 --without-android) | 97 --without-android) |
103 with_android= | 98 with_android= |
104 ;; | 99 ;; |
105 --without-patches) | 100 --without-patches) |
106 with_patches= | 101 with_patches= |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 exit 0 | 191 exit 0 |
197 fi | 192 fi |
198 fi | 193 fi |
199 | 194 |
200 | 195 |
201 # Check if there's anything to be done, exit early if not. | 196 # Check if there's anything to be done, exit early if not. |
202 if [[ -f "${STAMP_FILE}" ]]; then | 197 if [[ -f "${STAMP_FILE}" ]]; then |
203 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}") | 198 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}") |
204 if [[ -z "$force_local_build" ]] && \ | 199 if [[ -z "$force_local_build" ]] && \ |
205 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ | 200 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ |
206 "${PACKAGE_VERSION}" ]]; then | 201 "${CLANG_AND_PLUGINS_REVISION}" ]]; then |
207 echo "Clang already at ${PACKAGE_VERSION}" | 202 echo "Clang already at ${CLANG_AND_PLUGINS_REVISION}" |
208 exit 0 | 203 exit 0 |
209 fi | 204 fi |
210 fi | 205 fi |
211 # To always force a new build if someone interrupts their build half way. | 206 # To always force a new build if someone interrupts their build half way. |
212 rm -f "${STAMP_FILE}" | 207 rm -f "${STAMP_FILE}" |
213 | 208 |
214 | 209 |
215 if [[ -z "$force_local_build" ]]; then | 210 if [[ -z "$force_local_build" ]]; then |
216 # Check if there's a prebuilt binary and if so just fetch that. That's faster, | 211 # Check if there's a prebuilt binary and if so just fetch that. That's faster, |
217 # and goma relies on having matching binary hashes on client and server too. | 212 # and goma relies on having matching binary hashes on client and server too. |
218 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang | 213 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang |
219 CDS_FILE="clang-${PACKAGE_VERSION}.tgz" | 214 CDS_FILE="clang-${CLANG_REVISION}.tgz" |
220 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) | 215 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) |
221 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" | 216 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" |
222 if [ "${OS}" = "Linux" ]; then | 217 if [ "${OS}" = "Linux" ]; then |
223 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" | 218 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" |
224 elif [ "${OS}" = "Darwin" ]; then | 219 elif [ "${OS}" = "Darwin" ]; then |
225 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" | 220 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" |
226 fi | 221 fi |
227 echo Trying to download prebuilt clang | 222 echo Trying to download prebuilt clang |
228 if which curl > /dev/null; then | 223 if which curl > /dev/null; then |
229 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \ | 224 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \ |
230 rm -rf "${CDS_OUT_DIR}" | 225 rm -rf "${CDS_OUT_DIR}" |
231 elif which wget > /dev/null; then | 226 elif which wget > /dev/null; then |
232 wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}" | 227 wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}" |
233 else | 228 else |
234 echo "Neither curl nor wget found. Please install one of these." | 229 echo "Neither curl nor wget found. Please install one of these." |
235 exit 1 | 230 exit 1 |
236 fi | 231 fi |
237 if [ -f "${CDS_OUTPUT}" ]; then | 232 if [ -f "${CDS_OUTPUT}" ]; then |
238 rm -rf "${LLVM_BUILD_DIR}" | 233 rm -rf "${LLVM_BUILD_DIR}" |
239 mkdir -p "${LLVM_BUILD_DIR}" | 234 mkdir -p "${LLVM_BUILD_DIR}" |
240 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" | 235 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" |
241 echo clang "${PACKAGE_VERSION}" unpacked | 236 echo clang "${CLANG_REVISION}" unpacked |
242 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 237 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" |
243 rm -rf "${CDS_OUT_DIR}" | 238 rm -rf "${CDS_OUT_DIR}" |
244 exit 0 | 239 exit 0 |
245 else | 240 else |
246 echo Did not find prebuilt clang "${PACKAGE_VERSION}", building | 241 echo Did not find prebuilt clang at r"${CLANG_REVISION}", building |
247 fi | 242 fi |
248 fi | 243 fi |
249 | 244 |
250 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then | 245 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then |
251 echo "Android NDK not found at ${ANDROID_NDK_DIR}" | 246 echo "Android NDK not found at ${ANDROID_NDK_DIR}" |
252 echo "The Android NDK is needed to build a Clang whose -fsanitize=address" | 247 echo "The Android NDK is needed to build a Clang whose -fsanitize=address" |
253 echo "works on Android. See " | 248 echo "works on Android. See " |
254 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how" | 249 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how" |
255 echo "to install the NDK, or pass --without-android." | 250 echo "to install the NDK, or pass --without-android." |
256 exit 1 | 251 exit 1 |
(...skipping 23 matching lines...) Expand all Loading... |
280 "${CLANG_DIR}/lib/Frontend/InitPreprocessor.cpp" \ | 275 "${CLANG_DIR}/lib/Frontend/InitPreprocessor.cpp" \ |
281 "${CLANG_DIR}/test/Frontend/exceptions.c" \ | 276 "${CLANG_DIR}/test/Frontend/exceptions.c" \ |
282 "${CLANG_DIR}/test/Preprocessor/predefined-exceptions.m" \ | 277 "${CLANG_DIR}/test/Preprocessor/predefined-exceptions.m" \ |
283 "${LLVM_DIR}/test/Bindings/Go/go.test" \ | 278 "${LLVM_DIR}/test/Bindings/Go/go.test" \ |
284 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \ | 279 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \ |
285 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \ | 280 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \ |
286 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \ | 281 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \ |
287 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \ | 282 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \ |
288 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \ | 283 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \ |
289 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \ | 284 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \ |
290 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_stoptheworld_linux_libc
dep.cc" \ | |
291 "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \ | |
292 ; do | 285 ; do |
293 if [[ -e "${i}" ]]; then | 286 if [[ -e "${i}" ]]; then |
294 rm -f "${i}" # For unversioned files. | 287 rm -f "${i}" # For unversioned files. |
295 svn revert "${i}" | 288 svn revert "${i}" |
296 fi; | 289 fi; |
297 done | 290 done |
298 | 291 |
299 echo Remove the Clang tools shim dir | 292 echo Remove the Clang tools shim dir |
300 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools | 293 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools |
301 rm -rfv ${CHROME_TOOLS_SHIM_DIR} | 294 rm -rfv ${CHROME_TOOLS_SHIM_DIR} |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 357 |
365 -TEST_F(LibclangReparseTest, ReparseWithModule) { | 358 -TEST_F(LibclangReparseTest, ReparseWithModule) { |
366 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) { | 359 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) { |
367 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;"; | 360 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;"; |
368 const char *HeaderBottom = "\n};\n#endif\n"; | 361 const char *HeaderBottom = "\n};\n#endif\n"; |
369 const char *MFile = "#include \"HeaderFile.h\"\nint main() {" | 362 const char *MFile = "#include \"HeaderFile.h\"\nint main() {" |
370 EOF | 363 EOF |
371 patch -p0 | 364 patch -p0 |
372 popd | 365 popd |
373 | 366 |
| 367 # Apply r223211: "Revert r222997." |
| 368 pushd "${LLVM_DIR}" |
| 369 cat << 'EOF' | |
| 370 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp |
| 371 +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp |
| 372 @@ -921,8 +921,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySan
itizerVisitor> { |
| 373 Value *OriginPtr = |
| 374 getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset); |
| 375 setOrigin(A, EntryIRB.CreateLoad(OriginPtr)); |
| 376 - } else { |
| 377 - setOrigin(A, getCleanOrigin()); |
| 378 } |
| 379 } |
| 380 ArgOffset += RoundUpToAlignment(Size, kShadowTLSAlignment); |
| 381 @@ -942,13 +940,15 @@ struct MemorySanitizerVisitor : public InstVisitor<MemoryS
anitizerVisitor> { |
| 382 /// \brief Get the origin for a value. |
| 383 Value *getOrigin(Value *V) { |
| 384 if (!MS.TrackOrigins) return nullptr; |
| 385 - if (!PropagateShadow) return getCleanOrigin(); |
| 386 - if (isa<Constant>(V)) return getCleanOrigin(); |
| 387 - assert((isa<Instruction>(V) || isa<Argument>(V)) && |
| 388 - "Unexpected value type in getOrigin()"); |
| 389 - Value *Origin = OriginMap[V]; |
| 390 - assert(Origin && "Missing origin"); |
| 391 - return Origin; |
| 392 + if (isa<Instruction>(V) || isa<Argument>(V)) { |
| 393 + Value *Origin = OriginMap[V]; |
| 394 + if (!Origin) { |
| 395 + DEBUG(dbgs() << "NO ORIGIN: " << *V << "\n"); |
| 396 + Origin = getCleanOrigin(); |
| 397 + } |
| 398 + return Origin; |
| 399 + } |
| 400 + return getCleanOrigin(); |
| 401 } |
| 402 |
| 403 /// \brief Get the origin for i-th argument of the instruction I. |
| 404 @@ -1088,7 +1088,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemoryS
anitizerVisitor> { |
| 405 IRB.CreateStore(getCleanShadow(&I), ShadowPtr); |
| 406 |
| 407 setShadow(&I, getCleanShadow(&I)); |
| 408 - setOrigin(&I, getCleanOrigin()); |
| 409 } |
| 410 |
| 411 void visitAtomicRMWInst(AtomicRMWInst &I) { |
| 412 EOF |
| 413 patch -p1 |
| 414 popd |
| 415 |
| 416 # Apply r223219: "Preserve LD_LIBRARY_PATH when using the 'env' command" |
| 417 pushd "${CLANG_DIR}" |
| 418 cat << 'EOF' | |
| 419 --- a/test/Driver/env.c |
| 420 +++ b/test/Driver/env.c |
| 421 @@ -5,12 +5,14 @@ |
| 422 // REQUIRES: shell |
| 423 // |
| 424 // The PATH variable is heavily used when trying to find a linker. |
| 425 -// RUN: env -i LC_ALL=C %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ |
| 426 +// RUN: env -i LC_ALL=C LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \ |
| 427 +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ |
| 428 // RUN: --target=i386-unknown-linux \ |
| 429 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ |
| 430 // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s |
| 431 // |
| 432 -// RUN: env -i LC_ALL=C PATH="" %clang -no-canonical-prefixes %s -### -o %t.o 2
>&1 \ |
| 433 +// RUN: env -i LC_ALL=C PATH="" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \ |
| 434 +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ |
| 435 // RUN: --target=i386-unknown-linux \ |
| 436 // RUN: --sysroot=%S/Inputs/basic_linux_tree \ |
| 437 // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s |
| 438 EOF |
| 439 patch -p1 |
| 440 popd |
| 441 |
| 442 # Revert r220714: "Frontend: Define __EXCEPTIONS if -fexceptions is passed" |
| 443 pushd "${CLANG_DIR}" |
| 444 cat << 'EOF' | |
| 445 --- a/lib/Frontend/InitPreprocessor.cpp |
| 446 +++ b/lib/Frontend/InitPreprocessor.cpp |
| 447 @@ -566,7 +566,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, |
| 448 Builder.defineMacro("__BLOCKS__"); |
| 449 } |
| 450 |
| 451 - if (!LangOpts.MSVCCompat && LangOpts.Exceptions) |
| 452 + if (!LangOpts.MSVCCompat && LangOpts.CXXExceptions) |
| 453 Builder.defineMacro("__EXCEPTIONS"); |
| 454 if (!LangOpts.MSVCCompat && LangOpts.RTTI) |
| 455 Builder.defineMacro("__GXX_RTTI"); |
| 456 diff --git a/test/Frontend/exceptions.c b/test/Frontend/exceptions.c |
| 457 index 981b5b9..4bbaaa3 100644 |
| 458 --- a/test/Frontend/exceptions.c |
| 459 +++ b/test/Frontend/exceptions.c |
| 460 @@ -1,9 +1,6 @@ |
| 461 -// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -DMS_MODE -
verify %s |
| 462 +// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -verify %s |
| 463 // expected-no-diagnostics |
| 464 |
| 465 -// RUN: %clang_cc1 -fms-compatibility -fexceptions -verify %s |
| 466 -// expected-no-diagnostics |
| 467 - |
| 468 -#if defined(MS_MODE) && defined(__EXCEPTIONS) |
| 469 +#if defined(__EXCEPTIONS) |
| 470 #error __EXCEPTIONS should not be defined. |
| 471 #endif |
| 472 diff --git a/test/Preprocessor/predefined-exceptions.m b/test/Preprocessor/prede
fined-exceptions.m |
| 473 index 0791075..c13f429 100644 |
| 474 --- a/test/Preprocessor/predefined-exceptions.m |
| 475 +++ b/test/Preprocessor/predefined-exceptions.m |
| 476 @@ -1,6 +1,6 @@ |
| 477 // RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fexceptions -E -dM %s | Fi
leCheck -check-prefix=CHECK-OBJC-NOCXX %s |
| 478 // CHECK-OBJC-NOCXX: #define OBJC_ZEROCOST_EXCEPTIONS 1 |
| 479 -// CHECK-OBJC-NOCXX: #define __EXCEPTIONS 1 |
| 480 +// CHECK-OBJC-NOCXX-NOT: #define __EXCEPTIONS 1 |
| 481 |
| 482 // RUN: %clang_cc1 -x objective-c++ -fobjc-exceptions -fexceptions -fcxx-except
ions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-CXX %s |
| 483 // CHECK-OBJC-CXX: #define OBJC_ZEROCOST_EXCEPTIONS 1 |
| 484 EOF |
| 485 patch -p1 |
| 486 popd |
| 487 |
| 488 # Apply r223177: "Ensure typos in the default values of template parameters ge
t diagnosed." |
| 489 pushd "${CLANG_DIR}" |
| 490 cat << 'EOF' | |
| 491 --- a/lib/Parse/ParseTemplate.cpp |
| 492 +++ b/lib/Parse/ParseTemplate.cpp |
| 493 @@ -676,7 +676,7 @@ Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsign
ed Position) { |
| 494 GreaterThanIsOperatorScope G(GreaterThanIsOperator, false); |
| 495 EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated); |
| 496 |
| 497 - DefaultArg = ParseAssignmentExpression(); |
| 498 + DefaultArg = Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression())
; |
| 499 if (DefaultArg.isInvalid()) |
| 500 SkipUntil(tok::comma, tok::greater, StopAtSemi | StopBeforeMatch); |
| 501 } |
| 502 diff --git a/test/SemaCXX/default2.cpp b/test/SemaCXX/default2.cpp |
| 503 index 1626044..c4d40b4 100644 |
| 504 --- a/test/SemaCXX/default2.cpp |
| 505 +++ b/test/SemaCXX/default2.cpp |
| 506 @@ -122,3 +122,9 @@ class XX { |
| 507 void A(int length = -1 ) { } |
| 508 void B() { A(); } |
| 509 }; |
| 510 + |
| 511 +template <int I = (1 * I)> struct S {}; // expected-error-re {{use of undeclar
ed identifier 'I'{{$}}}} |
| 512 +S<1> s; |
| 513 + |
| 514 +template <int I1 = I2, int I2 = 1> struct T {}; // expected-error-re {{use of
undeclared identifier 'I2'{{$}}}} |
| 515 +T<0, 1> t; |
| 516 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc
tion-delayed.cpp |
| 517 index bff1d76..7bf9258 100644 |
| 518 --- a/test/SemaCXX/typo-correction-delayed.cpp |
| 519 +++ b/test/SemaCXX/typo-correction-delayed.cpp |
| 520 @@ -102,3 +102,7 @@ void f(int *i) { |
| 521 __atomic_load(i, i, something_something); // expected-error-re {{use of unde
clared identifier 'something_something'{{$}}}} |
| 522 } |
| 523 } |
| 524 + |
| 525 +const int DefaultArg = 9; // expected-note {{'DefaultArg' declared here}} |
| 526 +template <int I = defaultArg> struct S {}; // expected-error {{use of undeclar
ed identifier 'defaultArg'; did you mean 'DefaultArg'?}} |
| 527 +S<1> s; |
| 528 EOF |
| 529 patch -p1 |
| 530 popd |
| 531 |
| 532 # Apply r223209: "Handle delayed corrections in a couple more error paths in P
arsePostfixExpressionSuffix." |
| 533 pushd "${CLANG_DIR}" |
| 534 cat << 'EOF' | |
| 535 --- a/lib/Parse/ParseExpr.cpp |
| 536 +++ b/lib/Parse/ParseExpr.cpp |
| 537 @@ -1390,6 +1390,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { |
| 538 SourceLocation OpenLoc = ConsumeToken(); |
| 539 |
| 540 if (ParseSimpleExpressionList(ExecConfigExprs, ExecConfigCommaLocs)) { |
| 541 + (void)Actions.CorrectDelayedTyposInExpr(LHS); |
| 542 LHS = ExprError(); |
| 543 } |
| 544 |
| 545 @@ -1440,6 +1441,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { |
| 546 if (Tok.isNot(tok::r_paren)) { |
| 547 if (ParseExpressionList(ArgExprs, CommaLocs, &Sema::CodeCompleteCall, |
| 548 LHS.get())) { |
| 549 + (void)Actions.CorrectDelayedTyposInExpr(LHS); |
| 550 LHS = ExprError(); |
| 551 } |
| 552 } |
| 553 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc
tion-delayed.cpp |
| 554 index 7bf9258..f7ef015 100644 |
| 555 --- a/test/SemaCXX/typo-correction-delayed.cpp |
| 556 +++ b/test/SemaCXX/typo-correction-delayed.cpp |
| 557 @@ -106,3 +106,9 @@ void f(int *i) { |
| 558 const int DefaultArg = 9; // expected-note {{'DefaultArg' declared here}} |
| 559 template <int I = defaultArg> struct S {}; // expected-error {{use of undeclar
ed identifier 'defaultArg'; did you mean 'DefaultArg'?}} |
| 560 S<1> s; |
| 561 + |
| 562 +namespace foo {} |
| 563 +void test_paren_suffix() { |
| 564 + foo::bar({5, 6}); // expected-error-re {{no member named 'bar' in namespace
'foo'{{$}}}} \ |
| 565 + // expected-error {{expected expression}} |
| 566 +} |
| 567 EOF |
| 568 patch -p1 |
| 569 popd |
| 570 |
| 571 # Apply r223705: "Handle possible TypoExprs in member initializers." |
| 572 pushd "${CLANG_DIR}" |
| 573 cat << 'EOF' | |
| 574 --- a/lib/Sema/SemaDeclCXX.cpp |
| 575 +++ b/lib/Sema/SemaDeclCXX.cpp |
| 576 @@ -2813,6 +2813,11 @@ Sema::BuildMemInitializer(Decl *ConstructorD, |
| 577 SourceLocation IdLoc, |
| 578 Expr *Init, |
| 579 SourceLocation EllipsisLoc) { |
| 580 + ExprResult Res = CorrectDelayedTyposInExpr(Init); |
| 581 + if (!Res.isUsable()) |
| 582 + return true; |
| 583 + Init = Res.get(); |
| 584 + |
| 585 if (!ConstructorD) |
| 586 return true; |
| 587 |
| 588 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc
tion-delayed.cpp |
| 589 index f7ef015..d303b58 100644 |
| 590 --- a/test/SemaCXX/typo-correction-delayed.cpp |
| 591 +++ b/test/SemaCXX/typo-correction-delayed.cpp |
| 592 @@ -112,3 +112,10 @@ void test_paren_suffix() { |
| 593 foo::bar({5, 6}); // expected-error-re {{no member named 'bar' in namespace
'foo'{{$}}}} \ |
| 594 // expected-error {{expected expression}} |
| 595 } |
| 596 + |
| 597 +const int kNum = 10; // expected-note {{'kNum' declared here}} |
| 598 +class SomeClass { |
| 599 + int Kind; |
| 600 +public: |
| 601 + explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared i
dentifier 'kSum'; did you mean 'kNum'?}} |
| 602 +}; |
| 603 EOF |
| 604 patch -p1 |
| 605 popd |
| 606 |
| 607 # Apply r224172: "Typo correction: Ignore temporary binding exprs after overlo
ad resolution" |
| 608 pushd "${CLANG_DIR}" |
| 609 cat << 'EOF' | |
| 610 --- a/lib/Sema/SemaExprCXX.cpp |
| 611 +++ b/lib/Sema/SemaExprCXX.cpp |
| 612 @@ -6105,8 +6105,13 @@ public: |
| 613 auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args, |
| 614 RParenLoc, ExecConfig); |
| 615 if (auto *OE = dyn_cast<OverloadExpr>(Callee)) { |
| 616 - if (!Result.isInvalid() && Result.get()) |
| 617 - OverloadResolution[OE] = cast<CallExpr>(Result.get())->getCallee(); |
| 618 + if (!Result.isInvalid() && Result.get()) { |
| 619 + Expr *ResultCall = Result.get(); |
| 620 + if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall)) |
| 621 + ResultCall = BE->getSubExpr(); |
| 622 + if (auto *CE = dyn_cast<CallExpr>(ResultCall)) |
| 623 + OverloadResolution[OE] = CE->getCallee(); |
| 624 + } |
| 625 } |
| 626 return Result; |
| 627 } |
| 628 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc
tion-delayed.cpp |
| 629 index d303b58..d42888f 100644 |
| 630 --- a/test/SemaCXX/typo-correction-delayed.cpp |
| 631 +++ b/test/SemaCXX/typo-correction-delayed.cpp |
| 632 @@ -119,3 +119,23 @@ class SomeClass { |
| 633 public: |
| 634 explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared i
dentifier 'kSum'; did you mean 'kNum'?}} |
| 635 }; |
| 636 + |
| 637 +extern "C" int printf(const char *, ...); |
| 638 + |
| 639 +// There used to be an issue with typo resolution inside overloads. |
| 640 +struct AssertionResult { |
| 641 + ~AssertionResult(); |
| 642 + operator bool(); |
| 643 + int val; |
| 644 +}; |
| 645 +AssertionResult Compare(const char *a, const char *b); |
| 646 +AssertionResult Compare(int a, int b); |
| 647 +int main() { |
| 648 + // expected-note@+1 {{'result' declared here}} |
| 649 + const char *result; |
| 650 + // expected-error@+1 {{use of undeclared identifier 'resulta'; did you mean '
result'?}} |
| 651 + if (AssertionResult ar = (Compare("value1", resulta))) |
| 652 + ; |
| 653 + else |
| 654 + printf("ar: %d\n", ar.val); |
| 655 +} |
| 656 EOF |
| 657 patch -p1 |
| 658 popd |
| 659 |
| 660 # Apply r224173: "Implement feedback on r224172 in PR21899" |
| 661 pushd "${CLANG_DIR}" |
| 662 cat << 'EOF' | |
| 663 --- a/lib/Sema/SemaExprCXX.cpp |
| 664 +++ b/lib/Sema/SemaExprCXX.cpp |
| 665 @@ -6105,7 +6105,7 @@ public: |
| 666 auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args, |
| 667 RParenLoc, ExecConfig); |
| 668 if (auto *OE = dyn_cast<OverloadExpr>(Callee)) { |
| 669 - if (!Result.isInvalid() && Result.get()) { |
| 670 + if (Result.isUsable()) { |
| 671 Expr *ResultCall = Result.get(); |
| 672 if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall)) |
| 673 ResultCall = BE->getSubExpr(); |
| 674 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc
tion-delayed.cpp |
| 675 index d42888f..7879d29 100644 |
| 676 --- a/test/SemaCXX/typo-correction-delayed.cpp |
| 677 +++ b/test/SemaCXX/typo-correction-delayed.cpp |
| 678 @@ -120,22 +120,13 @@ public: |
| 679 explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared i
dentifier 'kSum'; did you mean 'kNum'?}} |
| 680 }; |
| 681 |
| 682 -extern "C" int printf(const char *, ...); |
| 683 - |
| 684 // There used to be an issue with typo resolution inside overloads. |
| 685 -struct AssertionResult { |
| 686 - ~AssertionResult(); |
| 687 - operator bool(); |
| 688 - int val; |
| 689 -}; |
| 690 -AssertionResult Compare(const char *a, const char *b); |
| 691 -AssertionResult Compare(int a, int b); |
| 692 -int main() { |
| 693 +struct AssertionResult { ~AssertionResult(); }; |
| 694 +AssertionResult Overload(const char *a); |
| 695 +AssertionResult Overload(int a); |
| 696 +void UseOverload() { |
| 697 // expected-note@+1 {{'result' declared here}} |
| 698 const char *result; |
| 699 // expected-error@+1 {{use of undeclared identifier 'resulta'; did you mean '
result'?}} |
| 700 - if (AssertionResult ar = (Compare("value1", resulta))) |
| 701 - ; |
| 702 - else |
| 703 - printf("ar: %d\n", ar.val); |
| 704 + Overload(resulta); |
| 705 } |
| 706 EOF |
| 707 patch -p1 |
| 708 popd |
| 709 |
374 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21
552) | 710 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21
552) |
375 pushd "${LLVM_DIR}" | 711 pushd "${LLVM_DIR}" |
376 cat << 'EOF' | | 712 cat << 'EOF' | |
377 Index: test/Bindings/Go/go.test | 713 Index: test/Bindings/Go/go.test |
378 =================================================================== | 714 =================================================================== |
379 --- test/Bindings/Go/go.test (revision 223109) | 715 --- test/Bindings/Go/go.test (revision 223109) |
380 +++ test/Bindings/Go/go.test (working copy) | 716 +++ test/Bindings/Go/go.test (working copy) |
381 @@ -1,3 +1,3 @@ | 717 @@ -1,3 +1,3 @@ |
382 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm | 718 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm |
383 +; RUN: true | 719 +; RUN: true |
384 | 720 |
385 ; REQUIRES: shell | 721 ; REQUIRES: shell |
386 EOF | 722 EOF |
387 patch -p0 | 723 patch -p0 |
388 popd | 724 popd |
389 | 725 |
390 | |
391 fi | 726 fi |
392 | 727 |
393 # Echo all commands. | 728 # Echo all commands. |
394 set -x | 729 set -x |
395 | 730 |
396 # Set default values for CC and CXX if they're not set in the environment. | 731 # Set default values for CC and CXX if they're not set in the environment. |
397 CC=${CC:-cc} | 732 CC=${CC:-cc} |
398 CXX=${CXX:-c++} | 733 CXX=${CXX:-c++} |
399 | 734 |
400 if [[ -n "${gcc_toolchain}" ]]; then | 735 if [[ -n "${gcc_toolchain}" ]]; then |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 fi | 968 fi |
634 | 969 |
635 if [[ -n "$run_tests" ]]; then | 970 if [[ -n "$run_tests" ]]; then |
636 # Run Chrome tool tests. | 971 # Run Chrome tool tests. |
637 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 972 ninja -C "${LLVM_BUILD_DIR}" cr-check-all |
638 # Run the LLVM and Clang tests. | 973 # Run the LLVM and Clang tests. |
639 ninja -C "${LLVM_BUILD_DIR}" check-all | 974 ninja -C "${LLVM_BUILD_DIR}" check-all |
640 fi | 975 fi |
641 | 976 |
642 # After everything is done, log success for this revision. | 977 # After everything is done, log success for this revision. |
643 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 978 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" |
OLD | NEW |