diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-09-14 23:13:09 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-09-14 23:13:09 +0000 |
| commit | 21931efc4d1216267cc1aed156155d1a8d174956 (patch) | |
| tree | ea02c24013f05dcfc68f01396fbe8f87f0e19887 /clang/lib/Frontend | |
| parent | 25ca53b268f37c4170f8e40fa69306bbd46718b0 (diff) | |
| download | bcm5719-llvm-21931efc4d1216267cc1aed156155d1a8d174956.tar.gz bcm5719-llvm-21931efc4d1216267cc1aed156155d1a8d174956.zip | |
Make -E work with module imports
llvm-svn: 139750
Diffstat (limited to 'clang/lib/Frontend')
| -rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 9a679eed24d..9087ab58d6e 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -736,20 +736,26 @@ ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc, // If we don't already have an ASTReader, create one now. if (!ModuleManager) { + if (!hasASTContext()) + createASTContext(); + std::string Sysroot = getHeaderSearchOpts().Sysroot; const PreprocessorOptions &PPOpts = getPreprocessorOpts(); ModuleManager = new ASTReader(getPreprocessor(), *Context, Sysroot.empty() ? "" : Sysroot.c_str(), PPOpts.DisablePCHValidation, PPOpts.DisableStatCache); - ModuleManager->setDeserializationListener( - getASTConsumer().GetASTDeserializationListener()); - getASTContext().setASTMutationListener( - getASTConsumer().GetASTMutationListener()); + if (hasASTConsumer()) { + ModuleManager->setDeserializationListener( + getASTConsumer().GetASTDeserializationListener()); + getASTContext().setASTMutationListener( + getASTConsumer().GetASTMutationListener()); + } llvm::OwningPtr<ExternalASTSource> Source; Source.reset(ModuleManager); getASTContext().setExternalSource(Source); - ModuleManager->InitializeSema(getSema()); + if (hasSema()) + ModuleManager->InitializeSema(getSema()); } // Try to load the module we found. |

