Manually initialize the module manager before callbacks.

Initializing the module manager overwrites the external Sema/AST sources
with the ASTReader.

As we are using our own sources in cling, we should manually initalize
the module manager when we are in the module mode before we set our
own custom sources (which respect any existing sources like the ones
created by the module manager).
This commit is contained in:
Raphael Isemann 2017-11-01 11:38:52 +01:00 committed by sftnight
parent 1ebf53715c
commit e20f8edbec

View File

@ -226,6 +226,12 @@ namespace cling {
DiagnosticConsumer& DClient = getCI()->getDiagnosticClient(); DiagnosticConsumer& DClient = getCI()->getDiagnosticClient();
DClient.BeginSourceFile(getCI()->getLangOpts(), &PP); DClient.BeginSourceFile(getCI()->getLangOpts(), &PP);
if (m_IncrParser->getCI()->getLangOpts().Modules) {
// Explicitly create the modulemanager now. If we would create it later
// implicitly then it would just overwrite our callbacks we set below.
m_IncrParser->getCI()->createModuleManager();
}
// Disable suggestions for ROOT // Disable suggestions for ROOT
bool showSuggestions = bool showSuggestions =
!llvm::StringRef(ClingStringify(CLING_VERSION)).startswith("ROOT"); !llvm::StringRef(ClingStringify(CLING_VERSION)).startswith("ROOT");