Commit 3ff887b9 authored by Christian Dietrich's avatar Christian Dietrich
Browse files

plugin: do not exit(0) if error occurred

parent 35978194
...@@ -51,7 +51,9 @@ public: ...@@ -51,7 +51,9 @@ public:
const std::string HashString = Visitor.getHash(&ProcessedBytes); const std::string HashString = Visitor.getHash(&ProcessedBytes);
const bool StopCompiling = const bool StopCompiling =
StopIfSameHash && (HashString == PreviousHashString); StopIfSameHash
&& (HashString == PreviousHashString)
&& (! Context.getSourceManager().getDiagnostics().hasErrorOccurred());
if (TopLevelHashStream) { if (TopLevelHashStream) {
// if (!StopCompiling) //TODO: need to rewrite file everytime, gets cleared on open(): FIX THIS // if (!StopCompiling) //TODO: need to rewrite file everytime, gets cleared on open(): FIX THIS
...@@ -177,12 +179,14 @@ protected: ...@@ -177,12 +179,14 @@ protected:
const std::string PreviousHashString = getHashFromFile(HashFile); const std::string PreviousHashString = getHashFromFile(HashFile);
// Write hash database to .o.hash if the compiler produces a object file // Write hash database to .o.hash if the compiler produces a object file
if (CI.getFrontendOpts().ProgramAction != frontend::EmitObj if ((CI.getFrontendOpts().ProgramAction == frontend::EmitObj
&& CI.getFrontendOpts().ProgramAction != frontend::EmitLLVM || CI.getFrontendOpts().ProgramAction == frontend::EmitBC
&& CI.getFrontendOpts().ProgramAction != frontend::EmitBC || CI.getFrontendOpts().ProgramAction == frontend::EmitLLVM)
&& CI.getFrontendOpts().ProgramAction != frontend::ParseSyntaxOnly && OutputFile != "" && OutputFile != "/dev/null") {
) { /* OK.Let's run */
errs() << "No compile\n"; } else if (CI.getFrontendOpts().ProgramAction == frontend::ParseSyntaxOnly) {
/* OK Let's run */
} else {
return make_unique<ASTConsumer>(); return make_unique<ASTConsumer>();
} }
......
#!/bin/sh #!/bin/bash
exec ${CCACHE} ${LLVM_C_COMPILER} "$@" -Wno-extra-semi exec ${CCACHE} ${LLVM_C_COMPILER} "$@" -Wno-extra-semi
#!/usr/bin/env bash #!/bin/bash
# This wrapper script should be used, if you want to gather insight # This wrapper script should be used, if you want to gather insight
# information about the hashing process. It calls the given clang # information about the hashing process. It calls the given clang
# compiler with our plugin and outputs the information on stderr. # compiler with our plugin and outputs the information on stderr.
printf -v ARGS "%q " "$@" exec ${LLVM_C_COMPILER} -fplugin=${PROJECT_BINARY_DIR}/src/libclang-hash.so \
${LLVM_C_COMPILER} -fplugin=${PROJECT_BINARY_DIR}/src/libclang-hash.so \
-Xclang -plugin-arg-clang-hash -Xclang -hash-verbose \ -Xclang -plugin-arg-clang-hash -Xclang -hash-verbose \
$ARGS "$@"
#!/bin/sh #!/bin/bash
exec ${LLVM_C_COMPILER} "$@" -Wno-extra-semi 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