Skip to content
Closed
Show file tree
Hide file tree
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
Revert "Revert "[cxxmodules] Don't generate rootmap files with cxxmod…
…ules""

This reverts commit f409295.

IIRC this destoryed ACLiC. Let's fix this and remove rootmap files.
  • Loading branch information
yamaguchi1024 committed Aug 21, 2018
commit c65f3736b4e7a831559f0bb9ff87656b568bf5c8
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