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