Commit 26d43042 authored by hans's avatar hans Committed by Commit bot

Revert of Roll Clang 214024:216630 (+216684) and switch to CMake (patchset #20...

Revert of Roll Clang 214024:216630 (+216684) and switch to CMake (patchset #20 id:380001 of https://codereview.chromium.org/453513004/)

Reason for revert:
Builds failing with:

../../third_party/skia/include/core/SkRect.h:280:25: error: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Werror,-Wundefined-bool-conversion]
        SkASSERT(&a && &b);
                    ~~  ^
../../third_party/skia/include/core/SkTypes.h:96:56: note: expanded from macro 'SkASSERT'
    #define SkASSERT(cond)              SK_ALWAYSBREAK(cond)
                                                       ^
../../third_party/skia/include/core/SkPostConfig.h:173:19: note: expanded from macro 'SK_ALWAYSBREAK'
              if (cond) break; \
                  ^

(From http://build.chromium.org/p/chromium.linux/builders/Linux%20GN%20%28dbg%29/builds/12335/steps/compile/logs/stdio)

Original issue's description:
> Roll Clang 214024:216630 (+216684) and switch to CMake
>
> This updates Chromium's clang version to r216630 with
> r216684 cherry-picked to fix an ASan issue.
>
> It also changes the build script for Clang to use CMake
> instead of Autoconf. The ASan team say this configuration
> is better tested, and it also makes us consistent with
> the Windows Clang build which already uses CMake.
>
> BUG=400849
> R=thakis@chromium.org
>
> Committed: https://chromium.googlesource.com/chromium/src/+/ff31c1ba254ca37f7a8b45549e1b7b1c978b3390

TBR=thakis@chromium.org,samsonov@google.com,eugenis@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=400849

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

Cr-Commit-Position: refs/heads/master@{#294960}
parent 9e3ffc5e
......@@ -865,7 +865,7 @@ class BlinkGCPluginConsumer : public ASTConsumer {
visitor.TraverseDecl(context.getTranslationUnitDecl());
if (options_.dump_graph) {
std::error_code err;
string err;
// TODO: Make createDefaultOutputFile or a shorter createOutputFile work.
json_ = JsonWriter::from(instance_.createOutputFile(
"", // OutputPath
......@@ -878,7 +878,7 @@ class BlinkGCPluginConsumer : public ASTConsumer {
false, // CreateMissingDirectories
0, // ResultPathName
0)); // TempPathName
if (!err && json_) {
if (err.empty() && json_) {
json_->OpenList();
} else {
json_ = 0;
......@@ -1844,10 +1844,9 @@ class BlinkGCPluginAction : public PluginASTAction {
protected:
// Overridden from PluginASTAction:
virtual std::unique_ptr<ASTConsumer> CreateASTConsumer(
CompilerInstance& instance,
llvm::StringRef ref) {
return llvm::make_unique<BlinkGCPluginConsumer>(instance, options_);
virtual ASTConsumer* CreateASTConsumer(CompilerInstance& instance,
llvm::StringRef ref) {
return new BlinkGCPluginConsumer(instance, options_);
}
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=
# Prints usage information.
usage() {
echo "Usage: $(basename "${0}")" \
"<path to clang>" \
"<path to plugin>"
"<Path to the llvm build dir, usually Release+Asserts>"
echo ""
echo " Runs all the libBlinkGCPlugin unit tests"
echo ""
......@@ -28,8 +27,8 @@ do_testcase() {
if [ -e "${3}" ]; then
flags="$(cat "${3}")"
fi
local output="$("${CLANG_PATH}" -c -Wno-c++11-extensions \
-Xclang -load -Xclang "${PLUGIN_PATH}" \
local output="$("${CLANG_DIR}"/bin/clang -c -Wno-c++11-extensions \
-Xclang -load -Xclang "${CLANG_DIR}"/lib/lib${LIBNAME}.${LIB} \
-Xclang -add-plugin -Xclang blink-gc-plugin ${flags} ${1} 2>&1)"
local json="${input%cpp}graph.json"
if [ -f "$json" ]; then
......@@ -53,26 +52,24 @@ do_testcase() {
if [[ -z "${1}" ]]; then
usage
exit ${E_BADARGS}
elif [[ -z "${2}" ]]; then
usage
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"
elif [[ ! -d "${1}" ]]; then
echo "${1} is not a directory."
usage
exit ${E_BADARGS}
else
export CLANG_PATH="${1}"
export PLUGIN_PATH="${2}"
echo "Using clang ${CLANG_PATH}..."
echo "Using plugin ${PLUGIN_PATH}..."
export CLANG_DIR="${PWD}/${1}"
echo "Using clang directory ${CLANG_DIR}..."
# 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.
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
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 {
FindBadConstructsAction::FindBadConstructsAction() {
}
std::unique_ptr<ASTConsumer> FindBadConstructsAction::CreateASTConsumer(
ASTConsumer* FindBadConstructsAction::CreateASTConsumer(
CompilerInstance& instance,
llvm::StringRef ref) {
return llvm::make_unique<FindBadConstructsConsumer>(instance, options_);
return new FindBadConstructsConsumer(instance, options_);
}
bool FindBadConstructsAction::ParseArgs(const CompilerInstance& instance,
......
......@@ -17,7 +17,7 @@ class FindBadConstructsAction : public clang::PluginASTAction {
protected:
// Overridden from PluginASTAction:
virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
virtual clang::ASTConsumer* CreateASTConsumer(
clang::CompilerInstance& instance,
llvm::StringRef ref);
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=
# Prints usage information.
usage() {
echo "Usage: $(basename "${0}")" \
"<path to clang>" \
"<path to plugin>"
"<Path to the llvm build dir, usually Release+Asserts>"
echo ""
echo " Runs all the libFindBadConstructs unit tests"
echo ""
......@@ -33,8 +32,8 @@ do_testcase() {
flags="${flags} -isysroot $(xcrun --show-sdk-path) -stdlib=libstdc++"
fi
local output="$("${CLANG_PATH}" -c -Wno-c++11-extensions \
-Xclang -load -Xclang "${PLUGIN_PATH}" \
local output="$("${CLANG_DIR}"/bin/clang -c -Wno-c++11-extensions \
-Xclang -load -Xclang "${CLANG_DIR}"/lib/libFindBadConstructs.${LIB} \
-Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)"
local diffout="$(echo "${output}" | diff - "${2}")"
if [ "${diffout}" = "" ]; then
......@@ -54,26 +53,23 @@ do_testcase() {
if [[ -z "${1}" ]]; then
usage
exit ${E_BADARGS}
elif [[ -z "${2}" ]]; then
usage
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"
elif [[ ! -d "${1}" ]]; then
echo "${1} is not a directory."
usage
exit ${E_BADARGS}
else
export CLANG_PATH="${1}"
export PLUGIN_PATH="${2}"
echo "Using clang ${CLANG_PATH}..."
echo "Using plugin ${PLUGIN_PATH}..."
export CLANG_DIR="${PWD}/${1}"
echo "Using clang directory ${CLANG_DIR}..."
# 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.
cd "$(dirname "${0}")"
if [ "$(uname -s)" = "Linux" ]; then
export LIB=so
elif [ "$(uname -s)" = "Darwin" ]; then
export LIB=dylib
fi
fi
for input in *.cpp; do
......
......@@ -13,9 +13,10 @@ if uname -s | grep -q Darwin; then
else
LIBSUFFIX=so
fi
LIBNAME=\
$(grep 'set(LIBRARYNAME' "$THIS_ABS_DIR"/../blink_gc_plugin/CMakeLists.txt \
| cut -d ' ' -f 2 | tr -d ')')
$(grep LIBRARYNAME "$THIS_ABS_DIR"/../blink_gc_plugin/Makefile \
| cut -d ' ' -f 3)
FLAGS=""
PREFIX="-Xclang -plugin-arg-blink-gc-plugin -Xclang"
......
......@@ -59,16 +59,9 @@ svn diff "${LLVM_DIR}" 2>&1 | 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 diff "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt
echo "Diff in llvm/compiler-rt:" | tee -a buildlog.txt
svn stat "${LLVM_DIR}/compiler-rt" 2>&1 | tee -a buildlog.txt
svn diff "${LLVM_DIR}/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 "Diff in llvm/projects/compiler-rt:" | tee -a buildlog.txt
svn stat "${LLVM_DIR}/projects/compiler-rt" 2>&1 | tee -a buildlog.txt
svn diff "${LLVM_DIR}/projects/compiler-rt" 2>&1 | tee -a buildlog.txt
echo "Starting build" | tee -a buildlog.txt
......@@ -86,7 +79,7 @@ fi
${extra_flags} 2>&1 | tee -a buildlog.txt
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
rm -rf $PDIR
......@@ -123,8 +116,8 @@ fi
cp "${LLVM_LIB_DIR}/libFindBadConstructs.${SO_EXT}" $PDIR/lib
BLINKGCPLUGIN_LIBNAME=\
$(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \
| cut -d ' ' -f 2 | tr -d ')')
$(grep LIBRARYNAME "$THIS_DIR"/../blink_gc_plugin/Makefile \
| cut -d ' ' -f 3)
cp "${LLVM_LIB_DIR}/lib${BLINKGCPLUGIN_LIBNAME}.${SO_EXT}" $PDIR/lib
if [[ -n "${gcc_toolchain}" ]]; then
......@@ -133,7 +126,7 @@ if [[ -n "${gcc_toolchain}" ]]; then
fi
# 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
# Keep only the OSX (ASan and profile) and iossim (ASan) runtime libraries:
# Release+Asserts/lib/clang/*/lib/darwin/libclang_rt.{asan,profile}_*
......@@ -151,7 +144,6 @@ if [ "$(uname -s)" = "Darwin" ]; then
ASAN_DYLIB=$(find "${LLVM_LIB_DIR}/clang" \
-type f -path "*${ASAN_DYLIB_NAME}")
install_name_tool -id @executable_path/${ASAN_DYLIB_NAME} "${ASAN_DYLIB}"
strip -x "${ASAN_DYLIB}"
done
else
# Keep only
......@@ -159,12 +151,12 @@ else
# , but not dfsan.
find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' \
! -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.
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
cp -vR "${LLVM_LIB_DIR}/clang" $PDIR/lib
cp -R "${LLVM_LIB_DIR}/clang" $PDIR/lib
if [ "$(uname -s)" = "Darwin" ]; then
tar zcf $PDIR.tgz -C $PDIR bin include lib buildlog.txt
......
......@@ -30,7 +30,7 @@ fi
"$THIS_DIR"/package.sh $@
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
if [ ! -f "$PDIR.tgz" ]; then
......@@ -43,9 +43,9 @@ fi
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 ')')
LIBNAME=$(grep LIBRARYNAME "$THIS_DIR"/../blink_gc_plugin/Makefile \
| cut -d ' ' -f 3)
LIBFILE=lib$LIBNAME.$SO_EXT
# 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