Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Side by Side Diff: tools/clang/scripts/update.sh

Issue 959443002: Roll Clang 223108:230631 (+revert of r229678) (Closed) Base URL: precise:/work/chromium/src@clang_roll_230341
Patch Set: Variable names are hard Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/clang/scripts/repackage.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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=230631
12
13 # This is incremented when pushing a new build of Clang at the same revision.
14 CLANG_SUB_REVISION=2
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 --bootstrap) 86 --bootstrap)
82 bootstrap=yes 87 bootstrap=yes
83 ;; 88 ;;
84 --if-needed) 89 --if-needed)
85 if_needed=yes 90 if_needed=yes
86 ;; 91 ;;
87 --force-local-build) 92 --force-local-build)
88 force_local_build=yes 93 force_local_build=yes
89 ;; 94 ;;
90 --print-revision) 95 --print-revision)
91 echo $CLANG_REVISION 96 echo $PACKAGE_VERSION
92 exit 0 97 exit 0
93 ;; 98 ;;
94 --run-tests) 99 --run-tests)
95 run_tests=yes 100 run_tests=yes
96 ;; 101 ;;
97 --without-android) 102 --without-android)
98 with_android= 103 with_android=
99 ;; 104 ;;
100 --without-patches) 105 --without-patches)
101 with_patches= 106 with_patches=
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 exit 0 191 exit 0
187 fi 192 fi
188 fi 193 fi
189 194
190 195
191 # 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.
192 if [[ -f "${STAMP_FILE}" ]]; then 197 if [[ -f "${STAMP_FILE}" ]]; then
193 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}") 198 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}")
194 if [[ -z "$force_local_build" ]] && \ 199 if [[ -z "$force_local_build" ]] && \
195 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ 200 [[ "${PREVIOUSLY_BUILT_REVISON}" = \
196 "${CLANG_AND_PLUGINS_REVISION}" ]]; then 201 "${PACKAGE_VERSION}" ]]; then
197 echo "Clang already at ${CLANG_AND_PLUGINS_REVISION}" 202 echo "Clang already at ${PACKAGE_VERSION}"
198 exit 0 203 exit 0
199 fi 204 fi
200 fi 205 fi
201 # 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.
202 rm -f "${STAMP_FILE}" 207 rm -f "${STAMP_FILE}"
203 208
204 209
205 if [[ -z "$force_local_build" ]]; then 210 if [[ -z "$force_local_build" ]]; then
206 # 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,
207 # 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.
208 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang 213 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang
209 CDS_FILE="clang-${CLANG_REVISION}.tgz" 214 CDS_FILE="clang-${PACKAGE_VERSION}.tgz"
210 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) 215 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX)
211 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" 216 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}"
212 if [ "${OS}" = "Linux" ]; then 217 if [ "${OS}" = "Linux" ]; then
213 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" 218 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}"
214 elif [ "${OS}" = "Darwin" ]; then 219 elif [ "${OS}" = "Darwin" ]; then
215 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" 220 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}"
216 fi 221 fi
217 echo Trying to download prebuilt clang 222 echo Trying to download prebuilt clang
218 if which curl > /dev/null; then 223 if which curl > /dev/null; then
219 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \ 224 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \
220 rm -rf "${CDS_OUT_DIR}" 225 rm -rf "${CDS_OUT_DIR}"
221 elif which wget > /dev/null; then 226 elif which wget > /dev/null; then
222 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}"
223 else 228 else
224 echo "Neither curl nor wget found. Please install one of these." 229 echo "Neither curl nor wget found. Please install one of these."
225 exit 1 230 exit 1
226 fi 231 fi
227 if [ -f "${CDS_OUTPUT}" ]; then 232 if [ -f "${CDS_OUTPUT}" ]; then
228 rm -rf "${LLVM_BUILD_DIR}" 233 rm -rf "${LLVM_BUILD_DIR}"
229 mkdir -p "${LLVM_BUILD_DIR}" 234 mkdir -p "${LLVM_BUILD_DIR}"
230 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" 235 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}"
231 echo clang "${CLANG_REVISION}" unpacked 236 echo clang "${PACKAGE_VERSION}" unpacked
232 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" 237 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
233 rm -rf "${CDS_OUT_DIR}" 238 rm -rf "${CDS_OUT_DIR}"
234 exit 0 239 exit 0
235 else 240 else
236 echo Did not find prebuilt clang at r"${CLANG_REVISION}", building 241 echo Did not find prebuilt clang "${PACKAGE_VERSION}", building
237 fi 242 fi
238 fi 243 fi
239 244
240 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then 245 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then
241 echo "Android NDK not found at ${ANDROID_NDK_DIR}" 246 echo "Android NDK not found at ${ANDROID_NDK_DIR}"
242 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"
243 echo "works on Android. See " 248 echo "works on Android. See "
244 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how" 249 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how"
245 echo "to install the NDK, or pass --without-android." 250 echo "to install the NDK, or pass --without-android."
246 exit 1 251 exit 1
(...skipping 23 matching lines...) Expand all
270 "${CLANG_DIR}/lib/Frontend/InitPreprocessor.cpp" \ 275 "${CLANG_DIR}/lib/Frontend/InitPreprocessor.cpp" \
271 "${CLANG_DIR}/test/Frontend/exceptions.c" \ 276 "${CLANG_DIR}/test/Frontend/exceptions.c" \
272 "${CLANG_DIR}/test/Preprocessor/predefined-exceptions.m" \ 277 "${CLANG_DIR}/test/Preprocessor/predefined-exceptions.m" \
273 "${LLVM_DIR}/test/Bindings/Go/go.test" \ 278 "${LLVM_DIR}/test/Bindings/Go/go.test" \
274 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \ 279 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \
275 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \ 280 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \
276 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \ 281 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \
277 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \ 282 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \
278 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \ 283 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \
279 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \ 284 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \
285 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_stoptheworld_linux_libc dep.cc" \
286 "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \
280 ; do 287 ; do
281 if [[ -e "${i}" ]]; then 288 if [[ -e "${i}" ]]; then
282 rm -f "${i}" # For unversioned files. 289 rm -f "${i}" # For unversioned files.
283 svn revert "${i}" 290 svn revert "${i}"
284 fi; 291 fi;
285 done 292 done
286 293
287 echo Remove the Clang tools shim dir 294 echo Remove the Clang tools shim dir
288 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools 295 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools
289 rm -rfv ${CHROME_TOOLS_SHIM_DIR} 296 rm -rfv ${CHROME_TOOLS_SHIM_DIR}
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 359
353 -TEST_F(LibclangReparseTest, ReparseWithModule) { 360 -TEST_F(LibclangReparseTest, ReparseWithModule) {
354 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) { 361 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) {
355 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;"; 362 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;";
356 const char *HeaderBottom = "\n};\n#endif\n"; 363 const char *HeaderBottom = "\n};\n#endif\n";
357 const char *MFile = "#include \"HeaderFile.h\"\nint main() {" 364 const char *MFile = "#include \"HeaderFile.h\"\nint main() {"
358 EOF 365 EOF
359 patch -p0 366 patch -p0
360 popd 367 popd
361 368
362 # Apply r223211: "Revert r222997."
363 pushd "${LLVM_DIR}"
364 cat << 'EOF' |
365 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp
366 +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
367 @@ -921,8 +921,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySan itizerVisitor> {
368 Value *OriginPtr =
369 getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);
370 setOrigin(A, EntryIRB.CreateLoad(OriginPtr));
371 - } else {
372 - setOrigin(A, getCleanOrigin());
373 }
374 }
375 ArgOffset += RoundUpToAlignment(Size, kShadowTLSAlignment);
376 @@ -942,13 +940,15 @@ struct MemorySanitizerVisitor : public InstVisitor<MemoryS anitizerVisitor> {
377 /// \brief Get the origin for a value.
378 Value *getOrigin(Value *V) {
379 if (!MS.TrackOrigins) return nullptr;
380 - if (!PropagateShadow) return getCleanOrigin();
381 - if (isa<Constant>(V)) return getCleanOrigin();
382 - assert((isa<Instruction>(V) || isa<Argument>(V)) &&
383 - "Unexpected value type in getOrigin()");
384 - Value *Origin = OriginMap[V];
385 - assert(Origin && "Missing origin");
386 - return Origin;
387 + if (isa<Instruction>(V) || isa<Argument>(V)) {
388 + Value *Origin = OriginMap[V];
389 + if (!Origin) {
390 + DEBUG(dbgs() << "NO ORIGIN: " << *V << "\n");
391 + Origin = getCleanOrigin();
392 + }
393 + return Origin;
394 + }
395 + return getCleanOrigin();
396 }
397
398 /// \brief Get the origin for i-th argument of the instruction I.
399 @@ -1088,7 +1088,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemoryS anitizerVisitor> {
400 IRB.CreateStore(getCleanShadow(&I), ShadowPtr);
401
402 setShadow(&I, getCleanShadow(&I));
403 - setOrigin(&I, getCleanOrigin());
404 }
405
406 void visitAtomicRMWInst(AtomicRMWInst &I) {
407 EOF
408 patch -p1
409 popd
410
411 # Apply r223219: "Preserve LD_LIBRARY_PATH when using the 'env' command"
412 pushd "${CLANG_DIR}"
413 cat << 'EOF' |
414 --- a/test/Driver/env.c
415 +++ b/test/Driver/env.c
416 @@ -5,12 +5,14 @@
417 // REQUIRES: shell
418 //
419 // The PATH variable is heavily used when trying to find a linker.
420 -// RUN: env -i LC_ALL=C %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
421 +// RUN: env -i LC_ALL=C LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
422 +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
423 // RUN: --target=i386-unknown-linux \
424 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
425 // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
426 //
427 -// RUN: env -i LC_ALL=C PATH="" %clang -no-canonical-prefixes %s -### -o %t.o 2 >&1 \
428 +// RUN: env -i LC_ALL=C PATH="" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
429 +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
430 // RUN: --target=i386-unknown-linux \
431 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
432 // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
433 EOF
434 patch -p1
435 popd
436
437 # Revert r220714: "Frontend: Define __EXCEPTIONS if -fexceptions is passed"
438 pushd "${CLANG_DIR}"
439 cat << 'EOF' |
440 --- a/lib/Frontend/InitPreprocessor.cpp
441 +++ b/lib/Frontend/InitPreprocessor.cpp
442 @@ -566,7 +566,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
443 Builder.defineMacro("__BLOCKS__");
444 }
445
446 - if (!LangOpts.MSVCCompat && LangOpts.Exceptions)
447 + if (!LangOpts.MSVCCompat && LangOpts.CXXExceptions)
448 Builder.defineMacro("__EXCEPTIONS");
449 if (!LangOpts.MSVCCompat && LangOpts.RTTI)
450 Builder.defineMacro("__GXX_RTTI");
451 diff --git a/test/Frontend/exceptions.c b/test/Frontend/exceptions.c
452 index 981b5b9..4bbaaa3 100644
453 --- a/test/Frontend/exceptions.c
454 +++ b/test/Frontend/exceptions.c
455 @@ -1,9 +1,6 @@
456 -// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -DMS_MODE - verify %s
457 +// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -verify %s
458 // expected-no-diagnostics
459
460 -// RUN: %clang_cc1 -fms-compatibility -fexceptions -verify %s
461 -// expected-no-diagnostics
462 -
463 -#if defined(MS_MODE) && defined(__EXCEPTIONS)
464 +#if defined(__EXCEPTIONS)
465 #error __EXCEPTIONS should not be defined.
466 #endif
467 diff --git a/test/Preprocessor/predefined-exceptions.m b/test/Preprocessor/prede fined-exceptions.m
468 index 0791075..c13f429 100644
469 --- a/test/Preprocessor/predefined-exceptions.m
470 +++ b/test/Preprocessor/predefined-exceptions.m
471 @@ -1,6 +1,6 @@
472 // RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fexceptions -E -dM %s | Fi leCheck -check-prefix=CHECK-OBJC-NOCXX %s
473 // CHECK-OBJC-NOCXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
474 -// CHECK-OBJC-NOCXX: #define __EXCEPTIONS 1
475 +// CHECK-OBJC-NOCXX-NOT: #define __EXCEPTIONS 1
476
477 // RUN: %clang_cc1 -x objective-c++ -fobjc-exceptions -fexceptions -fcxx-except ions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-CXX %s
478 // CHECK-OBJC-CXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
479 EOF
480 patch -p1
481 popd
482
483 # Apply r223177: "Ensure typos in the default values of template parameters ge t diagnosed."
484 pushd "${CLANG_DIR}"
485 cat << 'EOF' |
486 --- a/lib/Parse/ParseTemplate.cpp
487 +++ b/lib/Parse/ParseTemplate.cpp
488 @@ -676,7 +676,7 @@ Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsign ed Position) {
489 GreaterThanIsOperatorScope G(GreaterThanIsOperator, false);
490 EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
491
492 - DefaultArg = ParseAssignmentExpression();
493 + DefaultArg = Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression()) ;
494 if (DefaultArg.isInvalid())
495 SkipUntil(tok::comma, tok::greater, StopAtSemi | StopBeforeMatch);
496 }
497 diff --git a/test/SemaCXX/default2.cpp b/test/SemaCXX/default2.cpp
498 index 1626044..c4d40b4 100644
499 --- a/test/SemaCXX/default2.cpp
500 +++ b/test/SemaCXX/default2.cpp
501 @@ -122,3 +122,9 @@ class XX {
502 void A(int length = -1 ) { }
503 void B() { A(); }
504 };
505 +
506 +template <int I = (1 * I)> struct S {}; // expected-error-re {{use of undeclar ed identifier 'I'{{$}}}}
507 +S<1> s;
508 +
509 +template <int I1 = I2, int I2 = 1> struct T {}; // expected-error-re {{use of undeclared identifier 'I2'{{$}}}}
510 +T<0, 1> t;
511 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc tion-delayed.cpp
512 index bff1d76..7bf9258 100644
513 --- a/test/SemaCXX/typo-correction-delayed.cpp
514 +++ b/test/SemaCXX/typo-correction-delayed.cpp
515 @@ -102,3 +102,7 @@ void f(int *i) {
516 __atomic_load(i, i, something_something); // expected-error-re {{use of unde clared identifier 'something_something'{{$}}}}
517 }
518 }
519 +
520 +const int DefaultArg = 9; // expected-note {{'DefaultArg' declared here}}
521 +template <int I = defaultArg> struct S {}; // expected-error {{use of undeclar ed identifier 'defaultArg'; did you mean 'DefaultArg'?}}
522 +S<1> s;
523 EOF
524 patch -p1
525 popd
526
527 # Apply r223209: "Handle delayed corrections in a couple more error paths in P arsePostfixExpressionSuffix."
528 pushd "${CLANG_DIR}"
529 cat << 'EOF' |
530 --- a/lib/Parse/ParseExpr.cpp
531 +++ b/lib/Parse/ParseExpr.cpp
532 @@ -1390,6 +1390,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
533 SourceLocation OpenLoc = ConsumeToken();
534
535 if (ParseSimpleExpressionList(ExecConfigExprs, ExecConfigCommaLocs)) {
536 + (void)Actions.CorrectDelayedTyposInExpr(LHS);
537 LHS = ExprError();
538 }
539
540 @@ -1440,6 +1441,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
541 if (Tok.isNot(tok::r_paren)) {
542 if (ParseExpressionList(ArgExprs, CommaLocs, &Sema::CodeCompleteCall,
543 LHS.get())) {
544 + (void)Actions.CorrectDelayedTyposInExpr(LHS);
545 LHS = ExprError();
546 }
547 }
548 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc tion-delayed.cpp
549 index 7bf9258..f7ef015 100644
550 --- a/test/SemaCXX/typo-correction-delayed.cpp
551 +++ b/test/SemaCXX/typo-correction-delayed.cpp
552 @@ -106,3 +106,9 @@ void f(int *i) {
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 +
557 +namespace foo {}
558 +void test_paren_suffix() {
559 + foo::bar({5, 6}); // expected-error-re {{no member named 'bar' in namespace 'foo'{{$}}}} \
560 + // expected-error {{expected expression}}
561 +}
562 EOF
563 patch -p1
564 popd
565
566 # Apply r223705: "Handle possible TypoExprs in member initializers."
567 pushd "${CLANG_DIR}"
568 cat << 'EOF' |
569 --- a/lib/Sema/SemaDeclCXX.cpp
570 +++ b/lib/Sema/SemaDeclCXX.cpp
571 @@ -2813,6 +2813,11 @@ Sema::BuildMemInitializer(Decl *ConstructorD,
572 SourceLocation IdLoc,
573 Expr *Init,
574 SourceLocation EllipsisLoc) {
575 + ExprResult Res = CorrectDelayedTyposInExpr(Init);
576 + if (!Res.isUsable())
577 + return true;
578 + Init = Res.get();
579 +
580 if (!ConstructorD)
581 return true;
582
583 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc tion-delayed.cpp
584 index f7ef015..d303b58 100644
585 --- a/test/SemaCXX/typo-correction-delayed.cpp
586 +++ b/test/SemaCXX/typo-correction-delayed.cpp
587 @@ -112,3 +112,10 @@ void test_paren_suffix() {
588 foo::bar({5, 6}); // expected-error-re {{no member named 'bar' in namespace 'foo'{{$}}}} \
589 // expected-error {{expected expression}}
590 }
591 +
592 +const int kNum = 10; // expected-note {{'kNum' declared here}}
593 +class SomeClass {
594 + int Kind;
595 +public:
596 + explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared i dentifier 'kSum'; did you mean 'kNum'?}}
597 +};
598 EOF
599 patch -p1
600 popd
601
602 # Apply r224172: "Typo correction: Ignore temporary binding exprs after overlo ad resolution"
603 pushd "${CLANG_DIR}"
604 cat << 'EOF' |
605 --- a/lib/Sema/SemaExprCXX.cpp
606 +++ b/lib/Sema/SemaExprCXX.cpp
607 @@ -6105,8 +6105,13 @@ public:
608 auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
609 RParenLoc, ExecConfig);
610 if (auto *OE = dyn_cast<OverloadExpr>(Callee)) {
611 - if (!Result.isInvalid() && Result.get())
612 - OverloadResolution[OE] = cast<CallExpr>(Result.get())->getCallee();
613 + if (!Result.isInvalid() && Result.get()) {
614 + Expr *ResultCall = Result.get();
615 + if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
616 + ResultCall = BE->getSubExpr();
617 + if (auto *CE = dyn_cast<CallExpr>(ResultCall))
618 + OverloadResolution[OE] = CE->getCallee();
619 + }
620 }
621 return Result;
622 }
623 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc tion-delayed.cpp
624 index d303b58..d42888f 100644
625 --- a/test/SemaCXX/typo-correction-delayed.cpp
626 +++ b/test/SemaCXX/typo-correction-delayed.cpp
627 @@ -119,3 +119,23 @@ class SomeClass {
628 public:
629 explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared i dentifier 'kSum'; did you mean 'kNum'?}}
630 };
631 +
632 +extern "C" int printf(const char *, ...);
633 +
634 +// There used to be an issue with typo resolution inside overloads.
635 +struct AssertionResult {
636 + ~AssertionResult();
637 + operator bool();
638 + int val;
639 +};
640 +AssertionResult Compare(const char *a, const char *b);
641 +AssertionResult Compare(int a, int b);
642 +int main() {
643 + // expected-note@+1 {{'result' declared here}}
644 + const char *result;
645 + // expected-error@+1 {{use of undeclared identifier 'resulta'; did you mean ' result'?}}
646 + if (AssertionResult ar = (Compare("value1", resulta)))
647 + ;
648 + else
649 + printf("ar: %d\n", ar.val);
650 +}
651 EOF
652 patch -p1
653 popd
654
655 # Apply r224173: "Implement feedback on r224172 in PR21899"
656 pushd "${CLANG_DIR}"
657 cat << 'EOF' |
658 --- a/lib/Sema/SemaExprCXX.cpp
659 +++ b/lib/Sema/SemaExprCXX.cpp
660 @@ -6105,7 +6105,7 @@ public:
661 auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
662 RParenLoc, ExecConfig);
663 if (auto *OE = dyn_cast<OverloadExpr>(Callee)) {
664 - if (!Result.isInvalid() && Result.get()) {
665 + if (Result.isUsable()) {
666 Expr *ResultCall = Result.get();
667 if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
668 ResultCall = BE->getSubExpr();
669 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc tion-delayed.cpp
670 index d42888f..7879d29 100644
671 --- a/test/SemaCXX/typo-correction-delayed.cpp
672 +++ b/test/SemaCXX/typo-correction-delayed.cpp
673 @@ -120,22 +120,13 @@ public:
674 explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared i dentifier 'kSum'; did you mean 'kNum'?}}
675 };
676
677 -extern "C" int printf(const char *, ...);
678 -
679 // There used to be an issue with typo resolution inside overloads.
680 -struct AssertionResult {
681 - ~AssertionResult();
682 - operator bool();
683 - int val;
684 -};
685 -AssertionResult Compare(const char *a, const char *b);
686 -AssertionResult Compare(int a, int b);
687 -int main() {
688 +struct AssertionResult { ~AssertionResult(); };
689 +AssertionResult Overload(const char *a);
690 +AssertionResult Overload(int a);
691 +void UseOverload() {
692 // expected-note@+1 {{'result' declared here}}
693 const char *result;
694 // expected-error@+1 {{use of undeclared identifier 'resulta'; did you mean ' result'?}}
695 - if (AssertionResult ar = (Compare("value1", resulta)))
696 - ;
697 - else
698 - printf("ar: %d\n", ar.val);
699 + Overload(resulta);
700 }
701 EOF
702 patch -p1
703 popd
704
705 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21 552) 369 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21 552)
706 pushd "${LLVM_DIR}" 370 pushd "${LLVM_DIR}"
707 cat << 'EOF' | 371 cat << 'EOF' |
708 Index: test/Bindings/Go/go.test 372 Index: test/Bindings/Go/go.test
709 =================================================================== 373 ===================================================================
710 --- test/Bindings/Go/go.test (revision 223109) 374 --- test/Bindings/Go/go.test (revision 223109)
711 +++ test/Bindings/Go/go.test (working copy) 375 +++ test/Bindings/Go/go.test (working copy)
712 @@ -1,3 +1,3 @@ 376 @@ -1,3 +1,3 @@
713 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm 377 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm
714 +; RUN: true 378 +; RUN: true
715 379
716 ; REQUIRES: shell 380 ; REQUIRES: shell
717 EOF 381 EOF
718 patch -p0 382 patch -p0
719 popd 383 popd
720 384
385 # Revert r229678.
386 pushd "${COMPILER_RT_DIR}"
387 cat << 'EOF' |
388 --- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
389 +++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
390 @@ -184,9 +184,10 @@ bool ThreadSuspender::SuspendAllThreads() {
391 // Pointer to the ThreadSuspender instance for use in signal handler.
392 static ThreadSuspender *thread_suspender_instance = NULL;
393
394 -// Synchronous signals that should not be blocked.
395 -static const int kSyncSignals[] = { SIGABRT, SIGILL, SIGFPE, SIGSEGV, SIGBUS,
396 - SIGXCPU, SIGXFSZ };
397 +// Signals that should not be blocked (this is used in the parent thread as wel l
398 +// as the tracer thread).
399 +static const int kUnblockedSignals[] = { SIGABRT, SIGILL, SIGFPE, SIGSEGV,
400 + SIGBUS, SIGXCPU, SIGXFSZ };
401
402 // Structure for passing arguments into the tracer thread.
403 struct TracerThreadArgument {
404 @@ -201,7 +202,7 @@ struct TracerThreadArgument {
405 static DieCallbackType old_die_callback;
406
407 // Signal handler to wake up suspended threads when the tracer thread dies.
408 -static void TracerThreadSignalHandler(int signum, void *siginfo, void *) {
409 +void TracerThreadSignalHandler(int signum, void *siginfo, void *) {
410 if (thread_suspender_instance != NULL) {
411 if (signum == SIGABRT)
412 thread_suspender_instance->KillAllThreads();
413 @@ -241,7 +242,6 @@ static int TracerThread(void* argument) {
414 tracer_thread_argument->mutex.Lock();
415 tracer_thread_argument->mutex.Unlock();
416
417 - old_die_callback = GetDieCallback();
418 SetDieCallback(TracerThreadDieCallback);
419
420 ThreadSuspender thread_suspender(internal_getppid());
421 @@ -256,14 +256,17 @@ static int TracerThread(void* argument) {
422 handler_stack.ss_size = kHandlerStackSize;
423 internal_sigaltstack(&handler_stack, NULL);
424
425 - // Install our handler for synchronous signals. Other signals should be
426 - // blocked by the mask we inherited from the parent thread.
427 - for (uptr i = 0; i < ARRAY_SIZE(kSyncSignals); i++) {
428 - __sanitizer_sigaction act;
429 - internal_memset(&act, 0, sizeof(act));
430 - act.sigaction = TracerThreadSignalHandler;
431 - act.sa_flags = SA_ONSTACK | SA_SIGINFO;
432 - internal_sigaction_norestorer(kSyncSignals[i], &act, 0);
433 + // Install our handler for fatal signals. Other signals should be blocked by
434 + // the mask we inherited from the caller thread.
435 + for (uptr signal_index = 0; signal_index < ARRAY_SIZE(kUnblockedSignals);
436 + signal_index++) {
437 + __sanitizer_sigaction new_sigaction;
438 + internal_memset(&new_sigaction, 0, sizeof(new_sigaction));
439 + new_sigaction.sigaction = TracerThreadSignalHandler;
440 + new_sigaction.sa_flags = SA_ONSTACK | SA_SIGINFO;
441 + internal_sigfillset(&new_sigaction.sa_mask);
442 + internal_sigaction_norestorer(kUnblockedSignals[signal_index],
443 + &new_sigaction, NULL);
444 }
445
446 int exit_code = 0;
447 @@ -276,11 +279,9 @@ static int TracerThread(void* argument) {
448 thread_suspender.ResumeAllThreads();
449 exit_code = 0;
450 }
451 - // Note, this is a bad race. If TracerThreadDieCallback is already started
452 - // in another thread and observed that thread_suspender_instance != 0,
453 - // it can call KillAllThreads on the destroyed variable.
454 - SetDieCallback(old_die_callback);
455 thread_suspender_instance = NULL;
456 + handler_stack.ss_flags = SS_DISABLE;
457 + internal_sigaltstack(&handler_stack, NULL);
458 return exit_code;
459 }
460
461 @@ -312,21 +313,53 @@ class ScopedStackSpaceWithGuard {
462 // into globals.
463 static __sanitizer_sigset_t blocked_sigset;
464 static __sanitizer_sigset_t old_sigset;
465 +static __sanitizer_sigaction old_sigactions
466 + [ARRAY_SIZE(kUnblockedSignals)];
467
468 class StopTheWorldScope {
469 public:
470 StopTheWorldScope() {
471 + // Block all signals that can be blocked safely, and install
472 + // default handlers for the remaining signals.
473 + // We cannot allow user-defined handlers to run while the ThreadSuspender
474 + // thread is active, because they could conceivably call some libc function s
475 + // which modify errno (which is shared between the two threads).
476 + internal_sigfillset(&blocked_sigset);
477 + for (uptr signal_index = 0; signal_index < ARRAY_SIZE(kUnblockedSignals);
478 + signal_index++) {
479 + // Remove the signal from the set of blocked signals.
480 + internal_sigdelset(&blocked_sigset, kUnblockedSignals[signal_index]);
481 + // Install the default handler.
482 + __sanitizer_sigaction new_sigaction;
483 + internal_memset(&new_sigaction, 0, sizeof(new_sigaction));
484 + new_sigaction.handler = SIG_DFL;
485 + internal_sigfillset(&new_sigaction.sa_mask);
486 + internal_sigaction_norestorer(kUnblockedSignals[signal_index],
487 + &new_sigaction, &old_sigactions[signal_index]);
488 + }
489 + int sigprocmask_status =
490 + internal_sigprocmask(SIG_BLOCK, &blocked_sigset, &old_sigset);
491 + CHECK_EQ(sigprocmask_status, 0); // sigprocmask should never fail
492 // Make this process dumpable. Processes that are not dumpable cannot be
493 // attached to.
494 process_was_dumpable_ = internal_prctl(PR_GET_DUMPABLE, 0, 0, 0, 0);
495 if (!process_was_dumpable_)
496 internal_prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
497 + old_die_callback = GetDieCallback();
498 }
499
500 ~StopTheWorldScope() {
501 + SetDieCallback(old_die_callback);
502 // Restore the dumpable flag.
503 if (!process_was_dumpable_)
504 internal_prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);
505 + // Restore the signal handlers.
506 + for (uptr signal_index = 0; signal_index < ARRAY_SIZE(kUnblockedSignals);
507 + signal_index++) {
508 + internal_sigaction_norestorer(kUnblockedSignals[signal_index],
509 + &old_sigactions[signal_index], NULL);
510 + }
511 + internal_sigprocmask(SIG_SETMASK, &old_sigset, &old_sigset);
512 }
513
514 private:
515 @@ -359,36 +392,11 @@ void StopTheWorld(StopTheWorldCallback callback, void *arg ument) {
516 // Block the execution of TracerThread until after we have set ptrace
517 // permissions.
518 tracer_thread_argument.mutex.Lock();
519 - // Signal handling story.
520 - // We don't want async signals to be delivered to the tracer thread,
521 - // so we block all async signals before creating the thread. An async signal
522 - // handler can temporary modify errno, which is shared with this thread.
523 - // We ought to use pthread_sigmask here, because sigprocmask has undefined
524 - // behavior in multithreaded programs. However, on linux sigprocmask is
525 - // equivalent to pthread_sigmask with the exception that pthread_sigmask
526 - // does not allow to block some signals used internally in pthread
527 - // implementation. We are fine with blocking them here, we are really not
528 - // going to pthread_cancel the thread.
529 - // The tracer thread should not raise any synchronous signals. But in case it
530 - // does, we setup a special handler for sync signals that properly kills the
531 - // parent as well. Note: we don't pass CLONE_SIGHAND to clone, so handlers
532 - // in the tracer thread won't interfere with user program. Double note: if a
533 - // user does something along the lines of 'kill -11 pid', that can kill the
534 - // process even if user setup own handler for SEGV.
535 - // Thing to watch out for: this code should not change behavior of user code
536 - // in any observable way. In particular it should not override user signal
537 - // handlers.
538 - internal_sigfillset(&blocked_sigset);
539 - for (uptr i = 0; i < ARRAY_SIZE(kSyncSignals); i++)
540 - internal_sigdelset(&blocked_sigset, kSyncSignals[i]);
541 - int rv = internal_sigprocmask(SIG_BLOCK, &blocked_sigset, &old_sigset);
542 - CHECK_EQ(rv, 0);
543 uptr tracer_pid = internal_clone(
544 TracerThread, tracer_stack.Bottom(),
545 CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_UNTRACED,
546 &tracer_thread_argument, 0 /* parent_tidptr */, 0 /* newtls */, 0
547 /* child_tidptr */);
548 - internal_sigprocmask(SIG_SETMASK, &old_sigset, 0);
549 int local_errno = 0;
550 if (internal_iserror(tracer_pid, &local_errno)) {
551 VReport(1, "Failed spawning a tracer thread (errno %d).\n", local_errno);
552 diff --git a/compiler-rt/test/tsan/signal_segv_handler.cc b/compiler-rt/test/tsa n/signal_segv_handler.cc
553 deleted file mode 100644
554 index 2d806ee..0000000
555 --- a/test/tsan/signal_segv_handler.cc
556 +++ /dev/null
557 @@ -1,39 +0,0 @@
558 -// RUN: %clang_tsan -O1 %s -o %t && TSAN_OPTIONS="flush_memory_ms=1 memory_limi t_mb=1" %run %t 2>&1 | FileCheck %s
559 -
560 -// JVM uses SEGV to preempt threads. All threads do a load from a known address
561 -// periodically. When runtime needs to preempt threads, it unmaps the page.
562 -// Threads start triggering SEGV one by one. The signal handler blocks
563 -// threads while runtime does its thing. Then runtime maps the page again
564 -// and resumes the threads.
565 -// Previously this pattern conflicted with stop-the-world machinery,
566 -// because it briefly reset SEGV handler to SIG_DFL.
567 -// As the consequence JVM just silently died.
568 -
569 -// This test sets memory flushing rate to maximum, then does series of
570 -// "benign" SEGVs that are handled by signal handler, and ensures that
571 -// the process survive.
572 -
573 -#include "test.h"
574 -#include <signal.h>
575 -#include <sys/mman.h>
576 -
577 -void *guard;
578 -
579 -void handler(int signo, siginfo_t *info, void *uctx) {
580 - mprotect(guard, 4096, PROT_READ | PROT_WRITE);
581 -}
582 -
583 -int main() {
584 - struct sigaction a;
585 - a.sa_sigaction = handler;
586 - a.sa_flags = SA_SIGINFO;
587 - sigaction(SIGSEGV, &a, 0);
588 - guard = mmap(0, 4096, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
589 - for (int i = 0; i < 1000000; i++) {
590 - mprotect(guard, 4096, PROT_NONE);
591 - *(int*)guard = 1;
592 - }
593 - fprintf(stderr, "DONE\n");
594 -}
595 -
596 -// CHECK: DONE
597 EOF
598 patch -p1
599 popd
600
601
602
603
721 fi 604 fi
722 605
723 # Echo all commands. 606 # Echo all commands.
724 set -x 607 set -x
725 608
726 # Set default values for CC and CXX if they're not set in the environment. 609 # Set default values for CC and CXX if they're not set in the environment.
727 CC=${CC:-cc} 610 CC=${CC:-cc}
728 CXX=${CXX:-c++} 611 CXX=${CXX:-c++}
729 612
730 if [[ -n "${gcc_toolchain}" ]]; then 613 if [[ -n "${gcc_toolchain}" ]]; then
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 fi 846 fi
964 847
965 if [[ -n "$run_tests" ]]; then 848 if [[ -n "$run_tests" ]]; then
966 # Run Chrome tool tests. 849 # Run Chrome tool tests.
967 ninja -C "${LLVM_BUILD_DIR}" cr-check-all 850 ninja -C "${LLVM_BUILD_DIR}" cr-check-all
968 # Run the LLVM and Clang tests. 851 # Run the LLVM and Clang tests.
969 ninja -C "${LLVM_BUILD_DIR}" check-all 852 ninja -C "${LLVM_BUILD_DIR}" check-all
970 fi 853 fi
971 854
972 # After everything is done, log success for this revision. 855 # After everything is done, log success for this revision.
973 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" 856 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
OLDNEW
« no previous file with comments | « tools/clang/scripts/repackage.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698