Skip to content

Commit

Permalink
Check if a module exists on the disk
Browse files Browse the repository at this point in the history
  • Loading branch information
yamaguchi1024 committed Apr 4, 2018
1 parent fb53571 commit 013f9c4
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1279,27 +1279,26 @@ TCling::TCling(const char *name, const char *title)
LoadModules(CoreModules, *fInterpreter);

// Otherwise module conflicts between rootcling and root
if (!fromRootCling) {
// Dynamically get all the modules and load them if they are not in core modules
clang::CompilerInstance &CI = *fInterpreter->getCI();
clang::ModuleMap &moduleMap = CI.getPreprocessor().getHeaderSearchInfo().getModuleMap();
clang::Preprocessor &PP = CI.getPreprocessor();
std::vector<std::string> vec;

for (auto I = moduleMap.module_begin(), E = moduleMap.module_end(); I != E; ++I) {
clang::Module *M = I->second;
assert(M);

std::string ModuleName = GetModuleNameAsString(M, PP);
if (!ModuleName.empty() && std::find(CoreModules.begin(), CoreModules.end(), ModuleName) == CoreModules.end()) {
if (M->IsSystem && !M->IsMissingRequirement)
LoadModule(ModuleName, *fInterpreter);
else if (!M->IsSystem && !M->IsMissingRequirement)
vec.push_back(ModuleName);
}
// Dynamically get all the modules and load them if they are not in core modules
clang::CompilerInstance &CI = *fInterpreter->getCI();
clang::ModuleMap &moduleMap = CI.getPreprocessor().getHeaderSearchInfo().getModuleMap();
clang::Preprocessor &PP = CI.getPreprocessor();
std::vector<std::string> vec;

for (auto I = moduleMap.module_begin(), E = moduleMap.module_end(); I != E; ++I) {
clang::Module *M = I->second;
assert(M);
if(!M->getASTFile()) continue;

std::string ModuleName = GetModuleNameAsString(M, PP);
if (!ModuleName.empty() && std::find(CoreModules.begin(), CoreModules.end(), ModuleName) == CoreModules.end()) {
if (M->IsSystem && !M->IsMissingRequirement)
LoadModule(ModuleName, *fInterpreter);
else if (!M->IsSystem && !M->IsMissingRequirement)
vec.push_back(ModuleName);
}
LoadModules(vec, *fInterpreter);
}
LoadModules(vec, *fInterpreter);

// Check that the gROOT macro was exported by any core module.
assert(fInterpreter->getMacro("gROOT") && "Couldn't load gROOT macro?");
Expand Down

0 comments on commit 013f9c4

Please sign in to comment.