Skip to content

Commit

Permalink
[core] only return core as shared lib for doxygen documentation purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdymercury authored and pcanal committed Apr 4, 2024
1 parent 1cda2a8 commit af0e1ab
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 48 deletions.
2 changes: 1 addition & 1 deletion core/meta/inc/TInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class TInterpreter : public TNamed {
virtual Int_t GenerateDictionary(const char *classes, const char *includes = nullptr, const char *options = nullptr) = 0;
virtual char *GetPrompt() = 0;
virtual const char *GetSharedLibs() = 0;
virtual const char *GetClassSharedLibs(const char *cls) = 0;
virtual const char *GetClassSharedLibs(const char *cls, bool skipCore = true) = 0;
virtual const char *GetSharedLibDeps(const char *lib, bool tryDyld = false) = 0;
virtual const char *GetIncludePath() = 0;
virtual const char *GetSTLIncludePath() const { return ""; }
Expand Down
15 changes: 10 additions & 5 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,9 @@ extern "C" int TCling__AutoParseCallback(const char* className)
return ((TCling*)gCling)->AutoParse(className);
}

extern "C" const char* TCling__GetClassSharedLibs(const char* className)
extern "C" const char* TCling__GetClassSharedLibs(const char* className, bool skipCore)
{
return ((TCling*)gCling)->GetClassSharedLibs(className);
return ((TCling*)gCling)->GetClassSharedLibs(className, skipCore);
}

// Returns 0 for failure 1 for success
Expand Down Expand Up @@ -6942,7 +6942,7 @@ const char* TCling::GetSharedLibs()
return fSharedLibs;
}

static std::string GetClassSharedLibsForModule(const char *cls, cling::LookupHelper &LH)
static std::string GetClassSharedLibsForModule(const char *cls, cling::LookupHelper &LH, bool skipCore)
{
if (!cls || !*cls)
return {};
Expand Down Expand Up @@ -7019,6 +7019,9 @@ static std::string GetClassSharedLibsForModule(const char *cls, cling::LookupHel
// link declaration.
if (!M->LinkLibraries.size())
continue;
// We have preloaded the Core module thus libCore.so
if (M->Name == "Core" && skipCore)
continue;
assert(M->LinkLibraries.size() == 1);
if (!result.empty())
result += ' ';
Expand All @@ -7034,8 +7037,10 @@ static std::string GetClassSharedLibsForModule(const char *cls, cling::LookupHel
/// The first library in the list is the one containing the class, the
/// others are the libraries the first one depends on. Returns 0
/// in case the library is not found.
/// \param cls the name of the class
/// \param skipCore if true (default), remove "Core" from the returned list

const char* TCling::GetClassSharedLibs(const char* cls)
const char* TCling::GetClassSharedLibs(const char* cls, bool skipCore)
{
if (fCxxModulesEnabled) {
// Lock the interpreter mutex before interacting with cling.
Expand All @@ -7054,7 +7059,7 @@ const char* TCling::GetClassSharedLibs(const char* cls)
// Limit the recursion which can be induced by GetClassSharedLibsForModule.
SuspendAutoLoadingRAII AutoLoadingDisabled(this);
cling::LookupHelper &LH = fInterpreter->getLookupHelper();
std::string libs = GetClassSharedLibsForModule(cls, LH);
std::string libs = GetClassSharedLibsForModule(cls, LH, skipCore);
if (!libs.empty()) {
fAutoLoadLibStorage.push_back(libs);
return fAutoLoadLibStorage.back().c_str();
Expand Down
2 changes: 1 addition & 1 deletion core/metacling/src/TCling.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class TCling final : public TInterpreter {
Int_t GenerateDictionary(const char* classes, const char* includes = "", const char* options = nullptr) final;
char* GetPrompt() final { return fPrompt; }
const char* GetSharedLibs() final;
const char* GetClassSharedLibs(const char* cls) final;
const char* GetClassSharedLibs(const char* cls, bool skipCore = true) final;
const char* GetSharedLibDeps(const char* lib, bool tryDyld = false) final;
const char* GetIncludePath() final;
virtual const char* GetSTLIncludePath() const final;
Expand Down
41 changes: 1 addition & 40 deletions core/metacling/test/TClingTests.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ TEST_F(TClingTests, GetClassSharedLibs)
{
// Shortens the invocation.
auto GetLibs = [](const char *cls) -> std::string {
if (const char *val = gInterpreter->GetClassSharedLibs(cls))
if (const char *val = gInterpreter->GetClassSharedLibs(cls,false))
return val;
return "";
};
Expand Down Expand Up @@ -169,45 +169,6 @@ TEST_F(TClingTests, GetClassSharedLibs)
// GetLibs("ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >")
// != GetLibs("ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float>>")
// note the missing space.

lib = GetLibs("TArray");
EXPECT_EQ("Core", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TInterpreter");
EXPECT_EQ("Core", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TRandom");
EXPECT_EQ("MathCore", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TTree");
EXPECT_EQ("Tree", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TTreeViewer");
EXPECT_EQ("TreeViewer", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TGraph");
EXPECT_EQ("Hist", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TGWindow");
EXPECT_EQ("Gui", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TPad");
EXPECT_EQ("Gpad", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TArrow");
EXPECT_EQ("Graf", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TImage");
EXPECT_EQ("Graf", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TASImage");
EXPECT_EQ("ASImage", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TSpectrum");
EXPECT_EQ("Spectrum", MakeLibNamePlatformIndependent(lib));

lib = GetLibs("TFile");
EXPECT_EQ("RIO", MakeLibNamePlatformIndependent(lib));
}

static std::string MakeDepLibsPlatformIndependent(const std::string &libs) {
Expand Down
2 changes: 1 addition & 1 deletion documentation/doxygen/libs.C
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void libs(TString classname)
int i = classname.Index("_3");
if (i>0) classname.Remove(i,classname.Length()-i);

libname = gInterpreter->GetClassSharedLibs(classname.Data());
libname = gInterpreter->GetClassSharedLibs(classname.Data(),false);
if (!libname)
return;

Expand Down

0 comments on commit af0e1ab

Please sign in to comment.