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