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

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

Issue 881763003: Roll Clang 223108:228742 (Closed) Base URL: precise:/work/chromium/src@clang_roll_226907
Patch Set: Don't run SandboxBPF.SigBus under ASan; SIGBUS is treated as a fatal signal after r225630 Created 5 years, 10 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
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=228129
12 CLANG_BUILD=1
Nico 2015/02/05 23:51:49 this could use a better name, and maybe a short co
hans 2015/02/06 00:05:34 Done. I've renamed it CLANG_SUB_REVISION and added
13
14 PACKAGE_VERSION="${CLANG_REVISION}-${CLANG_BUILD}"
12 15
13 THIS_DIR="$(dirname "${0}")" 16 THIS_DIR="$(dirname "${0}")"
14 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" 17 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm"
15 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts" 18 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts"
16 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt" 19 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt"
17 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" 20 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap"
18 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" 21 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install"
19 CLANG_DIR="${LLVM_DIR}/tools/clang" 22 CLANG_DIR="${LLVM_DIR}/tools/clang"
20 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt" 23 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt"
21 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx" 24 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx"
22 LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi" 25 LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi"
23 ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk" 26 ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk"
24 STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision" 27 STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision"
25 CHROMIUM_TOOLS_DIR="${THIS_DIR}/.." 28 CHROMIUM_TOOLS_DIR="${THIS_DIR}/.."
26 29
27 ABS_CHROMIUM_TOOLS_DIR="${PWD}/${CHROMIUM_TOOLS_DIR}" 30 ABS_CHROMIUM_TOOLS_DIR="${PWD}/${CHROMIUM_TOOLS_DIR}"
28 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}" 31 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}"
29 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}" 32 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}"
30 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}" 33 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}"
31 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}" 34 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}"
32 ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}" 35 ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}"
33 36
34 37
35 # Use both the clang revision and the plugin revisions to test for updates.
36 BLINKGCPLUGIN_REVISION=\
37 $(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \
38 | cut -d ' ' -f 2 | tr -cd '[0-9]')
39 CLANG_AND_PLUGINS_REVISION="${CLANG_REVISION}-${BLINKGCPLUGIN_REVISION}"
40
41 # ${A:-a} returns $A if it's set, a else. 38 # ${A:-a} returns $A if it's set, a else.
42 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} 39 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project}
43 40
44 if [[ -z "$GYP_DEFINES" ]]; then 41 if [[ -z "$GYP_DEFINES" ]]; then
45 GYP_DEFINES= 42 GYP_DEFINES=
46 fi 43 fi
47 if [[ -z "$GYP_GENERATORS" ]]; then 44 if [[ -z "$GYP_GENERATORS" ]]; then
48 GYP_GENERATORS= 45 GYP_GENERATORS=
49 fi 46 fi
50 47
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 exit 0 156 exit 0
160 fi 157 fi
161 fi 158 fi
162 159
163 160
164 # Check if there's anything to be done, exit early if not. 161 # Check if there's anything to be done, exit early if not.
165 if [[ -f "${STAMP_FILE}" ]]; then 162 if [[ -f "${STAMP_FILE}" ]]; then
166 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}") 163 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}")
167 if [[ -z "$force_local_build" ]] && \ 164 if [[ -z "$force_local_build" ]] && \
168 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ 165 [[ "${PREVIOUSLY_BUILT_REVISON}" = \
169 "${CLANG_AND_PLUGINS_REVISION}" ]]; then 166 "${PACKAGE_VERSION}" ]]; then
170 echo "Clang already at ${CLANG_AND_PLUGINS_REVISION}" 167 echo "Clang already at ${PACKAGE_VERSION}"
171 exit 0 168 exit 0
172 fi 169 fi
173 fi 170 fi
174 # To always force a new build if someone interrupts their build half way. 171 # To always force a new build if someone interrupts their build half way.
175 rm -f "${STAMP_FILE}" 172 rm -f "${STAMP_FILE}"
176 173
177 174
178 if [[ -z "$force_local_build" ]]; then 175 if [[ -z "$force_local_build" ]]; then
179 # Check if there's a prebuilt binary and if so just fetch that. That's faster, 176 # Check if there's a prebuilt binary and if so just fetch that. That's faster,
180 # and goma relies on having matching binary hashes on client and server too. 177 # and goma relies on having matching binary hashes on client and server too.
181 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang 178 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang
182 CDS_FILE="clang-${CLANG_REVISION}.tgz" 179 CDS_FILE="clang-${PACKAGE_VERSION}.tgz"
183 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) 180 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX)
184 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" 181 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}"
185 if [ "${OS}" = "Linux" ]; then 182 if [ "${OS}" = "Linux" ]; then
186 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" 183 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}"
187 elif [ "${OS}" = "Darwin" ]; then 184 elif [ "${OS}" = "Darwin" ]; then
188 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" 185 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}"
189 fi 186 fi
190 echo Trying to download prebuilt clang 187 echo Trying to download prebuilt clang
191 if which curl > /dev/null; then 188 if which curl > /dev/null; then
192 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \ 189 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \
193 rm -rf "${CDS_OUT_DIR}" 190 rm -rf "${CDS_OUT_DIR}"
194 elif which wget > /dev/null; then 191 elif which wget > /dev/null; then
195 wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}" 192 wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}"
196 else 193 else
197 echo "Neither curl nor wget found. Please install one of these." 194 echo "Neither curl nor wget found. Please install one of these."
198 exit 1 195 exit 1
199 fi 196 fi
200 if [ -f "${CDS_OUTPUT}" ]; then 197 if [ -f "${CDS_OUTPUT}" ]; then
201 rm -rf "${LLVM_BUILD_DIR}" 198 rm -rf "${LLVM_BUILD_DIR}"
202 mkdir -p "${LLVM_BUILD_DIR}" 199 mkdir -p "${LLVM_BUILD_DIR}"
203 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" 200 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}"
204 echo clang "${CLANG_REVISION}" unpacked 201 echo clang "${PACKAGE_VERSION}" unpacked
205 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" 202 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
206 rm -rf "${CDS_OUT_DIR}" 203 rm -rf "${CDS_OUT_DIR}"
207 exit 0 204 exit 0
208 else 205 else
209 echo Did not find prebuilt clang at r"${CLANG_REVISION}", building 206 echo Did not find prebuilt clang "${PACKAGE_VERSION}", building
210 fi 207 fi
211 fi 208 fi
212 209
213 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then 210 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then
214 echo "Android NDK not found at ${ANDROID_NDK_DIR}" 211 echo "Android NDK not found at ${ANDROID_NDK_DIR}"
215 echo "The Android NDK is needed to build a Clang whose -fsanitize=address" 212 echo "The Android NDK is needed to build a Clang whose -fsanitize=address"
216 echo "works on Android. See " 213 echo "works on Android. See "
217 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how" 214 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how"
218 echo "to install the NDK, or pass --without-android." 215 echo "to install the NDK, or pass --without-android."
219 exit 1 216 exit 1
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 320
324 -TEST_F(LibclangReparseTest, ReparseWithModule) { 321 -TEST_F(LibclangReparseTest, ReparseWithModule) {
325 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) { 322 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) {
326 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;"; 323 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;";
327 const char *HeaderBottom = "\n};\n#endif\n"; 324 const char *HeaderBottom = "\n};\n#endif\n";
328 const char *MFile = "#include \"HeaderFile.h\"\nint main() {" 325 const char *MFile = "#include \"HeaderFile.h\"\nint main() {"
329 EOF 326 EOF
330 patch -p0 327 patch -p0
331 popd 328 popd
332 329
333 # Apply r223211: "Revert r222997."
334 pushd "${LLVM_DIR}"
335 cat << 'EOF' |
336 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp
337 +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
338 @@ -921,8 +921,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySan itizerVisitor> {
339 Value *OriginPtr =
340 getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);
341 setOrigin(A, EntryIRB.CreateLoad(OriginPtr));
342 - } else {
343 - setOrigin(A, getCleanOrigin());
344 }
345 }
346 ArgOffset += RoundUpToAlignment(Size, kShadowTLSAlignment);
347 @@ -942,13 +940,15 @@ struct MemorySanitizerVisitor : public InstVisitor<MemoryS anitizerVisitor> {
348 /// \brief Get the origin for a value.
349 Value *getOrigin(Value *V) {
350 if (!MS.TrackOrigins) return nullptr;
351 - if (!PropagateShadow) return getCleanOrigin();
352 - if (isa<Constant>(V)) return getCleanOrigin();
353 - assert((isa<Instruction>(V) || isa<Argument>(V)) &&
354 - "Unexpected value type in getOrigin()");
355 - Value *Origin = OriginMap[V];
356 - assert(Origin && "Missing origin");
357 - return Origin;
358 + if (isa<Instruction>(V) || isa<Argument>(V)) {
359 + Value *Origin = OriginMap[V];
360 + if (!Origin) {
361 + DEBUG(dbgs() << "NO ORIGIN: " << *V << "\n");
362 + Origin = getCleanOrigin();
363 + }
364 + return Origin;
365 + }
366 + return getCleanOrigin();
367 }
368
369 /// \brief Get the origin for i-th argument of the instruction I.
370 @@ -1088,7 +1088,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemoryS anitizerVisitor> {
371 IRB.CreateStore(getCleanShadow(&I), ShadowPtr);
372
373 setShadow(&I, getCleanShadow(&I));
374 - setOrigin(&I, getCleanOrigin());
375 }
376
377 void visitAtomicRMWInst(AtomicRMWInst &I) {
378 EOF
379 patch -p1
380 popd
381
382 # Apply r223219: "Preserve LD_LIBRARY_PATH when using the 'env' command"
383 pushd "${CLANG_DIR}"
384 cat << 'EOF' |
385 --- a/test/Driver/env.c
386 +++ b/test/Driver/env.c
387 @@ -5,12 +5,14 @@
388 // REQUIRES: shell
389 //
390 // The PATH variable is heavily used when trying to find a linker.
391 -// RUN: env -i LC_ALL=C %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
392 +// RUN: env -i LC_ALL=C LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
393 +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
394 // RUN: --target=i386-unknown-linux \
395 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
396 // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
397 //
398 -// RUN: env -i LC_ALL=C PATH="" %clang -no-canonical-prefixes %s -### -o %t.o 2 >&1 \
399 +// RUN: env -i LC_ALL=C PATH="" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
400 +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
401 // RUN: --target=i386-unknown-linux \
402 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
403 // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
404 EOF
405 patch -p1
406 popd
407
408 # Revert r220714: "Frontend: Define __EXCEPTIONS if -fexceptions is passed"
409 pushd "${CLANG_DIR}"
410 cat << 'EOF' |
411 --- a/lib/Frontend/InitPreprocessor.cpp
412 +++ b/lib/Frontend/InitPreprocessor.cpp
413 @@ -566,7 +566,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
414 Builder.defineMacro("__BLOCKS__");
415 }
416
417 - if (!LangOpts.MSVCCompat && LangOpts.Exceptions)
418 + if (!LangOpts.MSVCCompat && LangOpts.CXXExceptions)
419 Builder.defineMacro("__EXCEPTIONS");
420 if (!LangOpts.MSVCCompat && LangOpts.RTTI)
421 Builder.defineMacro("__GXX_RTTI");
422 diff --git a/test/Frontend/exceptions.c b/test/Frontend/exceptions.c
423 index 981b5b9..4bbaaa3 100644
424 --- a/test/Frontend/exceptions.c
425 +++ b/test/Frontend/exceptions.c
426 @@ -1,9 +1,6 @@
427 -// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -DMS_MODE - verify %s
428 +// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -verify %s
429 // expected-no-diagnostics
430
431 -// RUN: %clang_cc1 -fms-compatibility -fexceptions -verify %s
432 -// expected-no-diagnostics
433 -
434 -#if defined(MS_MODE) && defined(__EXCEPTIONS)
435 +#if defined(__EXCEPTIONS)
436 #error __EXCEPTIONS should not be defined.
437 #endif
438 diff --git a/test/Preprocessor/predefined-exceptions.m b/test/Preprocessor/prede fined-exceptions.m
439 index 0791075..c13f429 100644
440 --- a/test/Preprocessor/predefined-exceptions.m
441 +++ b/test/Preprocessor/predefined-exceptions.m
442 @@ -1,6 +1,6 @@
443 // RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fexceptions -E -dM %s | Fi leCheck -check-prefix=CHECK-OBJC-NOCXX %s
444 // CHECK-OBJC-NOCXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
445 -// CHECK-OBJC-NOCXX: #define __EXCEPTIONS 1
446 +// CHECK-OBJC-NOCXX-NOT: #define __EXCEPTIONS 1
447
448 // RUN: %clang_cc1 -x objective-c++ -fobjc-exceptions -fexceptions -fcxx-except ions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-CXX %s
449 // CHECK-OBJC-CXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
450 EOF
451 patch -p1
452 popd
453
454 # Apply r223177: "Ensure typos in the default values of template parameters get diagnosed."
455 pushd "${CLANG_DIR}"
456 cat << 'EOF' |
457 --- a/lib/Parse/ParseTemplate.cpp
458 +++ b/lib/Parse/ParseTemplate.cpp
459 @@ -676,7 +676,7 @@ Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsign ed Position) {
460 GreaterThanIsOperatorScope G(GreaterThanIsOperator, false);
461 EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
462
463 - DefaultArg = ParseAssignmentExpression();
464 + DefaultArg = Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression()) ;
465 if (DefaultArg.isInvalid())
466 SkipUntil(tok::comma, tok::greater, StopAtSemi | StopBeforeMatch);
467 }
468 diff --git a/test/SemaCXX/default2.cpp b/test/SemaCXX/default2.cpp
469 index 1626044..c4d40b4 100644
470 --- a/test/SemaCXX/default2.cpp
471 +++ b/test/SemaCXX/default2.cpp
472 @@ -122,3 +122,9 @@ class XX {
473 void A(int length = -1 ) { }
474 void B() { A(); }
475 };
476 +
477 +template <int I = (1 * I)> struct S {}; // expected-error-re {{use of undeclar ed identifier 'I'{{$}}}}
478 +S<1> s;
479 +
480 +template <int I1 = I2, int I2 = 1> struct T {}; // expected-error-re {{use of undeclared identifier 'I2'{{$}}}}
481 +T<0, 1> t;
482 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc tion-delayed.cpp
483 index bff1d76..7bf9258 100644
484 --- a/test/SemaCXX/typo-correction-delayed.cpp
485 +++ b/test/SemaCXX/typo-correction-delayed.cpp
486 @@ -102,3 +102,7 @@ void f(int *i) {
487 __atomic_load(i, i, something_something); // expected-error-re {{use of unde clared identifier 'something_something'{{$}}}}
488 }
489 }
490 +
491 +const int DefaultArg = 9; // expected-note {{'DefaultArg' declared here}}
492 +template <int I = defaultArg> struct S {}; // expected-error {{use of undeclar ed identifier 'defaultArg'; did you mean 'DefaultArg'?}}
493 +S<1> s;
494 EOF
495 patch -p1
496 popd
497
498 # Apply r223209: "Handle delayed corrections in a couple more error paths in Par sePostfixExpressionSuffix."
499 pushd "${CLANG_DIR}"
500 cat << 'EOF' |
501 --- a/lib/Parse/ParseExpr.cpp
502 +++ b/lib/Parse/ParseExpr.cpp
503 @@ -1390,6 +1390,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
504 SourceLocation OpenLoc = ConsumeToken();
505
506 if (ParseSimpleExpressionList(ExecConfigExprs, ExecConfigCommaLocs)) {
507 + (void)Actions.CorrectDelayedTyposInExpr(LHS);
508 LHS = ExprError();
509 }
510
511 @@ -1440,6 +1441,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
512 if (Tok.isNot(tok::r_paren)) {
513 if (ParseExpressionList(ArgExprs, CommaLocs, &Sema::CodeCompleteCall,
514 LHS.get())) {
515 + (void)Actions.CorrectDelayedTyposInExpr(LHS);
516 LHS = ExprError();
517 }
518 }
519 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc tion-delayed.cpp
520 index 7bf9258..f7ef015 100644
521 --- a/test/SemaCXX/typo-correction-delayed.cpp
522 +++ b/test/SemaCXX/typo-correction-delayed.cpp
523 @@ -106,3 +106,9 @@ void f(int *i) {
524 const int DefaultArg = 9; // expected-note {{'DefaultArg' declared here}}
525 template <int I = defaultArg> struct S {}; // expected-error {{use of undeclar ed identifier 'defaultArg'; did you mean 'DefaultArg'?}}
526 S<1> s;
527 +
528 +namespace foo {}
529 +void test_paren_suffix() {
530 + foo::bar({5, 6}); // expected-error-re {{no member named 'bar' in namespace 'foo'{{$}}}} \
531 + // expected-error {{expected expression}}
532 +}
533 EOF
534 patch -p1
535 popd
536
537 # Apply r223705: "Handle possible TypoExprs in member initializers."
538 pushd "${CLANG_DIR}"
539 cat << 'EOF' |
540 --- a/lib/Sema/SemaDeclCXX.cpp
541 +++ b/lib/Sema/SemaDeclCXX.cpp
542 @@ -2813,6 +2813,11 @@ Sema::BuildMemInitializer(Decl *ConstructorD,
543 SourceLocation IdLoc,
544 Expr *Init,
545 SourceLocation EllipsisLoc) {
546 + ExprResult Res = CorrectDelayedTyposInExpr(Init);
547 + if (!Res.isUsable())
548 + return true;
549 + Init = Res.get();
550 +
551 if (!ConstructorD)
552 return true;
553
554 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc tion-delayed.cpp
555 index f7ef015..d303b58 100644
556 --- a/test/SemaCXX/typo-correction-delayed.cpp
557 +++ b/test/SemaCXX/typo-correction-delayed.cpp
558 @@ -112,3 +112,10 @@ 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 +
563 +const int kNum = 10; // expected-note {{'kNum' declared here}}
564 +class SomeClass {
565 + int Kind;
566 +public:
567 + explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared i dentifier 'kSum'; did you mean 'kNum'?}}
568 +};
569 EOF
570 patch -p1
571 popd
572
573 # Apply r224172: "Typo correction: Ignore temporary binding exprs after overload resolution"
574 pushd "${CLANG_DIR}"
575 cat << 'EOF' |
576 --- a/lib/Sema/SemaExprCXX.cpp
577 +++ b/lib/Sema/SemaExprCXX.cpp
578 @@ -6105,8 +6105,13 @@ public:
579 auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
580 RParenLoc, ExecConfig);
581 if (auto *OE = dyn_cast<OverloadExpr>(Callee)) {
582 - if (!Result.isInvalid() && Result.get())
583 - OverloadResolution[OE] = cast<CallExpr>(Result.get())->getCallee();
584 + if (!Result.isInvalid() && Result.get()) {
585 + Expr *ResultCall = Result.get();
586 + if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
587 + ResultCall = BE->getSubExpr();
588 + if (auto *CE = dyn_cast<CallExpr>(ResultCall))
589 + OverloadResolution[OE] = CE->getCallee();
590 + }
591 }
592 return Result;
593 }
594 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc tion-delayed.cpp
595 index d303b58..d42888f 100644
596 --- a/test/SemaCXX/typo-correction-delayed.cpp
597 +++ b/test/SemaCXX/typo-correction-delayed.cpp
598 @@ -119,3 +119,23 @@ class SomeClass {
599 public:
600 explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared i dentifier 'kSum'; did you mean 'kNum'?}}
601 };
602 +
603 +extern "C" int printf(const char *, ...);
604 +
605 +// There used to be an issue with typo resolution inside overloads.
606 +struct AssertionResult {
607 + ~AssertionResult();
608 + operator bool();
609 + int val;
610 +};
611 +AssertionResult Compare(const char *a, const char *b);
612 +AssertionResult Compare(int a, int b);
613 +int main() {
614 + // expected-note@+1 {{'result' declared here}}
615 + const char *result;
616 + // expected-error@+1 {{use of undeclared identifier 'resulta'; did you mean ' result'?}}
617 + if (AssertionResult ar = (Compare("value1", resulta)))
618 + ;
619 + else
620 + printf("ar: %d\n", ar.val);
621 +}
622 EOF
623 patch -p1
624 popd
625
626 # Apply r224173: "Implement feedback on r224172 in PR21899"
627 pushd "${CLANG_DIR}"
628 cat << 'EOF' |
629 --- a/lib/Sema/SemaExprCXX.cpp
630 +++ b/lib/Sema/SemaExprCXX.cpp
631 @@ -6105,7 +6105,7 @@ public:
632 auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
633 RParenLoc, ExecConfig);
634 if (auto *OE = dyn_cast<OverloadExpr>(Callee)) {
635 - if (!Result.isInvalid() && Result.get()) {
636 + if (Result.isUsable()) {
637 Expr *ResultCall = Result.get();
638 if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
639 ResultCall = BE->getSubExpr();
640 diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correc tion-delayed.cpp
641 index d42888f..7879d29 100644
642 --- a/test/SemaCXX/typo-correction-delayed.cpp
643 +++ b/test/SemaCXX/typo-correction-delayed.cpp
644 @@ -120,22 +120,13 @@ public:
645 explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared i dentifier 'kSum'; did you mean 'kNum'?}}
646 };
647
648 -extern "C" int printf(const char *, ...);
649 -
650 // There used to be an issue with typo resolution inside overloads.
651 -struct AssertionResult {
652 - ~AssertionResult();
653 - operator bool();
654 - int val;
655 -};
656 -AssertionResult Compare(const char *a, const char *b);
657 -AssertionResult Compare(int a, int b);
658 -int main() {
659 +struct AssertionResult { ~AssertionResult(); };
660 +AssertionResult Overload(const char *a);
661 +AssertionResult Overload(int a);
662 +void UseOverload() {
663 // expected-note@+1 {{'result' declared here}}
664 const char *result;
665 // expected-error@+1 {{use of undeclared identifier 'resulta'; did you mean ' result'?}}
666 - if (AssertionResult ar = (Compare("value1", resulta)))
667 - ;
668 - else
669 - printf("ar: %d\n", ar.val);
670 + Overload(resulta);
671 }
672 EOF
673 patch -p1
674 popd
675
676 330
677 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR2155 2) 331 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR2155 2)
678 pushd "${LLVM_DIR}" 332 pushd "${LLVM_DIR}"
679 cat << 'EOF' | 333 cat << 'EOF' |
680 Index: test/Bindings/Go/go.test 334 Index: test/Bindings/Go/go.test
681 =================================================================== 335 ===================================================================
682 --- test/Bindings/Go/go.test (revision 223109) 336 --- test/Bindings/Go/go.test (revision 223109)
683 +++ test/Bindings/Go/go.test (working copy) 337 +++ test/Bindings/Go/go.test (working copy)
684 @@ -1,3 +1,3 @@ 338 @@ -1,3 +1,3 @@
685 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm 339 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 fi 588 fi
935 589
936 if [[ -n "$run_tests" ]]; then 590 if [[ -n "$run_tests" ]]; then
937 # Run Chrome tool tests. 591 # Run Chrome tool tests.
938 ninja -C "${LLVM_BUILD_DIR}" cr-check-all 592 ninja -C "${LLVM_BUILD_DIR}" cr-check-all
939 # Run the LLVM and Clang tests. 593 # Run the LLVM and Clang tests.
940 ninja -C "${LLVM_BUILD_DIR}" check-all 594 ninja -C "${LLVM_BUILD_DIR}" check-all
941 fi 595 fi
942 596
943 # After everything is done, log success for this revision. 597 # After everything is done, log success for this revision.
944 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" 598 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
OLDNEW
« sandbox/linux/bpf_dsl/bpf_dsl_more_unittest.cc ('K') | « tools/clang/scripts/repackage.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698