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 016eaa7620
commit 00a59858a5

View File

@ -242,6 +242,12 @@ namespace cling {
bool usingCxxModules = getSema().getLangOpts().Modules;
if (usingCxxModules) {
// 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();
}
// When using C++ modules, we setup the callbacks now that we have them
// ready before we parse code for the first time. Without C++ modules
// we can't setup the calls now because the clang PCH currently just