summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-11-26 02:04:16 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-11-26 02:04:16 +0000
commita8cfffa3519c11b0eee26a5d1ff9e4a34d46e73b (patch)
tree7fbaa889132819c58e1786928937d540890154f5 /clang/lib/Frontend
parent72734bffaa2e25b1d5bbc4a7a05a22f944d6bf04 (diff)
downloadbcm5719-llvm-a8cfffa3519c11b0eee26a5d1ff9e4a34d46e73b.tar.gz
bcm5719-llvm-a8cfffa3519c11b0eee26a5d1ff9e4a34d46e73b.zip
[modules] Refactor handling of -fmodules-embed-*. Track this properly rather
than reusing the "overridden buffer" mechanism. This will allow us to make embedded files and overridden files behave differently in future. llvm-svn: 254121
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/FrontendActions.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index 4edb9584414..d6c88d20fc2 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -277,6 +277,17 @@ bool GenerateModuleAction::BeginSourceFileAction(CompilerInstance &CI,
return false;
}
+ // Set up embedding for any specified files. Do this before we load any
+ // source files, including the primary module map for the compilation.
+ for (const auto &F : CI.getFrontendOpts().ModulesEmbedFiles) {
+ if (const auto *FE = CI.getFileManager().getFile(F, /*openFile*/true))
+ CI.getSourceManager().setFileIsTransient(FE);
+ else
+ CI.getDiagnostics().Report(diag::err_modules_embed_file_not_found) << F;
+ }
+ if (CI.getFrontendOpts().ModulesEmbedAllFiles)
+ CI.getSourceManager().setAllFilesAreTransient(true);
+
// Parse the module map file.
HeaderSearch &HS = CI.getPreprocessor().getHeaderSearchInfo();
if (HS.loadModuleMapFile(ModuleMap, IsSystem))
@@ -292,16 +303,6 @@ bool GenerateModuleAction::BeginSourceFileAction(CompilerInstance &CI,
return false;
}
- // Set up embedding for any specified files.
- for (const auto &F : CI.getFrontendOpts().ModulesEmbedFiles) {
- if (const auto *FE = CI.getFileManager().getFile(F, /*openFile*/true))
- CI.getSourceManager().embedFileContentsInModule(FE);
- else
- CI.getDiagnostics().Report(diag::err_modules_embed_file_not_found) << F;
- }
- if (CI.getFrontendOpts().ModulesEmbedAllFiles)
- CI.getSourceManager().setEmbedAllFileContentsInModule(true);
-
// If we're being run from the command-line, the module build stack will not
// have been filled in yet, so complete it now in order to allow us to detect
// module cycles.
OpenPOWER on IntegriCloud