Commit 5b459de0 authored by tapted's avatar tapted Committed by Commit bot

Revert of Roll Clang 223108:228129 (patchset #5 id:80001 of...

Revert of Roll Clang 223108:228129 (patchset #5 id:80001 of https://codereview.chromium.org/881763003/)

Reason for revert:
compiler crash in http://build.chromium.org/p/chromium/builders/Mac/builds/33226

Assertion failed: (Offset <= PieceOffset && "overlapping or duplicate pieces"), function emitLocPieces, file /work/chromium/src/third_party/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp, line 1676.

0.	Program arguments: /Volumes/data/b/build/slave/Mac/build/src/third_party/llvm-build/Release+Asserts/bin/clang -cc1 -triple x86_64-apple-macosx10.6.0 /* snip */ -x c ../../third_party/mesa/src/src/mesa/program/prog_opt_constant_fold.c
1.	<eof> parser at end of file
2.	Code generation
clang:error: unable to execute command: Illegal instruction: 4
clang:error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.7.0 (trunk 228129)
Target: x86_64-apple-darwin13.4.0

Original issue's description:
> Roll Clang 223108:228129
>
> Also introduce a build number in the package name, stop versioning
> the Blink GC plugin, and remove repackage.sh.
>
> BUG=444089
>
> Committed: https://crrev.com/d30327adf468b78f79819a69bca12b64b7cb70ae
> Cr-Commit-Position: refs/heads/master@{#314946}

TBR=thakis@chromium.org,jln@chromium.org,jbauman@chromium.org,hans@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=444089

Review URL: https://codereview.chromium.org/898713004

Cr-Commit-Position: refs/heads/master@{#314950}
parent 7d841715
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
#if defined(ADDRESS_SANITIZER) #if defined(ADDRESS_SANITIZER)
#include <sanitizer/asan_interface.h> #include <sanitizer/asan_interface.h>
#include <sanitizer/coverage_interface.h>
#endif #endif
const int kGpuTimeout = 10000; const int kGpuTimeout = 10000;
......
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
#if defined(ADDRESS_SANITIZER) #if defined(ADDRESS_SANITIZER)
#include <sanitizer/asan_interface.h> #include <sanitizer/asan_interface.h>
#include <sanitizer/coverage_interface.h>
#endif #endif
namespace content { namespace content {
......
...@@ -652,10 +652,6 @@ ResultExpr RedirectAllSyscallsPolicy::EvaluateSyscall(int sysno) const { ...@@ -652,10 +652,6 @@ ResultExpr RedirectAllSyscallsPolicy::EvaluateSyscall(int sysno) const {
return UnsafeTrap(AllowRedirectedSyscall, NULL); return UnsafeTrap(AllowRedirectedSyscall, NULL);
} }
#if !defined(ADDRESS_SANITIZER)
// ASan does not allow changing the signal handler for SIGBUS, and treats it as
// a fatal signal.
int bus_handler_fd_ = -1; int bus_handler_fd_ = -1;
void SigBusHandler(int, siginfo_t* info, void* void_context) { void SigBusHandler(int, siginfo_t* info, void* void_context) {
...@@ -684,7 +680,6 @@ BPF_TEST_C(SandboxBPF, SigBus, RedirectAllSyscallsPolicy) { ...@@ -684,7 +680,6 @@ BPF_TEST_C(SandboxBPF, SigBus, RedirectAllSyscallsPolicy) {
BPF_ASSERT(close(fds[1]) == 0); BPF_ASSERT(close(fds[1]) == 0);
BPF_ASSERT(c == 0x55); BPF_ASSERT(c == 0x55);
} }
#endif // !defined(ADDRESS_SANITIZER)
BPF_TEST_C(SandboxBPF, SigMask, RedirectAllSyscallsPolicy) { BPF_TEST_C(SandboxBPF, SigMask, RedirectAllSyscallsPolicy) {
// Signal masks are potentially tricky to handle. For instance, if we // Signal masks are potentially tricky to handle. For instance, if we
......
# This line is read by update.sh and other scripts in tools/clang/scripts # This line is read by update.sh and other scripts in tools/clang/scripts
# Note: The spaces are significant. # Note: The spaces are significant.
set(LIBRARYNAME BlinkGCPlugin) set(LIBRARYNAME BlinkGCPlugin_14)
add_llvm_loadable_module("lib${LIBRARYNAME}" add_llvm_loadable_module("lib${LIBRARYNAME}"
BlinkGCPlugin.cpp BlinkGCPlugin.cpp
......
...@@ -24,7 +24,6 @@ class Collection; ...@@ -24,7 +24,6 @@ class Collection;
// Bare-bones visitor. // Bare-bones visitor.
class EdgeVisitor { class EdgeVisitor {
public: public:
virtual ~EdgeVisitor() {}
virtual void VisitValue(Value*) {} virtual void VisitValue(Value*) {}
virtual void VisitRawPtr(RawPtr*) {} virtual void VisitRawPtr(RawPtr*) {}
virtual void VisitRefPtr(RefPtr*) {} virtual void VisitRefPtr(RefPtr*) {}
......
...@@ -23,7 +23,6 @@ class RecordCache; ...@@ -23,7 +23,6 @@ class RecordCache;
class GraphPoint { class GraphPoint {
public: public:
GraphPoint() : traced_(false) {} GraphPoint() : traced_(false) {}
virtual ~GraphPoint() {}
void MarkTraced() { traced_ = true; } void MarkTraced() { traced_ = true; }
bool IsProperlyTraced() { return traced_ || !NeedsTracing().IsNeeded(); } bool IsProperlyTraced() { return traced_ || !NeedsTracing().IsNeeded(); }
virtual const TracingStatus NeedsTracing() = 0; virtual const TracingStatus NeedsTracing() = 0;
......
...@@ -29,7 +29,6 @@ do_testcase() { ...@@ -29,7 +29,6 @@ do_testcase() {
flags="$(cat "${3}")" flags="$(cat "${3}")"
fi fi
local output="$("${CLANG_PATH}" -c -Wno-c++11-extensions \ local output="$("${CLANG_PATH}" -c -Wno-c++11-extensions \
-Wno-inaccessible-base \
-Xclang -load -Xclang "${PLUGIN_PATH}" \ -Xclang -load -Xclang "${PLUGIN_PATH}" \
-Xclang -add-plugin -Xclang blink-gc-plugin ${flags} ${1} 2>&1)" -Xclang -add-plugin -Xclang blink-gc-plugin ${flags} ${1} 2>&1)"
local json="${input%cpp}graph.json" local json="${input%cpp}graph.json"
......
-Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -Xclang -plugin-arg-find-bad-constructs -Xclang check-weak-ptr-factory-order
...@@ -13,6 +13,9 @@ if uname -s | grep -q Darwin; then ...@@ -13,6 +13,9 @@ if uname -s | grep -q Darwin; then
else else
LIBSUFFIX=so LIBSUFFIX=so
fi fi
LIBNAME=\
$(grep 'set(LIBRARYNAME' "$SRC_DIR"/tools/clang/blink_gc_plugin/CMakeLists.txt \
| cut -d ' ' -f 2 | tr -d ')')
FLAGS="" FLAGS=""
PREFIX="-Xclang -plugin-arg-blink-gc-plugin -Xclang" PREFIX="-Xclang -plugin-arg-blink-gc-plugin -Xclang"
...@@ -28,5 +31,5 @@ for arg in "$@"; do ...@@ -28,5 +31,5 @@ for arg in "$@"; do
fi fi
done done
echo -Xclang -load -Xclang $CLANG_LIB_PATH/libBlinkGCPlugin.$LIBSUFFIX \ echo -Xclang -load -Xclang $CLANG_LIB_PATH/lib$LIBNAME.$LIBSUFFIX \
-Xclang -add-plugin -Xclang blink-gc-plugin $FLAGS -Xclang -add-plugin -Xclang blink-gc-plugin $FLAGS
...@@ -52,7 +52,6 @@ LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" ...@@ -52,7 +52,6 @@ LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install"
LLVM_BUILD_DIR="${THIS_DIR}/../../../third_party/llvm-build" LLVM_BUILD_DIR="${THIS_DIR}/../../../third_party/llvm-build"
LLVM_BIN_DIR="${LLVM_BUILD_DIR}/Release+Asserts/bin" LLVM_BIN_DIR="${LLVM_BUILD_DIR}/Release+Asserts/bin"
LLVM_LIB_DIR="${LLVM_BUILD_DIR}/Release+Asserts/lib" LLVM_LIB_DIR="${LLVM_BUILD_DIR}/Release+Asserts/lib"
STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision"
echo "Diff in llvm:" | tee buildlog.txt echo "Diff in llvm:" | tee buildlog.txt
svn stat "${LLVM_DIR}" 2>&1 | tee -a buildlog.txt svn stat "${LLVM_DIR}" 2>&1 | tee -a buildlog.txt
...@@ -87,7 +86,8 @@ fi ...@@ -87,7 +86,8 @@ fi
"${THIS_DIR}"/update.sh --bootstrap --force-local-build --run-tests \ "${THIS_DIR}"/update.sh --bootstrap --force-local-build --run-tests \
${extra_flags} 2>&1 | tee -a buildlog.txt ${extra_flags} 2>&1 | tee -a buildlog.txt
R=$(cat "${STAMP_FILE}") R=$("${LLVM_BIN_DIR}/clang" --version | \
sed -ne 's/clang version .*(trunk \([0-9]*\))/\1/p')
PDIR=clang-$R PDIR=clang-$R
rm -rf $PDIR rm -rf $PDIR
...@@ -122,7 +122,11 @@ fi ...@@ -122,7 +122,11 @@ fi
# Copy plugins. Some of the dylibs are pretty big, so copy only the ones we # Copy plugins. Some of the dylibs are pretty big, so copy only the ones we
# care about. # care about.
cp "${LLVM_LIB_DIR}/libFindBadConstructs.${SO_EXT}" $PDIR/lib cp "${LLVM_LIB_DIR}/libFindBadConstructs.${SO_EXT}" $PDIR/lib
cp "${LLVM_LIB_DIR}/libBlinkGCPlugin.${SO_EXT}" $PDIR/lib
BLINKGCPLUGIN_LIBNAME=\
$(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \
| cut -d ' ' -f 2 | tr -d ')')
cp "${LLVM_LIB_DIR}/lib${BLINKGCPLUGIN_LIBNAME}.${SO_EXT}" $PDIR/lib
if [[ -n "${gcc_toolchain}" ]]; then if [[ -n "${gcc_toolchain}" ]]; then
# Copy the stdlibc++.so.6 we linked Clang against so it can run. # Copy the stdlibc++.so.6 we linked Clang against so it can run.
...@@ -178,5 +182,3 @@ fi ...@@ -178,5 +182,3 @@ fi
echo To upload, run: echo To upload, run:
echo gsutil cp -a public-read $PDIR.tgz \ echo gsutil cp -a public-read $PDIR.tgz \
gs://chromium-browser-clang/$PLATFORM/$PDIR.tgz gs://chromium-browser-clang/$PLATFORM/$PDIR.tgz
# FIXME: Warn if the file already exists on the server.
...@@ -17,4 +17,5 @@ else ...@@ -17,4 +17,5 @@ else
fi fi
echo -Xclang -load -Xclang $CLANG_LIB_PATH/libFindBadConstructs.$LIBSUFFIX \ echo -Xclang -load -Xclang $CLANG_LIB_PATH/libFindBadConstructs.$LIBSUFFIX \
-Xclang -add-plugin -Xclang find-bad-constructs -Xclang -add-plugin -Xclang find-bad-constructs -Xclang \
-plugin-arg-find-bad-constructs -Xclang check-weak-ptr-factory-order
#!/bin/bash
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script will check out llvm and clang, build a full package
# with the latest plugin revisions and then repackage an existing
# clang-package with the new plugin revisions.
# The new package can be uploaded to replace the existing clang
# package at the same clang revision.
THIS_DIR="$(dirname "${0}")"
LLVM_BUILD_DIR="${THIS_DIR}/../../../third_party/llvm-build"
LLVM_TAR_DIR="${LLVM_BUILD_DIR}/Release+Asserts"
LLVM_BIN_DIR="${LLVM_TAR_DIR}/bin"
LLVM_LIB_DIR="${LLVM_TAR_DIR}/lib"
set -eu
if [ "$(uname -s)" = "Darwin" ]; then
PLATFORM=Mac
SO_EXT="dylib"
else
PLATFORM=Linux_x64
SO_EXT="so"
fi
# Build clang with the new plugin revisions.
"$THIS_DIR"/package.sh $@
R=$("${LLVM_BIN_DIR}/clang" --version | \
sed -ne 's/clang version .*(trunk \([0-9]*\))/\1/p')
PDIR=clang-$R
if [ ! -f "$PDIR.tgz" ]; then
echo "Could not find package archive $PDIR.tgz generated by package.sh"
exit 1
fi
# We don't want to change the clang binary, so fetch the current clang
# package and add the plugin shared-libraries to the existing package.
rm -rf $LLVM_BUILD_DIR
"$THIS_DIR"/update.sh
LIBNAME=\
$(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \
| cut -d ' ' -f 2 | tr -d ')')
LIBFILE=lib$LIBNAME.$SO_EXT
# Check that we are actually creating the plugin at a new revision.
if [ -f "$LLVM_LIB_DIR/$LIBFILE" ]; then
echo "The plugin revision $LIBNAME is already in the existing package."
exit 1
fi
cp $PDIR/lib/$LIBFILE "$LLVM_LIB_DIR/"
if [ "$(uname -s)" = "Darwin" ]; then
tar zcf ${PDIR}_repack.tgz -C "$LLVM_TAR_DIR" bin include lib buildlog.txt
else
tar zcf ${PDIR}_repack.tgz -C "$LLVM_TAR_DIR" bin lib buildlog.txt
fi
echo The clang package has been repackaged with $LIBNAME
echo To upload, run:
echo gsutil cp -a public-read ${PDIR}_repack.tgz \
gs://chromium-browser-clang/$PLATFORM/$PDIR.tgz
...@@ -8,12 +8,7 @@ ...@@ -8,12 +8,7 @@
# Do NOT CHANGE this if you don't know what you're doing -- see # Do NOT CHANGE this if you don't know what you're doing -- see
# https://code.google.com/p/chromium/wiki/UpdatingClang # https://code.google.com/p/chromium/wiki/UpdatingClang
# Reverting problematic clang rolls is safe, though. # Reverting problematic clang rolls is safe, though.
CLANG_REVISION=228129 CLANG_REVISION=223108
# This is incremented when pushing a new build of Clang at the same revision.
CLANG_SUB_REVISION=1
PACKAGE_VERSION="${CLANG_REVISION}-${CLANG_SUB_REVISION}"
THIS_DIR="$(dirname "${0}")" THIS_DIR="$(dirname "${0}")"
LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" LLVM_DIR="${THIS_DIR}/../../../third_party/llvm"
...@@ -37,6 +32,12 @@ ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}" ...@@ -37,6 +32,12 @@ ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}"
ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}" ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}"
# Use both the clang revision and the plugin revisions to test for updates.
BLINKGCPLUGIN_REVISION=\
$(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \
| cut -d ' ' -f 2 | tr -cd '[0-9]')
CLANG_AND_PLUGINS_REVISION="${CLANG_REVISION}-${BLINKGCPLUGIN_REVISION}"
# ${A:-a} returns $A if it's set, a else. # ${A:-a} returns $A if it's set, a else.
LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project}
...@@ -165,8 +166,8 @@ if [[ -f "${STAMP_FILE}" ]]; then ...@@ -165,8 +166,8 @@ if [[ -f "${STAMP_FILE}" ]]; then
PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}") PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}")
if [[ -z "$force_local_build" ]] && \ if [[ -z "$force_local_build" ]] && \
[[ "${PREVIOUSLY_BUILT_REVISON}" = \ [[ "${PREVIOUSLY_BUILT_REVISON}" = \
"${PACKAGE_VERSION}" ]]; then "${CLANG_AND_PLUGINS_REVISION}" ]]; then
echo "Clang already at ${PACKAGE_VERSION}" echo "Clang already at ${CLANG_AND_PLUGINS_REVISION}"
exit 0 exit 0
fi fi
fi fi
...@@ -178,7 +179,7 @@ if [[ -z "$force_local_build" ]]; then ...@@ -178,7 +179,7 @@ if [[ -z "$force_local_build" ]]; then
# Check if there's a prebuilt binary and if so just fetch that. That's faster, # Check if there's a prebuilt binary and if so just fetch that. That's faster,
# and goma relies on having matching binary hashes on client and server too. # and goma relies on having matching binary hashes on client and server too.
CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang
CDS_FILE="clang-${PACKAGE_VERSION}.tgz" CDS_FILE="clang-${CLANG_REVISION}.tgz"
CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX)
CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}"
if [ "${OS}" = "Linux" ]; then if [ "${OS}" = "Linux" ]; then
...@@ -200,12 +201,12 @@ if [[ -z "$force_local_build" ]]; then ...@@ -200,12 +201,12 @@ if [[ -z "$force_local_build" ]]; then
rm -rf "${LLVM_BUILD_DIR}" rm -rf "${LLVM_BUILD_DIR}"
mkdir -p "${LLVM_BUILD_DIR}" mkdir -p "${LLVM_BUILD_DIR}"
tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}"
echo clang "${PACKAGE_VERSION}" unpacked echo clang "${CLANG_REVISION}" unpacked
echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}"
rm -rf "${CDS_OUT_DIR}" rm -rf "${CDS_OUT_DIR}"
exit 0 exit 0
else else
echo Did not find prebuilt clang "${PACKAGE_VERSION}", building echo Did not find prebuilt clang at r"${CLANG_REVISION}", building
fi fi
fi fi
...@@ -329,6 +330,349 @@ EOF ...@@ -329,6 +330,349 @@ EOF
patch -p0 patch -p0
popd popd
# Apply r223211: "Revert r222997."
pushd "${LLVM_DIR}"
cat << 'EOF' |
--- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -921,8 +921,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
Value *OriginPtr =
getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);
setOrigin(A, EntryIRB.CreateLoad(OriginPtr));
- } else {
- setOrigin(A, getCleanOrigin());
}
}
ArgOffset += RoundUpToAlignment(Size, kShadowTLSAlignment);
@@ -942,13 +940,15 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
/// \brief Get the origin for a value.
Value *getOrigin(Value *V) {
if (!MS.TrackOrigins) return nullptr;
- if (!PropagateShadow) return getCleanOrigin();
- if (isa<Constant>(V)) return getCleanOrigin();
- assert((isa<Instruction>(V) || isa<Argument>(V)) &&
- "Unexpected value type in getOrigin()");
- Value *Origin = OriginMap[V];
- assert(Origin && "Missing origin");
- return Origin;
+ if (isa<Instruction>(V) || isa<Argument>(V)) {
+ Value *Origin = OriginMap[V];
+ if (!Origin) {
+ DEBUG(dbgs() << "NO ORIGIN: " << *V << "\n");
+ Origin = getCleanOrigin();
+ }
+ return Origin;
+ }
+ return getCleanOrigin();
}
/// \brief Get the origin for i-th argument of the instruction I.
@@ -1088,7 +1088,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
IRB.CreateStore(getCleanShadow(&I), ShadowPtr);
setShadow(&I, getCleanShadow(&I));
- setOrigin(&I, getCleanOrigin());
}
void visitAtomicRMWInst(AtomicRMWInst &I) {
EOF
patch -p1
popd
# Apply r223219: "Preserve LD_LIBRARY_PATH when using the 'env' command"
pushd "${CLANG_DIR}"
cat << 'EOF' |
--- a/test/Driver/env.c
+++ b/test/Driver/env.c
@@ -5,12 +5,14 @@
// REQUIRES: shell
//
// The PATH variable is heavily used when trying to find a linker.
-// RUN: env -i LC_ALL=C %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: env -i LC_ALL=C LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
//
-// RUN: env -i LC_ALL=C PATH="" %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: env -i LC_ALL=C PATH="" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
EOF
patch -p1
popd
# Revert r220714: "Frontend: Define __EXCEPTIONS if -fexceptions is passed"
pushd "${CLANG_DIR}"
cat << 'EOF' |
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -566,7 +566,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
Builder.defineMacro("__BLOCKS__");
}
- if (!LangOpts.MSVCCompat && LangOpts.Exceptions)
+ if (!LangOpts.MSVCCompat && LangOpts.CXXExceptions)
Builder.defineMacro("__EXCEPTIONS");
if (!LangOpts.MSVCCompat && LangOpts.RTTI)
Builder.defineMacro("__GXX_RTTI");
diff --git a/test/Frontend/exceptions.c b/test/Frontend/exceptions.c
index 981b5b9..4bbaaa3 100644
--- a/test/Frontend/exceptions.c
+++ b/test/Frontend/exceptions.c
@@ -1,9 +1,6 @@
-// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -DMS_MODE -verify %s
+// RUN: %clang_cc1 -fms-compatibility -fexceptions -fcxx-exceptions -verify %s
// expected-no-diagnostics
-// RUN: %clang_cc1 -fms-compatibility -fexceptions -verify %s
-// expected-no-diagnostics
-
-#if defined(MS_MODE) && defined(__EXCEPTIONS)
+#if defined(__EXCEPTIONS)
#error __EXCEPTIONS should not be defined.
#endif
diff --git a/test/Preprocessor/predefined-exceptions.m b/test/Preprocessor/predefined-exceptions.m
index 0791075..c13f429 100644
--- a/test/Preprocessor/predefined-exceptions.m
+++ b/test/Preprocessor/predefined-exceptions.m
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fexceptions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-NOCXX %s
// CHECK-OBJC-NOCXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
-// CHECK-OBJC-NOCXX: #define __EXCEPTIONS 1
+// CHECK-OBJC-NOCXX-NOT: #define __EXCEPTIONS 1
// RUN: %clang_cc1 -x objective-c++ -fobjc-exceptions -fexceptions -fcxx-exceptions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-CXX %s
// CHECK-OBJC-CXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
EOF
patch -p1
popd
# Apply r223177: "Ensure typos in the default values of template parameters get diagnosed."
pushd "${CLANG_DIR}"
cat << 'EOF' |
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -676,7 +676,7 @@ Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) {
GreaterThanIsOperatorScope G(GreaterThanIsOperator, false);
EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
- DefaultArg = ParseAssignmentExpression();
+ DefaultArg = Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression());
if (DefaultArg.isInvalid())
SkipUntil(tok::comma, tok::greater, StopAtSemi | StopBeforeMatch);
}
diff --git a/test/SemaCXX/default2.cpp b/test/SemaCXX/default2.cpp
index 1626044..c4d40b4 100644
--- a/test/SemaCXX/default2.cpp
+++ b/test/SemaCXX/default2.cpp
@@ -122,3 +122,9 @@ class XX {
void A(int length = -1 ) { }
void B() { A(); }
};
+
+template <int I = (1 * I)> struct S {}; // expected-error-re {{use of undeclared identifier 'I'{{$}}}}
+S<1> s;
+
+template <int I1 = I2, int I2 = 1> struct T {}; // expected-error-re {{use of undeclared identifier 'I2'{{$}}}}
+T<0, 1> t;
diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp
index bff1d76..7bf9258 100644
--- a/test/SemaCXX/typo-correction-delayed.cpp
+++ b/test/SemaCXX/typo-correction-delayed.cpp
@@ -102,3 +102,7 @@ void f(int *i) {
__atomic_load(i, i, something_something); // expected-error-re {{use of undeclared identifier 'something_something'{{$}}}}
}
}
+
+const int DefaultArg = 9; // expected-note {{'DefaultArg' declared here}}
+template <int I = defaultArg> struct S {}; // expected-error {{use of undeclared identifier 'defaultArg'; did you mean 'DefaultArg'?}}
+S<1> s;
EOF
patch -p1
popd
# Apply r223209: "Handle delayed corrections in a couple more error paths in ParsePostfixExpressionSuffix."
pushd "${CLANG_DIR}"
cat << 'EOF' |
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -1390,6 +1390,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
SourceLocation OpenLoc = ConsumeToken();
if (ParseSimpleExpressionList(ExecConfigExprs, ExecConfigCommaLocs)) {
+ (void)Actions.CorrectDelayedTyposInExpr(LHS);
LHS = ExprError();
}
@@ -1440,6 +1441,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
if (Tok.isNot(tok::r_paren)) {
if (ParseExpressionList(ArgExprs, CommaLocs, &Sema::CodeCompleteCall,
LHS.get())) {
+ (void)Actions.CorrectDelayedTyposInExpr(LHS);
LHS = ExprError();
}
}
diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp
index 7bf9258..f7ef015 100644
--- a/test/SemaCXX/typo-correction-delayed.cpp
+++ b/test/SemaCXX/typo-correction-delayed.cpp
@@ -106,3 +106,9 @@ void f(int *i) {
const int DefaultArg = 9; // expected-note {{'DefaultArg' declared here}}
template <int I = defaultArg> struct S {}; // expected-error {{use of undeclared identifier 'defaultArg'; did you mean 'DefaultArg'?}}
S<1> s;
+
+namespace foo {}
+void test_paren_suffix() {
+ foo::bar({5, 6}); // expected-error-re {{no member named 'bar' in namespace 'foo'{{$}}}} \
+ // expected-error {{expected expression}}
+}
EOF
patch -p1
popd
# Apply r223705: "Handle possible TypoExprs in member initializers."
pushd "${CLANG_DIR}"
cat << 'EOF' |
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2813,6 +2813,11 @@ Sema::BuildMemInitializer(Decl *ConstructorD,
SourceLocation IdLoc,
Expr *Init,
SourceLocation EllipsisLoc) {
+ ExprResult Res = CorrectDelayedTyposInExpr(Init);
+ if (!Res.isUsable())
+ return true;
+ Init = Res.get();
+
if (!ConstructorD)
return true;
diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp
index f7ef015..d303b58 100644
--- a/test/SemaCXX/typo-correction-delayed.cpp
+++ b/test/SemaCXX/typo-correction-delayed.cpp
@@ -112,3 +112,10 @@ void test_paren_suffix() {
foo::bar({5, 6}); // expected-error-re {{no member named 'bar' in namespace 'foo'{{$}}}} \
// expected-error {{expected expression}}
}
+
+const int kNum = 10; // expected-note {{'kNum' declared here}}
+class SomeClass {
+ int Kind;
+public:
+ explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared identifier 'kSum'; did you mean 'kNum'?}}
+};
EOF
patch -p1
popd
# Apply r224172: "Typo correction: Ignore temporary binding exprs after overload resolution"
pushd "${CLANG_DIR}"
cat << 'EOF' |
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -6105,8 +6105,13 @@ public:
auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
RParenLoc, ExecConfig);
if (auto *OE = dyn_cast<OverloadExpr>(Callee)) {
- if (!Result.isInvalid() && Result.get())
- OverloadResolution[OE] = cast<CallExpr>(Result.get())->getCallee();
+ if (!Result.isInvalid() && Result.get()) {
+ Expr *ResultCall = Result.get();
+ if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
+ ResultCall = BE->getSubExpr();
+ if (auto *CE = dyn_cast<CallExpr>(ResultCall))
+ OverloadResolution[OE] = CE->getCallee();
+ }
}
return Result;
}
diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp
index d303b58..d42888f 100644
--- a/test/SemaCXX/typo-correction-delayed.cpp
+++ b/test/SemaCXX/typo-correction-delayed.cpp
@@ -119,3 +119,23 @@ class SomeClass {
public:
explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared identifier 'kSum'; did you mean 'kNum'?}}
};
+
+extern "C" int printf(const char *, ...);
+
+// There used to be an issue with typo resolution inside overloads.
+struct AssertionResult {
+ ~AssertionResult();
+ operator bool();
+ int val;
+};
+AssertionResult Compare(const char *a, const char *b);
+AssertionResult Compare(int a, int b);
+int main() {
+ // expected-note@+1 {{'result' declared here}}
+ const char *result;
+ // expected-error@+1 {{use of undeclared identifier 'resulta'; did you mean 'result'?}}
+ if (AssertionResult ar = (Compare("value1", resulta)))
+ ;
+ else
+ printf("ar: %d\n", ar.val);
+}
EOF
patch -p1
popd
# Apply r224173: "Implement feedback on r224172 in PR21899"
pushd "${CLANG_DIR}"
cat << 'EOF' |
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -6105,7 +6105,7 @@ public:
auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
RParenLoc, ExecConfig);
if (auto *OE = dyn_cast<OverloadExpr>(Callee)) {
- if (!Result.isInvalid() && Result.get()) {
+ if (Result.isUsable()) {
Expr *ResultCall = Result.get();
if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
ResultCall = BE->getSubExpr();
diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp
index d42888f..7879d29 100644
--- a/test/SemaCXX/typo-correction-delayed.cpp
+++ b/test/SemaCXX/typo-correction-delayed.cpp
@@ -120,22 +120,13 @@ public:
explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared identifier 'kSum'; did you mean 'kNum'?}}
};
-extern "C" int printf(const char *, ...);
-
// There used to be an issue with typo resolution inside overloads.
-struct AssertionResult {
- ~AssertionResult();
- operator bool();
- int val;
-};
-AssertionResult Compare(const char *a, const char *b);
-AssertionResult Compare(int a, int b);
-int main() {
+struct AssertionResult { ~AssertionResult(); };
+AssertionResult Overload(const char *a);
+AssertionResult Overload(int a);
+void UseOverload() {
// expected-note@+1 {{'result' declared here}}
const char *result;
// expected-error@+1 {{use of undeclared identifier 'resulta'; did you mean 'result'?}}
- if (AssertionResult ar = (Compare("value1", resulta)))
- ;
- else
- printf("ar: %d\n", ar.val);
+ Overload(resulta);
}
EOF
patch -p1
popd
# This Go bindings test doesn't work after the bootstrap build on Linux. (PR21552) # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21552)
pushd "${LLVM_DIR}" pushd "${LLVM_DIR}"
...@@ -597,4 +941,4 @@ if [[ -n "$run_tests" ]]; then ...@@ -597,4 +941,4 @@ if [[ -n "$run_tests" ]]; then
fi fi
# After everything is done, log success for this revision. # After everything is done, log success for this revision.
echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment