diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-06-09 21:24:02 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-06-09 21:24:02 +0000 |
commit | 86a3ef5b03b2cc7c70b5d8870775e7fc40069f00 (patch) | |
tree | eb3c2fc04eb49480636bcf2a4b5101975e7ab663 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 7ad13f259f203d6d25bbe263c38e55976a521c33 (diff) | |
download | bcm5719-llvm-86a3ef5b03b2cc7c70b5d8870775e7fc40069f00.tar.gz bcm5719-llvm-86a3ef5b03b2cc7c70b5d8870775e7fc40069f00.zip |
Add -frewrite-imports flag.
If specified, when preprocessing, the contents of imported .pcm files will be
included in preprocessed output. The resulting preprocessed file can then be
compiled standalone without the module sources or .pcm files.
llvm-svn: 305116
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 406149b8c30..72a8c381809 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -667,8 +667,11 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) { llvm::sys::fs::remove(OF.Filename); } OutputFiles.clear(); - for (auto &Module : BuiltModules) - llvm::sys::fs::remove(Module.second); + if (DeleteBuiltModules) { + for (auto &Module : BuiltModules) + llvm::sys::fs::remove(Module.second); + BuiltModules.clear(); + } NonSeekStream.reset(); } @@ -1928,12 +1931,11 @@ void CompilerInstance::loadModuleFromSource(SourceLocation ImportLoc, llvm::MemoryBuffer::getMemBuffer(NullTerminatedSource.c_str())); Other.BuiltModules = std::move(BuiltModules); + Other.DeleteBuiltModules = false; }; auto PostBuildStep = [this](CompilerInstance &Other) { BuiltModules = std::move(Other.BuiltModules); - // Make sure the child build action doesn't delete the .pcms. - Other.BuiltModules.clear(); }; // Build the module, inheriting any modules that we've built locally. |