diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-03-18 01:42:29 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-03-18 01:42:29 +0000 |
commit | 7f330cdb31a4221be501d5d969f2e8a62f457e14 (patch) | |
tree | 2786520a130f64d0284b5ba00c2478ab7310aafd /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 59aca1970828616abecb5691e6f956a94b7b494b (diff) | |
download | llvm-7f330cdb31a4221be501d5d969f2e8a62f457e14.zip llvm-7f330cdb31a4221be501d5d969f2e8a62f457e14.tar.gz llvm-7f330cdb31a4221be501d5d969f2e8a62f457e14.tar.bz2 |
Make module files passed to a module build via -fmodule-file= available to
consumers of that module.
Previously, such a file would only be available if the module happened to
actually import something from that module.
llvm-svn: 232583
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 2dac20bcb..ee8c403 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -1331,6 +1331,19 @@ bool CompilerInstance::loadModuleFile(StringRef FileName) { } } RMN(*this); + // If we don't already have an ASTReader, create one now. + if (!ModuleManager) + createModuleManager(); + + // Tell the module manager about this module file. + if (getModuleManager()->getModuleManager().addKnownModuleFile(FileName)) { + getDiagnostics().Report(SourceLocation(), diag::err_module_file_not_found) + << FileName; + return false; + } + + // Build our mapping of module names to module files from this file + // and its imports. RMN.visitImport(FileName); if (RMN.Failed) |