Commit 92a76881 authored by Dirk Pranke's avatar Dirk Pranke

Revert "Roll Clang 214024:216630 (+216684) and switch to CMake (try 2)"

This reverts commit 3853ffa8.

The change broke the Mac10.6 Tests bot on the chromium.webkit waterfall.

TBR=hwennborg@chromium.org, thakis@chromium.org
BUG=400849

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

Cr-Commit-Position: refs/heads/master@{#295132}
parent 715038ab
...@@ -109,17 +109,6 @@ config("compiler") { ...@@ -109,17 +109,6 @@ config("compiler") {
# and the fix is in chromium. # and the fix is in chromium.
"-fno-slp-vectorize", "-fno-slp-vectorize",
] ]
if (is_debug) {
# Allow comparing the address of references and 'this' against 0
# in debug builds. Technically, these can never be null in
# well-defined C/C++ and Clang can optimize such checks away in
# release builds, but they may be used in asserts in debug builds.
cflags_cc += [
"-Wno-undefined-bool-conversion",
"-Wno-tautological-undefined-compare",
]
}
} }
if (is_clang && !is_win) { if (is_clang && !is_win) {
......
...@@ -865,7 +865,7 @@ class BlinkGCPluginConsumer : public ASTConsumer { ...@@ -865,7 +865,7 @@ class BlinkGCPluginConsumer : public ASTConsumer {
visitor.TraverseDecl(context.getTranslationUnitDecl()); visitor.TraverseDecl(context.getTranslationUnitDecl());
if (options_.dump_graph) { if (options_.dump_graph) {
std::error_code err; string err;
// TODO: Make createDefaultOutputFile or a shorter createOutputFile work. // TODO: Make createDefaultOutputFile or a shorter createOutputFile work.
json_ = JsonWriter::from(instance_.createOutputFile( json_ = JsonWriter::from(instance_.createOutputFile(
"", // OutputPath "", // OutputPath
...@@ -878,7 +878,7 @@ class BlinkGCPluginConsumer : public ASTConsumer { ...@@ -878,7 +878,7 @@ class BlinkGCPluginConsumer : public ASTConsumer {
false, // CreateMissingDirectories false, // CreateMissingDirectories
0, // ResultPathName 0, // ResultPathName
0)); // TempPathName 0)); // TempPathName
if (!err && json_) { if (err.empty() && json_) {
json_->OpenList(); json_->OpenList();
} else { } else {
json_ = 0; json_ = 0;
...@@ -1844,10 +1844,9 @@ class BlinkGCPluginAction : public PluginASTAction { ...@@ -1844,10 +1844,9 @@ class BlinkGCPluginAction : public PluginASTAction {
protected: protected:
// Overridden from PluginASTAction: // Overridden from PluginASTAction:
virtual std::unique_ptr<ASTConsumer> CreateASTConsumer( virtual ASTConsumer* CreateASTConsumer(CompilerInstance& instance,
CompilerInstance& instance, llvm::StringRef ref) {
llvm::StringRef ref) { return new BlinkGCPluginConsumer(instance, options_);
return llvm::make_unique<BlinkGCPluginConsumer>(instance, options_);
} }
virtual bool ParseArgs(const CompilerInstance& instance, virtual bool ParseArgs(const CompilerInstance& instance,
......
cmake_minimum_required(VERSION 2.8.8)
project(BlinkGCPlugin)
# This pugin is built using LLVM's build system, not Chromium's.
# It expects LLVM_SRC_DIR and LLVM_BUILD_DIR to be set.
# For example:
#
# cmake -GNinja -DLLVM_BUILD_DIR=$CHROMIUM_SRC_DIR/third_party/llvm-build \
# -DLLVM_SRC_DIR=$CHROMIUM_SRC_DIR/third_party/llvm \
# $CHROMIUM_SRC_DIR/tools/clang/blink_gc_plugin/
# ninja
list(APPEND CMAKE_MODULE_PATH "${LLVM_BUILD_DIR}/share/llvm/cmake")
include(LLVMConfig)
include(AddLLVM)
include(HandleLLVMOptions)
set(LLVM_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
include_directories("${LLVM_SRC_DIR}/include"
"${LLVM_SRC_DIR}/tools/clang/include"
"${LLVM_BUILD_DIR}/include"
"${LLVM_BUILD_DIR}/tools/clang/include")
# This line is read by update.sh and other scripts in tools/clang/scripts
# Note: The spaces are significant.
set(LIBRARYNAME BlinkGCPlugin_10)
add_llvm_loadable_module("lib${LIBRARYNAME}"
BlinkGCPlugin.cpp
Edge.cpp
RecordInfo.cpp
)
# This file requires the clang build system, at least for now. So to use this
# Makefile, you should execute the following commands to copy this directory
# into a clang checkout:
#
# cp -R <this directory> third_party/llvm/tools/clang/tools/chrome-plugin
# cd third_party/llvm/tools/clang/tools/chrome-plugin
# make
CLANG_LEVEL := ../..
# This line is read by update.sh and other scripts in tools/clang/scripts
LIBRARYNAME = BlinkGCPlugin_9
LINK_LIBS_IN_SHARED = 0
SHARED_LIBRARY = 1
include $(CLANG_LEVEL)/Makefile
ifeq ($(OS),Darwin)
LDFLAGS+=-Wl,-undefined,dynamic_lookup
endif
...@@ -15,8 +15,7 @@ failed_any_test= ...@@ -15,8 +15,7 @@ failed_any_test=
# Prints usage information. # Prints usage information.
usage() { usage() {
echo "Usage: $(basename "${0}")" \ echo "Usage: $(basename "${0}")" \
"<path to clang>" \ "<Path to the llvm build dir, usually Release+Asserts>"
"<path to plugin>"
echo "" echo ""
echo " Runs all the libBlinkGCPlugin unit tests" echo " Runs all the libBlinkGCPlugin unit tests"
echo "" echo ""
...@@ -28,8 +27,8 @@ do_testcase() { ...@@ -28,8 +27,8 @@ do_testcase() {
if [ -e "${3}" ]; then if [ -e "${3}" ]; then
flags="$(cat "${3}")" flags="$(cat "${3}")"
fi fi
local output="$("${CLANG_PATH}" -c -Wno-c++11-extensions \ local output="$("${CLANG_DIR}"/bin/clang -c -Wno-c++11-extensions \
-Xclang -load -Xclang "${PLUGIN_PATH}" \ -Xclang -load -Xclang "${CLANG_DIR}"/lib/lib${LIBNAME}.${LIB} \
-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"
if [ -f "$json" ]; then if [ -f "$json" ]; then
...@@ -53,26 +52,24 @@ do_testcase() { ...@@ -53,26 +52,24 @@ do_testcase() {
if [[ -z "${1}" ]]; then if [[ -z "${1}" ]]; then
usage usage
exit ${E_BADARGS} exit ${E_BADARGS}
elif [[ -z "${2}" ]]; then elif [[ ! -d "${1}" ]]; then
usage echo "${1} is not a directory."
exit ${E_BADARGS}
elif [[ ! -x "${1}" ]]; then
echo "${1} is not an executable"
usage
exit ${E_BADARGS}
elif [[ ! -f "${2}" ]]; then
echo "${2} could not be found"
usage usage
exit ${E_BADARGS} exit ${E_BADARGS}
else else
export CLANG_PATH="${1}" export CLANG_DIR="${PWD}/${1}"
export PLUGIN_PATH="${2}" echo "Using clang directory ${CLANG_DIR}..."
echo "Using clang ${CLANG_PATH}..."
echo "Using plugin ${PLUGIN_PATH}..."
# The golden files assume that the cwd is this directory. To make the script # The golden files assume that the cwd is this directory. To make the script
# work no matter what the cwd is, explicitly cd to there. # work no matter what the cwd is, explicitly cd to there.
cd "$(dirname "${0}")" cd "$(dirname "${0}")"
export LIBNAME=$(grep LIBRARYNAME ../Makefile | cut -d ' ' -f 3)
if [ "$(uname -s)" = "Linux" ]; then
export LIB=so
elif [ "$(uname -s)" = "Darwin" ]; then
export LIB=dylib
fi
fi fi
for input in *.cpp; do for input in *.cpp; do
......
cmake_minimum_required(VERSION 2.8.8)
project(FindBadConstructs)
# This pugin is built using LLVM's build system, not Chromium's.
# It expects LLVM_SRC_DIR and LLVM_BUILD_DIR to be set.
# For example:
#
# cmake -GNinja -DLLVM_BUILD_DIR=$CHROMIUM_SRC_DIR/third_party/llvm-build \
# -DLLVM_SRC_DIR=$CHROMIUM_SRC_DIR/third_party/llvm \
# $CHROMIUM_SRC_DIR/tools/clang/blink_gc_plugin/
# ninja
list(APPEND CMAKE_MODULE_PATH "${LLVM_BUILD_DIR}/share/llvm/cmake")
include(LLVMConfig)
include(AddLLVM)
include(HandleLLVMOptions)
set(LLVM_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
include_directories("${LLVM_SRC_DIR}/include"
"${LLVM_SRC_DIR}/tools/clang/include"
"${LLVM_BUILD_DIR}/include"
"${LLVM_BUILD_DIR}/tools/clang/include")
add_llvm_loadable_module(libFindBadConstructs
ChromeClassTester.cpp
FindBadConstructsAction.cpp
FindBadConstructsConsumer.cpp
)
...@@ -15,10 +15,10 @@ namespace chrome_checker { ...@@ -15,10 +15,10 @@ namespace chrome_checker {
FindBadConstructsAction::FindBadConstructsAction() { FindBadConstructsAction::FindBadConstructsAction() {
} }
std::unique_ptr<ASTConsumer> FindBadConstructsAction::CreateASTConsumer( ASTConsumer* FindBadConstructsAction::CreateASTConsumer(
CompilerInstance& instance, CompilerInstance& instance,
llvm::StringRef ref) { llvm::StringRef ref) {
return llvm::make_unique<FindBadConstructsConsumer>(instance, options_); return new FindBadConstructsConsumer(instance, options_);
} }
bool FindBadConstructsAction::ParseArgs(const CompilerInstance& instance, bool FindBadConstructsAction::ParseArgs(const CompilerInstance& instance,
......
...@@ -17,7 +17,7 @@ class FindBadConstructsAction : public clang::PluginASTAction { ...@@ -17,7 +17,7 @@ class FindBadConstructsAction : public clang::PluginASTAction {
protected: protected:
// Overridden from PluginASTAction: // Overridden from PluginASTAction:
virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer( virtual clang::ASTConsumer* CreateASTConsumer(
clang::CompilerInstance& instance, clang::CompilerInstance& instance,
llvm::StringRef ref); llvm::StringRef ref);
virtual bool ParseArgs(const clang::CompilerInstance& instance, virtual bool ParseArgs(const clang::CompilerInstance& instance,
......
# This file requires the clang build system, at least for now. So to use this
# Makefile, you should execute the following commands to copy this directory
# into a clang checkout:
#
# cp -R <this directory> third_party/llvm/tools/clang/tools/chrome-plugin
# cd third_party/llvm/tools/clang/tools/chrome-plugin
# make
CLANG_LEVEL := ../..
LIBRARYNAME = FindBadConstructs
LINK_LIBS_IN_SHARED = 0
SHARED_LIBRARY = 1
include $(CLANG_LEVEL)/Makefile
ifeq ($(OS),Darwin)
LDFLAGS+=-Wl,-undefined,dynamic_lookup
endif
...@@ -15,8 +15,7 @@ failed_any_test= ...@@ -15,8 +15,7 @@ failed_any_test=
# Prints usage information. # Prints usage information.
usage() { usage() {
echo "Usage: $(basename "${0}")" \ echo "Usage: $(basename "${0}")" \
"<path to clang>" \ "<Path to the llvm build dir, usually Release+Asserts>"
"<path to plugin>"
echo "" echo ""
echo " Runs all the libFindBadConstructs unit tests" echo " Runs all the libFindBadConstructs unit tests"
echo "" echo ""
...@@ -33,8 +32,8 @@ do_testcase() { ...@@ -33,8 +32,8 @@ do_testcase() {
flags="${flags} -isysroot $(xcrun --show-sdk-path) -stdlib=libstdc++" flags="${flags} -isysroot $(xcrun --show-sdk-path) -stdlib=libstdc++"
fi fi
local output="$("${CLANG_PATH}" -c -Wno-c++11-extensions \ local output="$("${CLANG_DIR}"/bin/clang -c -Wno-c++11-extensions \
-Xclang -load -Xclang "${PLUGIN_PATH}" \ -Xclang -load -Xclang "${CLANG_DIR}"/lib/libFindBadConstructs.${LIB} \
-Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)"
local diffout="$(echo "${output}" | diff - "${2}")" local diffout="$(echo "${output}" | diff - "${2}")"
if [ "${diffout}" = "" ]; then if [ "${diffout}" = "" ]; then
...@@ -54,26 +53,23 @@ do_testcase() { ...@@ -54,26 +53,23 @@ do_testcase() {
if [[ -z "${1}" ]]; then if [[ -z "${1}" ]]; then
usage usage
exit ${E_BADARGS} exit ${E_BADARGS}
elif [[ -z "${2}" ]]; then elif [[ ! -d "${1}" ]]; then
usage echo "${1} is not a directory."
exit ${E_BADARGS}
elif [[ ! -x "${1}" ]]; then
echo "${1} is not an executable"
usage
exit ${E_BADARGS}
elif [[ ! -f "${2}" ]]; then
echo "${2} could not be found"
usage usage
exit ${E_BADARGS} exit ${E_BADARGS}
else else
export CLANG_PATH="${1}" export CLANG_DIR="${PWD}/${1}"
export PLUGIN_PATH="${2}" echo "Using clang directory ${CLANG_DIR}..."
echo "Using clang ${CLANG_PATH}..."
echo "Using plugin ${PLUGIN_PATH}..."
# The golden files assume that the cwd is this directory. To make the script # The golden files assume that the cwd is this directory. To make the script
# work no matter what the cwd is, explicitly cd to there. # work no matter what the cwd is, explicitly cd to there.
cd "$(dirname "${0}")" cd "$(dirname "${0}")"
if [ "$(uname -s)" = "Linux" ]; then
export LIB=so
elif [ "$(uname -s)" = "Darwin" ]; then
export LIB=dylib
fi
fi fi
for input in *.cpp; do for input in *.cpp; do
......
...@@ -13,9 +13,10 @@ if uname -s | grep -q Darwin; then ...@@ -13,9 +13,10 @@ if uname -s | grep -q Darwin; then
else else
LIBSUFFIX=so LIBSUFFIX=so
fi fi
LIBNAME=\ LIBNAME=\
$(grep 'set(LIBRARYNAME' "$THIS_ABS_DIR"/../blink_gc_plugin/CMakeLists.txt \ $(grep LIBRARYNAME "$THIS_ABS_DIR"/../blink_gc_plugin/Makefile \
| cut -d ' ' -f 2 | tr -d ')') | cut -d ' ' -f 3)
FLAGS="" FLAGS=""
PREFIX="-Xclang -plugin-arg-blink-gc-plugin -Xclang" PREFIX="-Xclang -plugin-arg-blink-gc-plugin -Xclang"
......
...@@ -59,16 +59,9 @@ svn diff "${LLVM_DIR}" 2>&1 | tee -a buildlog.txt ...@@ -59,16 +59,9 @@ svn diff "${LLVM_DIR}" 2>&1 | tee -a buildlog.txt
echo "Diff in llvm/tools/clang:" | tee -a buildlog.txt echo "Diff in llvm/tools/clang:" | tee -a buildlog.txt
svn stat "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt svn stat "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt
svn diff "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt svn diff "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt
echo "Diff in llvm/compiler-rt:" | tee -a buildlog.txt echo "Diff in llvm/projects/compiler-rt:" | tee -a buildlog.txt
svn stat "${LLVM_DIR}/compiler-rt" 2>&1 | tee -a buildlog.txt svn stat "${LLVM_DIR}/projects/compiler-rt" 2>&1 | tee -a buildlog.txt
svn diff "${LLVM_DIR}/compiler-rt" 2>&1 | tee -a buildlog.txt svn diff "${LLVM_DIR}/projects/compiler-rt" 2>&1 | tee -a buildlog.txt
echo "Diff in llvm/projects/libcxx:" | tee -a buildlog.txt
svn stat "${LLVM_DIR}/projects/libcxx" 2>&1 | tee -a buildlog.txt
svn diff "${LLVM_DIR}/projects/libcxx" 2>&1 | tee -a buildlog.txt
echo "Diff in llvm/projects/libcxxabi:" | tee -a buildlog.txt
svn stat "${LLVM_DIR}/projects/libcxxabi" 2>&1 | tee -a buildlog.txt
svn diff "${LLVM_DIR}/projects/libcxxabi" 2>&1 | tee -a buildlog.txt
echo "Starting build" | tee -a buildlog.txt echo "Starting build" | tee -a buildlog.txt
...@@ -86,7 +79,7 @@ fi ...@@ -86,7 +79,7 @@ fi
${extra_flags} 2>&1 | tee -a buildlog.txt ${extra_flags} 2>&1 | tee -a buildlog.txt
R=$("${LLVM_BIN_DIR}/clang" --version | \ R=$("${LLVM_BIN_DIR}/clang" --version | \
sed -ne 's/clang version .*(\([0-9]*\))/\1/p') sed -ne 's/clang version .*(trunk \([0-9]*\))/\1/p')
PDIR=clang-$R PDIR=clang-$R
rm -rf $PDIR rm -rf $PDIR
...@@ -123,8 +116,8 @@ fi ...@@ -123,8 +116,8 @@ fi
cp "${LLVM_LIB_DIR}/libFindBadConstructs.${SO_EXT}" $PDIR/lib cp "${LLVM_LIB_DIR}/libFindBadConstructs.${SO_EXT}" $PDIR/lib
BLINKGCPLUGIN_LIBNAME=\ BLINKGCPLUGIN_LIBNAME=\
$(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \ $(grep LIBRARYNAME "$THIS_DIR"/../blink_gc_plugin/Makefile \
| cut -d ' ' -f 2 | tr -d ')') | cut -d ' ' -f 3)
cp "${LLVM_LIB_DIR}/lib${BLINKGCPLUGIN_LIBNAME}.${SO_EXT}" $PDIR/lib cp "${LLVM_LIB_DIR}/lib${BLINKGCPLUGIN_LIBNAME}.${SO_EXT}" $PDIR/lib
if [[ -n "${gcc_toolchain}" ]]; then if [[ -n "${gcc_toolchain}" ]]; then
...@@ -133,7 +126,7 @@ if [[ -n "${gcc_toolchain}" ]]; then ...@@ -133,7 +126,7 @@ if [[ -n "${gcc_toolchain}" ]]; then
fi fi
# Copy built-in headers (lib/clang/3.x.y/include). # Copy built-in headers (lib/clang/3.x.y/include).
# compiler-rt builds all kinds of libraries, but we want only some. # libcompiler-rt puts all kinds of libraries there too, but we want only some.
if [ "$(uname -s)" = "Darwin" ]; then if [ "$(uname -s)" = "Darwin" ]; then
# Keep only the OSX (ASan and profile) and iossim (ASan) runtime libraries: # Keep only the OSX (ASan and profile) and iossim (ASan) runtime libraries:
# Release+Asserts/lib/clang/*/lib/darwin/libclang_rt.{asan,profile}_* # Release+Asserts/lib/clang/*/lib/darwin/libclang_rt.{asan,profile}_*
...@@ -151,7 +144,6 @@ if [ "$(uname -s)" = "Darwin" ]; then ...@@ -151,7 +144,6 @@ if [ "$(uname -s)" = "Darwin" ]; then
ASAN_DYLIB=$(find "${LLVM_LIB_DIR}/clang" \ ASAN_DYLIB=$(find "${LLVM_LIB_DIR}/clang" \
-type f -path "*${ASAN_DYLIB_NAME}") -type f -path "*${ASAN_DYLIB_NAME}")
install_name_tool -id @executable_path/${ASAN_DYLIB_NAME} "${ASAN_DYLIB}" install_name_tool -id @executable_path/${ASAN_DYLIB_NAME} "${ASAN_DYLIB}"
strip -x "${ASAN_DYLIB}"
done done
else else
# Keep only # Keep only
...@@ -159,12 +151,12 @@ else ...@@ -159,12 +151,12 @@ else
# , but not dfsan. # , but not dfsan.
find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' \ find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' \
! -name '*[atm]san*' ! -name '*ubsan*' ! -name '*libclang_rt.san*' \ ! -name '*[atm]san*' ! -name '*ubsan*' ! -name '*libclang_rt.san*' \
! -name '*profile*' | xargs rm -v ! -name '*profile*' | xargs rm
# Strip the debug info from the runtime libraries. # Strip the debug info from the runtime libraries.
find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' ! -name '*.syms' | xargs strip -g find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' | xargs strip -g
fi fi
cp -vR "${LLVM_LIB_DIR}/clang" $PDIR/lib cp -R "${LLVM_LIB_DIR}/clang" $PDIR/lib
if [ "$(uname -s)" = "Darwin" ]; then if [ "$(uname -s)" = "Darwin" ]; then
tar zcf $PDIR.tgz -C $PDIR bin include lib buildlog.txt tar zcf $PDIR.tgz -C $PDIR bin include lib buildlog.txt
......
...@@ -30,7 +30,7 @@ fi ...@@ -30,7 +30,7 @@ fi
"$THIS_DIR"/package.sh $@ "$THIS_DIR"/package.sh $@
R=$("${LLVM_BIN_DIR}/clang" --version | \ R=$("${LLVM_BIN_DIR}/clang" --version | \
sed -ne 's/clang version .*(\([0-9]*\))/\1/p') sed -ne 's/clang version .*(trunk \([0-9]*\))/\1/p')
PDIR=clang-$R PDIR=clang-$R
if [ ! -f "$PDIR.tgz" ]; then if [ ! -f "$PDIR.tgz" ]; then
...@@ -43,9 +43,9 @@ fi ...@@ -43,9 +43,9 @@ fi
rm -rf $LLVM_BUILD_DIR rm -rf $LLVM_BUILD_DIR
"$THIS_DIR"/update.sh "$THIS_DIR"/update.sh
LIBNAME=\ LIBNAME=$(grep LIBRARYNAME "$THIS_DIR"/../blink_gc_plugin/Makefile \
$(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \ | cut -d ' ' -f 3)
| cut -d ' ' -f 2 | tr -d ')')
LIBFILE=lib$LIBNAME.$SO_EXT LIBFILE=lib$LIBNAME.$SO_EXT
# Check that we are actually creating the plugin at a new revision. # Check that we are actually creating the plugin at a new revision.
......
This diff is collapsed.
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