Author: jdevlieghere Date: Tue Feb 12 10:19:34 2019 New Revision: 353869 URL: http://llvm.org/viewvc/llvm-project?rev=353869&view=rev Log: [lldb-instr] Pass PCHContainerOperations to ClangTool
On a local modules build this would cause an error. > fatal error: no handler registered for module format 'obj' > LLVM ERROR: unknown module format Interestingly enough, this didn't trigger on the GreenDragon CMake bot, which is configured with modules. Modified: lldb/trunk/tools/lldb-instr/CMakeLists.txt lldb/trunk/tools/lldb-instr/Instrument.cpp Modified: lldb/trunk/tools/lldb-instr/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-instr/CMakeLists.txt?rev=353869&r1=353868&r2=353869&view=diff ============================================================================== --- lldb/trunk/tools/lldb-instr/CMakeLists.txt (original) +++ lldb/trunk/tools/lldb-instr/CMakeLists.txt Tue Feb 12 10:19:34 2019 @@ -4,6 +4,7 @@ add_lldb_tool(lldb-instr LINK_LIBS clangAST clangBasic + clangCodeGen clangFrontend clangLex clangRewrite Modified: lldb/trunk/tools/lldb-instr/Instrument.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-instr/Instrument.cpp?rev=353869&r1=353868&r2=353869&view=diff ============================================================================== --- lldb/trunk/tools/lldb-instr/Instrument.cpp (original) +++ lldb/trunk/tools/lldb-instr/Instrument.cpp Tue Feb 12 10:19:34 2019 @@ -1,6 +1,7 @@ #include "clang/AST/AST.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/RecursiveASTVisitor.h" +#include "clang/CodeGen/ObjectFilePCHContainerOperations.h" #include "clang/Frontend/ASTConsumers.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendActions.h" @@ -280,6 +281,11 @@ int main(int argc, const char **argv) { CommonOptionsParser OP(argc, argv, InstrCategory, "Utility for generating the macros for LLDB's " "instrumentation framework."); - ClangTool T(OP.getCompilations(), OP.getSourcePathList()); + + auto PCHOpts = std::make_shared<PCHContainerOperations>(); + PCHOpts->registerWriter(llvm::make_unique<ObjectFilePCHContainerWriter>()); + PCHOpts->registerReader(llvm::make_unique<ObjectFilePCHContainerReader>()); + + ClangTool T(OP.getCompilations(), OP.getSourcePathList(), PCHOpts); return T.run(newFrontendActionFactory<SBAction>().get()); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits