Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions core/base/src/TSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3499,13 +3499,22 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
}
mapfileStream.close();

bool useCxxModules = false;
#ifdef R__USE_CXXMODULES
useCxxModules = true;
#endif

// ======= Generate the rootcling command line
TString rcling = "rootcling";
PrependPathName(TROOT::GetBinDir(), rcling);
rcling += " -v0 \"--lib-list-prefix=";
rcling += mapfile;
rcling += "\" -f \"";
rcling.Append(dict).Append("\" ");

if (useCxxModules)
rcling += " -cxxmodule ";

if (produceRootmap) {
rcling += " -rml " + libname + " -rmf \"" + libmapfilename + "\" ";
}
Expand Down
2 changes: 1 addition & 1 deletion core/dictgen/res/Scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class RScanner: public clang::RecursiveASTVisitor<RScanner>
typedef std::vector<const clang::FunctionDecl*> FunctionColl_t;
typedef std::vector<const clang::VarDecl*> VariableColl_t;
typedef std::vector<const clang::EnumDecl*> EnumColl_t;
typedef void (*DeclCallback)(const char *type);
typedef void (*DeclCallback)(const clang::RecordDecl*);
typedef std::map<const clang::Decl*,const BaseSelectionRule*> DeclsSelRulesMap_t;

enum class EScanType : char {kNormal, kTwoPasses, kOnePCM};
Expand Down
4 changes: 1 addition & 3 deletions core/dictgen/src/Scanner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,7 @@ bool RScanner::TreatRecordDeclOrTypedefNameDecl(clang::TypeDecl* typeDecl)
// them either directly or indirectly. Any false positive can be
// resolved by removing the spurrious dependency in the (user) header
// files.
std::string qual_name;
GetDeclQualName(recordDecl,qual_name);
fRecordDeclCallback(qual_name.c_str());
fRecordDeclCallback(recordDecl);
}

// in case it is implicit or a forward declaration, we are not interested.
Expand Down
20 changes: 16 additions & 4 deletions core/dictgen/src/rootcling_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -772,9 +772,17 @@ string gLibsNeeded;

////////////////////////////////////////////////////////////////////////////////

void RecordDeclCallback(const char *c)
void RecordDeclCallback(const clang::RecordDecl* recordDecl)
{
string need(gAutoloads[c]);
std::string need;
if (recordDecl->hasOwningModule()) {
clang::Module *M = recordDecl->getOwningModule()->getTopLevelModule();
need = "lib" + M->Name + ".so";
} else {
auto N = clang::dyn_cast<const clang::NamedDecl> (recordDecl);
need = gAutoloads[N->getName()];
}

if (need.length() && gLibsNeeded.find(need) == string::npos) {
gLibsNeeded += " " + need;
}
Expand Down Expand Up @@ -4159,6 +4167,7 @@ int RootClingMain(int argc,
bool selSyntaxOnly = false;
bool noIncludePaths = false;
bool cxxmodule = getenv("ROOT_MODULES") != nullptr;
bool isAclic = false;

// Collect the diagnostic pragmas linked to the usage of -W
// Workaround for ROOT-5656
Expand Down Expand Up @@ -4298,6 +4307,8 @@ int RootClingMain(int argc,
}
ic++;
}
if (liblistPrefix.length())
isAclic = true;

// Check if we have a multi dict request but no target library
if (multiDict && sharedLibraryPathName.empty()) {
Expand Down Expand Up @@ -5054,7 +5065,7 @@ int RootClingMain(int argc,
// Write the module/PCH depending on what mode we are on
if (modGen.IsPCH()) {
if (!GenerateAllDict(modGen, CI, currentDirectory)) return 1;
} else if (cxxmodule) {
} else if (cxxmodule && !isAclic) {
if (!CheckModuleValid(modGen, resourceDir, interp, linkdefFilename, moduleName.str()))
return 1;
}
Expand Down Expand Up @@ -5096,7 +5107,7 @@ int RootClingMain(int argc,
else return a + " " + b;
});

bool rootMapNeeded = !rootmapFileName.empty() || !rootmapLibName.empty();
bool rootMapNeeded = (!rootmapFileName.empty() || !rootmapLibName.empty()) && !(cxxmodule && !isAclic);

std::list<std::string> classesNames;
std::list<std::string> classesNamesForRootmap;
Expand Down Expand Up @@ -5169,6 +5180,7 @@ int RootClingMain(int argc,
// Manually call end of translation unit because we never call the
// appropriate deconstructors in the interpreter. This writes out the C++
// module file that we currently generate.
if (!isAclic)
{
cling::Interpreter::PushTransactionRAII RAII(&interp);
CI->getSema().getASTConsumer().HandleTranslationUnit(CI->getSema().getASTContext());
Expand Down
7 changes: 1 addition & 6 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1311,10 +1311,6 @@ TCling::TCling(const char *name, const char *title, const char* const argv[])
// This should be vector in order to be able to pass it to LoadModules
std::vector<std::string> CoreModules = {"ROOT_Foundation_C","ROOT_Config",
"ROOT_Foundation_Stage1_NoRTTI", "Core", "RIO"};
// These modules contain global variables which conflict with users' code such as "PI".
// FIXME: Reducing those will let us be less dependent on rootmap files
static constexpr std::array<const char*, 4> ExcludeModules =
{ { "Rtools", "RSQLite", "RInterface", "RMVA"} };

LoadModules(CoreModules, *fInterpreter);

Expand All @@ -1332,8 +1328,7 @@ TCling::TCling(const char *name, const char *title, const char* const argv[])

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