Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Re-enable header parsing on demand
  • Loading branch information
Teemperor committed Dec 3, 2017
commit 2e3d606f471cc103fcb0c4ef8a5ff369ecb3dc8d
33 changes: 16 additions & 17 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1152,8 +1152,6 @@ TCling::TCling(const char *name, const char *title)
#ifdef R__USE_CXXMODULES
useCxxModules = true;
#endif
if (useCxxModules)
fHeaderParsingOnDemand = false;

llvm::install_fatal_error_handler(&exceptionErrorHandler);

Expand Down Expand Up @@ -1789,7 +1787,22 @@ void TCling::RegisterModule(const char* modulename,
} // if (dyLibName)
} // if (!lateRegistration)

if (hasHeaderParsingOnDemand && fwdDeclsCode){
clang::Sema &TheSema = fInterpreter->getSema();
bool ModuleWasSuccessfullyLoaded = false;
if (hasCxxModule) {
std::string ModuleName = llvm::StringRef(modulename).substr(3).str();
ModuleWasSuccessfullyLoaded = LoadModule(ModuleName, *fInterpreter);
if (!ModuleWasSuccessfullyLoaded) {
// Only report if we found the module in the modulemap.
clang::Preprocessor &PP = TheSema.getPreprocessor();
clang::HeaderSearch &headerSearch = PP.getHeaderSearchInfo();
clang::ModuleMap &moduleMap = headerSearch.getModuleMap();
if (moduleMap.findModule(ModuleName))
Info("TCling::RegisterModule", "Module %s in modulemap failed to load.", ModuleName.c_str());
}
}

if (!ModuleWasSuccessfullyLoaded && hasHeaderParsingOnDemand && fwdDeclsCode){
// We now parse the forward declarations. All the classes are then modified
// in order for them to have an external lexical storage.
std::string fwdDeclsCodeLessEnums;
Expand Down Expand Up @@ -1926,21 +1939,7 @@ void TCling::RegisterModule(const char* modulename,
if (fClingCallbacks)
oldValue = SetClassAutoloading(false);

clang::Sema &TheSema = fInterpreter->getSema();

bool ModuleWasSuccessfullyLoaded = false;
if (hasCxxModule) {
std::string ModuleName = llvm::StringRef(modulename).substr(3).str();
ModuleWasSuccessfullyLoaded = LoadModule(ModuleName, *fInterpreter);
if (!ModuleWasSuccessfullyLoaded) {
// Only report if we found the module in the modulemap.
clang::Preprocessor &PP = TheSema.getPreprocessor();
clang::HeaderSearch &headerSearch = PP.getHeaderSearchInfo();
clang::ModuleMap &moduleMap = headerSearch.getModuleMap();
if (moduleMap.findModule(ModuleName))
Info("TCling::RegisterModule", "Module %s in modulemap failed to load.", ModuleName.c_str());
}
}

{ // scope within which diagnostics are de-activated
// For now we disable diagnostics because we saw them already at
Expand Down