summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-10-22 02:05:46 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-10-22 02:05:46 +0000
commite842a47452223f9f3b683e0f7f9cccb48192cbb6 (patch)
treed86e1e37d64cc2aa392947392af816d5b79583ad /clang/lib/Frontend/FrontendAction.cpp
parenta672ecefef25bcc8cf0d7ac8d54c5139f6386df4 (diff)
downloadbcm5719-llvm-e842a47452223f9f3b683e0f7f9cccb48192cbb6.tar.gz
bcm5719-llvm-e842a47452223f9f3b683e0f7f9cccb48192cbb6.zip
[modules] Initial support for explicitly loading .pcm files.
Implicit module builds are not well-suited to a lot of build systems. In particular, they fare badly in distributed build systems, and they lead to build artifacts that are not tracked as part of the usual dependency management process. This change allows explicitly-built module files (which are already supported through the -emit-module flag) to be explicitly loaded into a build, allowing build systems to opt to manage module builds and dependencies themselves. This is only the first step in supporting such configurations, and it should be considered experimental and subject to change or removal for now. llvm-svn: 220359
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 8760f5094d4..1c9384218ad 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -321,7 +321,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
// FIXME: should not overwrite ASTMutationListener when parsing model files?
if (!isModelParsingAction())
CI.getASTContext().setASTMutationListener(Consumer->GetASTMutationListener());
-
+
if (!CI.getPreprocessorOpts().ChainedIncludes.empty()) {
// Convert headers to PCH and chain them.
IntrusiveRefCntPtr<ExternalSemaSource> source, FinalReader;
@@ -383,6 +383,17 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
"doesn't support modules");
}
+ // If we were asked to load any module files, do so now. Don't make any names
+ // from those modules visible.
+ for (const auto &ModuleFile : CI.getFrontendOpts().ModuleFiles) {
+ // FIXME: Use a better source location here. Perhaps inject something
+ // into the predefines buffer to represent these module files.
+ if (!CI.loadModuleFile(ModuleFile,
+ CI.getSourceManager().getLocForStartOfFile(
+ CI.getSourceManager().getMainFileID())))
+ goto failure;
+ }
+
// If there is a layout overrides file, attach an external AST source that
// provides the layouts from that file.
if (!CI.getFrontendOpts().OverrideRecordLayoutsFile.empty() &&
OpenPOWER on IntegriCloud