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=228129 | 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" |
27 LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi" | 22 LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi" |
28 ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk" | 23 ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk" |
29 STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision" | 24 STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision" |
30 CHROMIUM_TOOLS_DIR="${THIS_DIR}/.." | 25 CHROMIUM_TOOLS_DIR="${THIS_DIR}/.." |
31 | 26 |
32 ABS_CHROMIUM_TOOLS_DIR="${PWD}/${CHROMIUM_TOOLS_DIR}" | 27 ABS_CHROMIUM_TOOLS_DIR="${PWD}/${CHROMIUM_TOOLS_DIR}" |
33 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}" | 28 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}" |
34 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}" | 29 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}" |
35 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}" | 30 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}" |
36 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}" | 31 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}" |
37 ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}" | 32 ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}" |
38 | 33 |
39 | 34 |
| 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 |
40 # ${A:-a} returns $A if it's set, a else. | 41 # ${A:-a} returns $A if it's set, a else. |
41 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} | 42 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} |
42 | 43 |
43 if [[ -z "$GYP_DEFINES" ]]; then | 44 if [[ -z "$GYP_DEFINES" ]]; then |
44 GYP_DEFINES= | 45 GYP_DEFINES= |
45 fi | 46 fi |
46 if [[ -z "$GYP_GENERATORS" ]]; then | 47 if [[ -z "$GYP_GENERATORS" ]]; then |
47 GYP_GENERATORS= | 48 GYP_GENERATORS= |
48 fi | 49 fi |
49 | 50 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 exit 0 | 159 exit 0 |
159 fi | 160 fi |
160 fi | 161 fi |
161 | 162 |
162 | 163 |
163 # Check if there's anything to be done, exit early if not. | 164 # Check if there's anything to be done, exit early if not. |
164 if [[ -f "${STAMP_FILE}" ]]; then | 165 if [[ -f "${STAMP_FILE}" ]]; then |
165 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}") | 166 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}") |
166 if [[ -z "$force_local_build" ]] && \ | 167 if [[ -z "$force_local_build" ]] && \ |
167 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ | 168 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ |
168 "${PACKAGE_VERSION}" ]]; then | 169 "${CLANG_AND_PLUGINS_REVISION}" ]]; then |
169 echo "Clang already at ${PACKAGE_VERSION}" | 170 echo "Clang already at ${CLANG_AND_PLUGINS_REVISION}" |
170 exit 0 | 171 exit 0 |
171 fi | 172 fi |
172 fi | 173 fi |
173 # To always force a new build if someone interrupts their build half way. | 174 # To always force a new build if someone interrupts their build half way. |
174 rm -f "${STAMP_FILE}" | 175 rm -f "${STAMP_FILE}" |
175 | 176 |
176 | 177 |
177 if [[ -z "$force_local_build" ]]; then | 178 if [[ -z "$force_local_build" ]]; then |
178 # Check if there's a prebuilt binary and if so just fetch that. That's faster, | 179 # Check if there's a prebuilt binary and if so just fetch that. That's faster, |
179 # and goma relies on having matching binary hashes on client and server too. | 180 # and goma relies on having matching binary hashes on client and server too. |
180 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang | 181 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang |
181 CDS_FILE="clang-${PACKAGE_VERSION}.tgz" | 182 CDS_FILE="clang-${CLANG_REVISION}.tgz" |
182 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) | 183 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) |
183 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" | 184 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" |
184 if [ "${OS}" = "Linux" ]; then | 185 if [ "${OS}" = "Linux" ]; then |
185 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" | 186 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" |
186 elif [ "${OS}" = "Darwin" ]; then | 187 elif [ "${OS}" = "Darwin" ]; then |
187 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" | 188 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" |
188 fi | 189 fi |
189 echo Trying to download prebuilt clang | 190 echo Trying to download prebuilt clang |
190 if which curl > /dev/null; then | 191 if which curl > /dev/null; then |
191 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \ | 192 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \ |
192 rm -rf "${CDS_OUT_DIR}" | 193 rm -rf "${CDS_OUT_DIR}" |
193 elif which wget > /dev/null; then | 194 elif which wget > /dev/null; then |
194 wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}" | 195 wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}" |
195 else | 196 else |
196 echo "Neither curl nor wget found. Please install one of these." | 197 echo "Neither curl nor wget found. Please install one of these." |
197 exit 1 | 198 exit 1 |
198 fi | 199 fi |
199 if [ -f "${CDS_OUTPUT}" ]; then | 200 if [ -f "${CDS_OUTPUT}" ]; then |
200 rm -rf "${LLVM_BUILD_DIR}" | 201 rm -rf "${LLVM_BUILD_DIR}" |
201 mkdir -p "${LLVM_BUILD_DIR}" | 202 mkdir -p "${LLVM_BUILD_DIR}" |
202 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" | 203 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" |
203 echo clang "${PACKAGE_VERSION}" unpacked | 204 echo clang "${CLANG_REVISION}" unpacked |
204 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 205 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" |
205 rm -rf "${CDS_OUT_DIR}" | 206 rm -rf "${CDS_OUT_DIR}" |
206 exit 0 | 207 exit 0 |
207 else | 208 else |
208 echo Did not find prebuilt clang "${PACKAGE_VERSION}", building | 209 echo Did not find prebuilt clang at r"${CLANG_REVISION}", building |
209 fi | 210 fi |
210 fi | 211 fi |
211 | 212 |
212 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then | 213 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then |
213 echo "Android NDK not found at ${ANDROID_NDK_DIR}" | 214 echo "Android NDK not found at ${ANDROID_NDK_DIR}" |
214 echo "The Android NDK is needed to build a Clang whose -fsanitize=address" | 215 echo "The Android NDK is needed to build a Clang whose -fsanitize=address" |
215 echo "works on Android. See " | 216 echo "works on Android. See " |
216 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how" | 217 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how" |
217 echo "to install the NDK, or pass --without-android." | 218 echo "to install the NDK, or pass --without-android." |
218 exit 1 | 219 exit 1 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 323 |
323 -TEST_F(LibclangReparseTest, ReparseWithModule) { | 324 -TEST_F(LibclangReparseTest, ReparseWithModule) { |
324 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) { | 325 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) { |
325 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;"; | 326 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;"; |
326 const char *HeaderBottom = "\n};\n#endif\n"; | 327 const char *HeaderBottom = "\n};\n#endif\n"; |
327 const char *MFile = "#include \"HeaderFile.h\"\nint main() {" | 328 const char *MFile = "#include \"HeaderFile.h\"\nint main() {" |
328 EOF | 329 EOF |
329 patch -p0 | 330 patch -p0 |
330 popd | 331 popd |
331 | 332 |
| 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 |
332 | 676 |
333 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR2155
2) | 677 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR2155
2) |
334 pushd "${LLVM_DIR}" | 678 pushd "${LLVM_DIR}" |
335 cat << 'EOF' | | 679 cat << 'EOF' | |
336 Index: test/Bindings/Go/go.test | 680 Index: test/Bindings/Go/go.test |
337 =================================================================== | 681 =================================================================== |
338 --- test/Bindings/Go/go.test (revision 223109) | 682 --- test/Bindings/Go/go.test (revision 223109) |
339 +++ test/Bindings/Go/go.test (working copy) | 683 +++ test/Bindings/Go/go.test (working copy) |
340 @@ -1,3 +1,3 @@ | 684 @@ -1,3 +1,3 @@ |
341 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm | 685 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 fi | 934 fi |
591 | 935 |
592 if [[ -n "$run_tests" ]]; then | 936 if [[ -n "$run_tests" ]]; then |
593 # Run Chrome tool tests. | 937 # Run Chrome tool tests. |
594 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 938 ninja -C "${LLVM_BUILD_DIR}" cr-check-all |
595 # Run the LLVM and Clang tests. | 939 # Run the LLVM and Clang tests. |
596 ninja -C "${LLVM_BUILD_DIR}" check-all | 940 ninja -C "${LLVM_BUILD_DIR}" check-all |
597 fi | 941 fi |
598 | 942 |
599 # After everything is done, log success for this revision. | 943 # After everything is done, log success for this revision. |
600 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 944 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" |
OLD | NEW |