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
Next Next commit
[cxxmodules] Also preload TMVA/TreePlayer
ROOT can't autoparse classes inside namespaces with the rootmap
system (as the loading callbacks don't correctly land where
they are supposed to land with our injected namespaces). As this
turns out to be a feature of some kind, let's preload TMVA/TreePlayer
to fix all failing tests that are related to this feature/bug with
modules enabled.
  • Loading branch information
Teemperor authored and vgvassilev committed Nov 28, 2017
commit 53c6936c6bd57b2208fa5db3328de534aecff2d6
10 changes: 10 additions & 0 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1121,10 +1121,13 @@ static void LoadCoreModules(cling::Interpreter &interp)
if (!CI.getLangOpts().Modules)
return;

bool fromRootCling = dlsym(RTLD_DEFAULT, "usedToIdentifyRootClingByDlSym");

clang::HeaderSearch &headerSearch = CI.getPreprocessor().getHeaderSearchInfo();
clang::ModuleMap &moduleMap = headerSearch.getModuleMap();
// List of core modules we can load, but it's ok if they are missing because
// the system doesn't have these modules.

if (clang::Module *LIBCM = moduleMap.findModule("libc"))
if (!LoadModule(LIBCM->Name, interp))
Error("TCling::LoadCoreModules", "Cannot load module %s", LIBCM->Name.c_str());
Expand Down Expand Up @@ -1154,6 +1157,13 @@ static void LoadCoreModules(cling::Interpreter &interp)
// core modules have defined it:
// https://www.gnu.org/software/libc/manual/html_node/Complex-Numbers.html
interp.declare("#ifdef I\n #undef I\n #endif\n");

if (!fromRootCling) {
if (!LoadModule(moduleMap.findModule("TreePlayer")->Name, interp))
Error("TCling::LoadCodeModules", "Cannot load module TreePlayer");
if (!LoadModule(moduleMap.findModule("TMVA")->Name, interp))
Error("TCling::LoadCodeModules", "Cannot load module TMVA");
}
}

static bool FileExists(const char *file)
Expand Down