Commit 35978194 authored by Christian Dietrich's avatar Christian Dietrich
Browse files

wrappers: check for correct in mode plugin itself

Since i suspect the bash overhead to be the reason for the overhead
observed in musl libc that made clang-hash slower than recompilation.
parent 538187f9
......@@ -177,6 +177,15 @@ protected:
const std::string PreviousHashString = getHashFromFile(HashFile);
// Write hash database to .o.hash if the compiler produces a object file
if (CI.getFrontendOpts().ProgramAction != frontend::EmitObj
&& CI.getFrontendOpts().ProgramAction != frontend::EmitLLVM
&& CI.getFrontendOpts().ProgramAction != frontend::EmitBC
&& CI.getFrontendOpts().ProgramAction != frontend::ParseSyntaxOnly
) {
errs() << "No compile\n";
return make_unique<ASTConsumer>();
}
raw_ostream *Out = nullptr;
if (OutputFile != "" && OutputFile != "/dev/null") {
std::error_code Error;
......
......@@ -9,17 +9,12 @@ configure_file(clang-hash-collect.in ${PROJECT_BINARY_DIR}/wrappers/clang-hash-c
# - clang-ccache: ccache assisted clang
# - clang-hash-stop: clang-hash assisted clang
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink"
"${LLVM_C_COMPILER}" "${CMAKE_CURRENT_BINARY_DIR}/clang-normal"
)
find_program(CCACHE NAMES "ccache")
if (NOT CCACHE)
message(ERROR "CCACHE not found")
endif()
configure_file(clang-normal.in ${PROJECT_BINARY_DIR}/wrappers/clang-normal)
configure_file(clang-ccache.in ${PROJECT_BINARY_DIR}/wrappers/clang-ccache)
configure_file(clang-hash-stop.in ${PROJECT_BINARY_DIR}/wrappers/clang-hash-stop)
......
#!/usr/bin/env bash
#!/bin/sh
exec ${CCACHE} ${LLVM_C_COMPILER} "$@" -Wno-extra-semi
#!/usr/bin/env bash
#!/bin/sh
exec ${LLVM_C_COMPILER} -fplugin=${PROJECT_BINARY_DIR}/src/libclang-hash.so \
-Xclang -plugin-arg-clang-hash -Xclang -stop-if-same-hash \
"$@" -Wno-extra-semi
# Wrapper for clang, that supports (only) fast hash-based
# recompilation.
if [[ ( " $@" =~ .*" -c".* ) && ( "$@" =~ .*" -o".* ) && ! ( "$@" =~ .*"/dev/null".* ) ]]; then
${LLVM_C_COMPILER} -fplugin=${PROJECT_BINARY_DIR}/src/libclang-hash.so \
-Xclang -plugin-arg-clang-hash -Xclang -stop-if-same-hash \
"$@" -Wno-extra-semi
else
${LLVM_C_COMPILER} "$@" -Wno-extra-semi
fi
#!/bin/sh
exec ${LLVM_C_COMPILER} "$@" -Wno-extra-semi
Supports Markdown
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