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.
......
...@@ -8,33 +8,29 @@ ...@@ -8,33 +8,29 @@
# 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=216630 CLANG_REVISION=214024
THIS_DIR="$(dirname "${0}")" THIS_DIR="$(dirname "${0}")"
LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" LLVM_DIR="${THIS_DIR}/../../../third_party/llvm"
LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts" LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build"
COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt"
LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap"
LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install"
CLANG_DIR="${LLVM_DIR}/tools/clang" CLANG_DIR="${LLVM_DIR}/tools/clang"
CLANG_TOOLS_EXTRA_DIR="${CLANG_DIR}/tools/extra" CLANG_TOOLS_EXTRA_DIR="${CLANG_DIR}/tools/extra"
COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt" COMPILER_RT_DIR="${LLVM_DIR}/projects/compiler-rt"
LIBCXX_DIR="${LLVM_DIR}/projects/libcxx" LIBCXX_DIR="${LLVM_DIR}/projects/libcxx"
LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi" LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi"
ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk" ANDROID_NDK_DIR="${LLVM_DIR}/../android_tools/ndk"
STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision" STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision"
ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}" ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}"
ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}" ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}"
ABS_LLVM_DIR="${PWD}/${LLVM_DIR}"
ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}"
ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}"
# Use both the clang revision and the plugin revisions to test for updates. # Use both the clang revision and the plugin revisions to test for updates.
BLINKGCPLUGIN_REVISION=\ BLINKGCPLUGIN_REVISION=\
$(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \ $(grep LIBRARYNAME "$THIS_DIR"/../blink_gc_plugin/Makefile \
| cut -d ' ' -f 2 | tr -cd '[0-9]') | cut -d '_' -f 2)
CLANG_AND_PLUGINS_REVISION="${CLANG_REVISION}-${BLINKGCPLUGIN_REVISION}" 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.
...@@ -65,6 +61,11 @@ gcc_toolchain= ...@@ -65,6 +61,11 @@ gcc_toolchain=
if [[ "${OS}" = "Darwin" ]]; then if [[ "${OS}" = "Darwin" ]]; then
with_android= with_android=
fi fi
if [ "${OS}" = "FreeBSD" ]; then
MAKE=gmake
else
MAKE=make
fi
while [[ $# > 0 ]]; do while [[ $# > 0 ]]; do
case $1 in case $1 in
...@@ -197,9 +198,9 @@ if [[ -z "$force_local_build" ]]; then ...@@ -197,9 +198,9 @@ if [[ -z "$force_local_build" ]]; then
exit 1 exit 1
fi fi
if [ -f "${CDS_OUTPUT}" ]; then if [ -f "${CDS_OUTPUT}" ]; then
rm -rf "${LLVM_BUILD_DIR}" rm -rf "${LLVM_BUILD_DIR}/Release+Asserts"
mkdir -p "${LLVM_BUILD_DIR}" mkdir -p "${LLVM_BUILD_DIR}/Release+Asserts"
tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}/Release+Asserts"
echo clang "${CLANG_REVISION}" unpacked echo clang "${CLANG_REVISION}" unpacked
echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}"
rm -rf "${CDS_OUT_DIR}" rm -rf "${CDS_OUT_DIR}"
...@@ -218,16 +219,6 @@ if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then ...@@ -218,16 +219,6 @@ if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then
exit 1 exit 1
fi fi
# Check that cmake and ninja are available.
if ! which cmake > /dev/null; then
echo "CMake needed to build clang; please install"
exit 1
fi
if ! which ninja > /dev/null; then
echo "ninja needed to build clang, please install"
exit 1
fi
echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}" echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}"
if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \ if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \
"${LLVM_DIR}"; then "${LLVM_DIR}"; then
...@@ -239,10 +230,6 @@ fi ...@@ -239,10 +230,6 @@ fi
echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}"
svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}" svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}"
# We have moved from building compiler-rt in the LLVM tree, to a separate
# directory. Nuke any previous checkout to avoid building it.
rm -rf "${LLVM_DIR}/projects/compiler-rt"
echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}" echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}"
svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \ svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \
"${COMPILER_RT_DIR}" "${COMPILER_RT_DIR}"
...@@ -263,7 +250,7 @@ if [ "${OS}" = "Darwin" ]; then ...@@ -263,7 +250,7 @@ if [ "${OS}" = "Darwin" ]; then
"${LIBCXXABI_DIR}" "${LIBCXXABI_DIR}"
fi fi
# Apply patch for tests failing with --disable-pthreads (llvm.org/PR11974) # Apply patch for test failing with --disable-pthreads (llvm.org/PR11974)
pushd "${CLANG_DIR}" pushd "${CLANG_DIR}"
svn revert test/Index/crash-recovery-modules.m svn revert test/Index/crash-recovery-modules.m
cat << 'EOF' | cat << 'EOF' |
...@@ -281,76 +268,27 @@ EOF ...@@ -281,76 +268,27 @@ EOF
patch -p4 patch -p4
popd popd
pushd "${CLANG_DIR}"
svn revert unittests/libclang/LibclangTest.cpp
cat << 'EOF' |
--- unittests/libclang/LibclangTest.cpp (revision 215949)
+++ unittests/libclang/LibclangTest.cpp (working copy)
@@ -431,7 +431,7 @@
EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
}
-TEST_F(LibclangReparseTest, ReparseWithModule) {
+TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) {
const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;";
const char *HeaderBottom = "\n};\n#endif\n";
const char *MFile = "#include \"HeaderFile.h\"\nint main() {"
EOF
patch -p0
popd
# Apply r216684 to fix ASan array cookie instrumentation problem.
# (See https://code.google.com/p/chromium/issues/detail?id=400849#c17)
pushd "${COMPILER_RT_DIR}"
svn revert lib/asan/asan_rtl.cc
cat << 'EOF' |
--- a/lib/asan/asan_rtl.cc
+++ b/lib/asan/asan_rtl.cc
@@ -269,7 +269,7 @@ void InitializeFlags(Flags *f, const char *env) {
f->allow_reexec = true;
f->print_full_thread_history = true;
f->poison_heap = true;
- f->poison_array_cookie = true;
+ f->poison_array_cookie = false;
f->poison_partial = true;
// Turn off alloc/dealloc mismatch checker on Mac and Windows for now.
// https://code.google.com/p/address-sanitizer/issues/detail?id=131
diff --git a/test/asan/TestCases/Linux/new_array_cookie_test.cc b/test/asan/TestCases/Linux/new_array_cookie_test.cc
index 339120b..49545f0 100644
--- a/test/asan/TestCases/Linux/new_array_cookie_test.cc
+++ b/test/asan/TestCases/Linux/new_array_cookie_test.cc
@@ -1,6 +1,6 @@
// REQUIRES: asan-64-bits
-// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s -o %t
+// RUN %run %t
// RUN: ASAN_OPTIONS=poison_array_cookie=1 not %run %t 2>&1 | FileCheck %s
// RUN: ASAN_OPTIONS=poison_array_cookie=0 %run %t
#include <stdio.h>
EOF
patch -p1
popd
# Echo all commands. # Echo all commands.
set -x set -x
# Set default values for CC and CXX if they're not set in the environment. NUM_JOBS=3
CC=${CC:-cc} if [[ "${OS}" = "Linux" ]]; then
CXX=${CXX:-c++} NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)"
elif [ "${OS}" = "Darwin" -o "${OS}" = "FreeBSD" ]; then
NUM_JOBS="$(sysctl -n hw.ncpu)"
fi
if [[ -n "${gcc_toolchain}" ]]; then if [[ -n "${gcc_toolchain}" ]]; then
# Use the specified gcc installation for building. # Use the specified gcc installation for building.
CC="$gcc_toolchain/bin/gcc" export CC="$gcc_toolchain/bin/gcc"
CXX="$gcc_toolchain/bin/g++" export CXX="$gcc_toolchain/bin/g++"
# Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler, # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler,
# etc.) find the .so. # etc.) find the .so.
export LD_LIBRARY_PATH="$(dirname $(${CXX} -print-file-name=libstdc++.so.6))" export LD_LIBRARY_PATH="$(dirname $(${CXX} -print-file-name=libstdc++.so.6))"
fi fi
CFLAGS="" export CFLAGS=""
CXXFLAGS="" export CXXFLAGS=""
LDFLAGS=""
# LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is
# needed, on OS X it requires libc++. clang only automatically links to libc++ # needed, on OS X it requires libc++. clang only automatically links to libc++
# when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run on # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run on
...@@ -361,9 +299,9 @@ LDFLAGS="" ...@@ -361,9 +299,9 @@ LDFLAGS=""
if [ "${OS}" = "Darwin" ]; then if [ "${OS}" = "Darwin" ]; then
# When building on 10.9, /usr/include usually doesn't exist, and while # When building on 10.9, /usr/include usually doesn't exist, and while
# Xcode's clang automatically sets a sysroot, self-built clangs don't. # Xcode's clang automatically sets a sysroot, self-built clangs don't.
CFLAGS="-isysroot $(xcrun --show-sdk-path)" export CFLAGS="-isysroot $(xcrun --show-sdk-path)"
CPPFLAGS="${CFLAGS}" export CPPFLAGS="${CFLAGS}"
CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}" export CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}"
fi fi
# Build bootstrap clang if requested. # Build bootstrap clang if requested.
...@@ -372,25 +310,28 @@ if [[ -n "${bootstrap}" ]]; then ...@@ -372,25 +310,28 @@ if [[ -n "${bootstrap}" ]]; then
echo "Building bootstrap compiler" echo "Building bootstrap compiler"
mkdir -p "${LLVM_BOOTSTRAP_DIR}" mkdir -p "${LLVM_BOOTSTRAP_DIR}"
pushd "${LLVM_BOOTSTRAP_DIR}" pushd "${LLVM_BOOTSTRAP_DIR}"
if [[ ! -f ./config.status ]]; then
# The bootstrap compiler only needs to be able to build the real compiler,
# so it needs no cross-compiler output support. In general, the host
# compiler should be as similar to the final compiler as possible, so do
# keep --disable-threads & co.
../llvm/configure \
--enable-optimized \
--enable-targets=host-only \
--enable-libedit=no \
--disable-threads \
--disable-pthreads \
--without-llvmgcc \
--without-llvmgxx \
--prefix="${ABS_INSTALL_DIR}"
fi
cmake -GNinja \ ${MAKE} -j"${NUM_JOBS}"
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_ENABLE_THREADS=OFF \
-DCMAKE_INSTALL_PREFIX="${ABS_INSTALL_DIR}" \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_C_FLAGS="${CFLAGS}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
../llvm
ninja
if [[ -n "${run_tests}" ]]; then if [[ -n "${run_tests}" ]]; then
ninja check-all ${MAKE} check-all
fi fi
ninja install ${MAKE} install
if [[ -n "${gcc_toolchain}" ]]; then if [[ -n "${gcc_toolchain}" ]]; then
# Copy that gcc's stdlibc++.so.6 to the build dir, so the bootstrap # Copy that gcc's stdlibc++.so.6 to the build dir, so the bootstrap
# compiler can start. # compiler can start.
...@@ -399,14 +340,14 @@ if [[ -n "${bootstrap}" ]]; then ...@@ -399,14 +340,14 @@ if [[ -n "${bootstrap}" ]]; then
fi fi
popd popd
CC="${ABS_INSTALL_DIR}/bin/clang" export CC="${ABS_INSTALL_DIR}/bin/clang"
CXX="${ABS_INSTALL_DIR}/bin/clang++" export CXX="${ABS_INSTALL_DIR}/bin/clang++"
if [[ -n "${gcc_toolchain}" ]]; then if [[ -n "${gcc_toolchain}" ]]; then
# Tell the bootstrap compiler to use a specific gcc prefix to search # Tell the bootstrap compiler to use a specific gcc prefix to search
# for standard library headers and shared object file. # for standard library headers and shared object file.
CFLAGS="--gcc-toolchain=${gcc_toolchain}" export CFLAGS="--gcc-toolchain=${gcc_toolchain}"
CXXFLAGS="--gcc-toolchain=${gcc_toolchain}" export CXXFLAGS="--gcc-toolchain=${gcc_toolchain}"
fi fi
echo "Building final compiler" echo "Building final compiler"
...@@ -444,70 +385,34 @@ if [ "${OS}" = "Darwin" ]; then ...@@ -444,70 +385,34 @@ if [ "${OS}" = "Darwin" ]; then
-Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp
ln -sf libc++.1.dylib libc++.dylib ln -sf libc++.1.dylib libc++.dylib
popd popd
LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" export LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild"
fi fi
if [[ ! -f ./CMakeCache.txt ]]; then if [[ ! -f ./config.status ]]; then
MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \ ../llvm/configure \
-DCMAKE_BUILD_TYPE=Release \ --enable-optimized \
-DLLVM_ENABLE_ASSERTIONS=ON \ --enable-libedit=no \
-DLLVM_ENABLE_THREADS=OFF \ --disable-threads \
-DCMAKE_C_COMPILER="${CC}" \ --disable-pthreads \
-DCMAKE_CXX_COMPILER="${CXX}" \ --without-llvmgcc \
-DCMAKE_C_FLAGS="${CFLAGS}" \ --without-llvmgxx
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
"${ABS_LLVM_DIR}"
env
fi fi
if [[ -n "${gcc_toolchain}" ]]; then if [[ -n "${gcc_toolchain}" ]]; then
# Copy in the right stdlibc++.so.6 so clang can start. # Copy in the right stdlibc++.so.6 so clang can start.
mkdir -p lib mkdir -p Release+Asserts/lib
cp -v "$(${CXX} ${CXXFLAGS} -print-file-name=libstdc++.so.6)" lib/ cp -v "$(${CXX} ${CXXFLAGS} -print-file-name=libstdc++.so.6)" \
Release+Asserts/lib/
fi fi
MACOSX_DEPLOYMENT_TARGET=10.5 ${MAKE} -j"${NUM_JOBS}"
ninja
STRIP_FLAGS= STRIP_FLAGS=
if [ "${OS}" = "Darwin" ]; then if [ "${OS}" = "Darwin" ]; then
# See http://crbug.com/256342 # See http://crbug.com/256342
STRIP_FLAGS=-x STRIP_FLAGS=-x
cp libcxxbuild/libc++.1.dylib bin/ cp libcxxbuild/libc++.1.dylib Release+Asserts/bin
fi fi
strip ${STRIP_FLAGS} bin/clang strip ${STRIP_FLAGS} Release+Asserts/bin/clang
popd
# Build compiler-rt out-of-tree.
mkdir -p "${COMPILER_RT_BUILD_DIR}"
pushd "${COMPILER_RT_BUILD_DIR}"
MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_THREADS=OFF \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \
"${ABS_COMPILER_RT_DIR}"
ninja
# Copy selected output to the main tree.
# Darwin doesn't support cp --parents, so pipe through tar instead.
CLANG_VERSION=$("${ABS_LLVM_BUILD_DIR}/bin/clang" --version | \
sed -ne 's/clang version \([0-9]\.[0-9]\.[0-9]\).*/\1/p')
ABS_LLVM_CLANG_LIB_DIR="${ABS_LLVM_BUILD_DIR}/lib/clang/${CLANG_VERSION}"
tar -c *blacklist.txt | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
tar -c include/sanitizer | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
if [[ "${OS}" = "Darwin" ]]; then
tar -c lib/darwin | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
else
tar -c lib/linux | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
fi
popd popd
if [[ -n "${with_android}" ]]; then if [[ -n "${with_android}" ]]; then
...@@ -522,24 +427,12 @@ if [[ -n "${with_android}" ]]; then ...@@ -522,24 +427,12 @@ if [[ -n "${with_android}" ]]; then
# http://crbug.com/357890 # http://crbug.com/357890
rm -v "${LLVM_BUILD_DIR}"/android-toolchain/include/c++/*/unwind.h rm -v "${LLVM_BUILD_DIR}"/android-toolchain/include/c++/*/unwind.h
# Build ASan runtime for Android in a separate build tree. # Build ASan runtime for Android.
mkdir -p ${LLVM_BUILD_DIR}/android # Note: LLVM_ANDROID_TOOLCHAIN_DIR is not relative to PWD, but to where we
pushd ${LLVM_BUILD_DIR}/android # build the runtime, i.e. third_party/llvm/projects/compiler-rt.
MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \ pushd "${LLVM_BUILD_DIR}"
-DCMAKE_BUILD_TYPE=Release \ ${MAKE} -C tools/clang/runtime/ \
-DLLVM_ENABLE_ASSERTIONS=ON \ LLVM_ANDROID_TOOLCHAIN_DIR="../../../llvm-build/android-toolchain"
-DLLVM_ENABLE_THREADS=OFF \
-DCMAKE_C_COMPILER=${PWD}/../bin/clang \
-DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \
-DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \
-DCMAKE_C_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../android-toolchain/sysroot -B${PWD}/../android-toolchain" \
-DCMAKE_CXX_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../android-toolchain/sysroot -B${PWD}/../android-toolchain" \
-DANDROID=1 \
"${ABS_COMPILER_RT_DIR}"
ninja clang_rt.asan-arm-android
# And copy it into the main build tree.
cp "$(find -name libclang_rt.asan-arm-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/lib/linux/"
popd popd
fi fi
...@@ -548,38 +441,28 @@ fi ...@@ -548,38 +441,28 @@ fi
# For each tool directory, copy it into the clang tree and use clang's build # For each tool directory, copy it into the clang tree and use clang's build
# system to compile it. # system to compile it.
for CHROME_TOOL_DIR in ${chrome_tools}; do for CHROME_TOOL_DIR in ${chrome_tools}; do
TOOL_SRC_DIR="${PWD}/${THIS_DIR}/../${CHROME_TOOL_DIR}" TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}"
TOOL_BUILD_DIR="${ABS_LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" TOOL_DST_DIR="${LLVM_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}"
TOOL_BUILD_DIR="${LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}"
rm -rf "${TOOL_DST_DIR}"
cp -R "${TOOL_SRC_DIR}" "${TOOL_DST_DIR}"
rm -rf "${TOOL_BUILD_DIR}" rm -rf "${TOOL_BUILD_DIR}"
mkdir -p "${TOOL_BUILD_DIR}" mkdir -p "${TOOL_BUILD_DIR}"
pushd "${TOOL_BUILD_DIR}" cp "${TOOL_SRC_DIR}/Makefile" "${TOOL_BUILD_DIR}"
MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \ MACOSX_DEPLOYMENT_TARGET=10.5 ${MAKE} -j"${NUM_JOBS}" -C "${TOOL_BUILD_DIR}"
-DLLVM_BUILD_DIR="${ABS_LLVM_BUILD_DIR}" \
-DLLVM_SRC_DIR="${ABS_LLVM_DIR}" \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_C_FLAGS="${CFLAGS}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
"${TOOL_SRC_DIR}"
ninja
cp -v "${TOOL_BUILD_DIR}/lib"/* "${ABS_LLVM_BUILD_DIR}/lib/"
popd
done done
if [[ -n "$run_tests" ]]; then if [[ -n "$run_tests" ]]; then
# Run the tests for each chrome tool. # Run a few tests.
for CHROME_TOOL_DIR in ${chrome_tools}; do for CHROME_TOOL_DIR in ${chrome_tools}; do
TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}" TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}"
TOOL_BUILD_DIR="${ABS_LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}"
if [[ -f "${TOOL_SRC_DIR}/tests/test.sh" ]]; then if [[ -f "${TOOL_SRC_DIR}/tests/test.sh" ]]; then
"${TOOL_SRC_DIR}/tests/test.sh" "${ABS_LLVM_BUILD_DIR}/bin/clang" "${TOOL_BUILD_DIR}/lib"/* "${TOOL_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts"
fi fi
done done
# Run the LLVM and Clang tests. pushd "${LLVM_BUILD_DIR}"
ninja -C "${LLVM_BUILD_DIR}" check-all ${MAKE} check-all
popd
fi fi
# After everything is done, log success for this revision. # After everything is done, log success for this revision.
......
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