diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-09 08:48:41 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-09 08:48:41 +0000 |
commit | 0f99d6a4413e3da6ec242c0ab715d6699045dea8 (patch) | |
tree | 4ae2e591505c54ad7078c0d5235c3c9cbef143b5 /clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp | |
parent | 38c1e6d355e45f73539326a3a1dee1ce0c5738b7 (diff) | |
download | llvm-0f99d6a4413e3da6ec242c0ab715d6699045dea8.zip llvm-0f99d6a4413e3da6ec242c0ab715d6699045dea8.tar.gz llvm-0f99d6a4413e3da6ec242c0ab715d6699045dea8.tar.bz2 |
[modules] PR22534: Load files specified by -fmodule-file= eagerly. In particular, this avoids the need to re-parse module map files when using such a module.
llvm-svn: 244416
Diffstat (limited to 'clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp')
-rw-r--r-- | clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index e09b285..d0e857b 100644 --- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -58,7 +58,7 @@ public: const std::string &OutputFileName, raw_pwrite_stream *OS, std::shared_ptr<PCHBuffer> Buffer) - : Diags(diags), HeaderSearchOpts(HSO), PreprocessorOpts(PPO), + : Diags(diags), Ctx(nullptr), HeaderSearchOpts(HSO), PreprocessorOpts(PPO), TargetOpts(TO), LangOpts(LO), OS(OS), Buffer(Buffer) { // The debug info output isn't affected by CodeModel and // ThreadModel, but the backend expects them to be nonempty. @@ -71,6 +71,11 @@ public: virtual ~PCHContainerGenerator() {} void Initialize(ASTContext &Context) override { + if (Ctx) { + assert(Ctx == &Context); + return; + } + Ctx = &Context; VMContext.reset(new llvm::LLVMContext()); M.reset(new llvm::Module(MainFileName, *VMContext)); |