Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[metacling] Optimize TCling*Info interfaces #3616

4 changes: 4 additions & 0 deletions core/dictgen/src/rootcling_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4266,6 +4266,10 @@ int RootClingMain(int argc,

if (!isPCH && cxxmodule) {
#ifndef R__MACOSX
// Add the overlay file. Note that we cannot factor it out for both root
// and rootcling because rootcling activates modules only if -cxxmodule
// flag is passed.

// includeDir is where modulemaps exist.
clingArgsInterpreter.push_back("-modulemap_overlay=" + includeDir);
#endif //R__MACOSX
Expand Down
1 change: 1 addition & 0 deletions core/metacling/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ROOT_OBJECT_LIBRARY(MetaCling
TClingClassInfo.cxx
TCling.cxx
TClingDataMemberInfo.cxx
TClingDeclInfo.cxx
TClingMethodArgInfo.cxx
TClingMethodInfo.cxx
TClingTypedefInfo.cxx
Expand Down
14 changes: 8 additions & 6 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1206,15 +1206,17 @@ TCling::TCling(const char *name, const char *title, const char* const argv[])
}
}

if (fCxxModulesEnabled) {
clingArgsStorage.push_back("-modulemap_overlay=" + std::string(TROOT::GetIncludeDir().Data()));
}

// FIXME: This only will enable frontend timing reports.
EnvOpt = llvm::sys::Process::GetEnv("ROOT_CLING_TIMING");
if (EnvOpt.hasValue())
clingArgsStorage.push_back("-ftime-report");

// Add the overlay file. Note that we cannot factor it out for both root
// and rootcling because rootcling activates modules only if -cxxmodule
// flag is passed.
if (fCxxModulesEnabled && !fromRootCling)
clingArgsStorage.push_back("-modulemap_overlay=" + std::string(TROOT::GetIncludeDir().Data()));

std::vector<const char*> interpArgs;
for (std::vector<std::string>::const_iterator iArg = clingArgsStorage.begin(),
eArg = clingArgsStorage.end(); iArg != eArg; ++iArg)
Expand Down Expand Up @@ -8412,15 +8414,15 @@ const char* TCling::MethodInfo_GetMangledName(MethodInfo_t* minfo) const
const char* TCling::MethodInfo_GetPrototype(MethodInfo_t* minfo) const
{
TClingMethodInfo* info = (TClingMethodInfo*) minfo;
return info->GetPrototype(*fNormalizedCtxt);
return info->GetPrototype();
}

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

const char* TCling::MethodInfo_Name(MethodInfo_t* minfo) const
{
TClingMethodInfo* info = (TClingMethodInfo*) minfo;
return info->Name(*fNormalizedCtxt);
return info->Name();
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion core/metacling/src/TClingBaseClassInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ TClingClassInfo *TClingBaseClassInfo::GetBase() const
}

OffsetPtrFunc_t
TClingBaseClassInfo::GenerateBaseOffsetFunction(const TClingClassInfo * fromDerivedClass,
TClingBaseClassInfo::GenerateBaseOffsetFunction(TClingClassInfo * fromDerivedClass,
TClingClassInfo* toBaseClass,
void* address, bool isDerivedObject) const
{
Expand Down Expand Up @@ -262,6 +262,7 @@ int TClingBaseClassInfo::InternalNext(int onlyDirect)
(fIter == llvm::dyn_cast<clang::CXXRecordDecl>(fDecl)->bases_end())) {
return 0;
}

// Advance to the next valid base.
while (1) {
// Advance the iterator.
Expand Down
2 changes: 1 addition & 1 deletion core/metacling/src/TClingBaseClassInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class TClingBaseClassInfo {
const char *TmpltName() const;

private:
OffsetPtrFunc_t GenerateBaseOffsetFunction(const TClingClassInfo* derivedClass, TClingClassInfo* targetClass, void* address, bool isDerivedObject) const;
OffsetPtrFunc_t GenerateBaseOffsetFunction(TClingClassInfo* derivedClass, TClingClassInfo* targetClass, void* address, bool isDerivedObject) const;
};

#endif // ROOT_TClingBaseClassInfo
4 changes: 2 additions & 2 deletions core/metacling/src/TClingCallFunc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ void TClingCallFunc::exec(void *address, void *ret)
if (num_args < GetMinRequiredArguments()) {
::Error("TClingCallFunc::exec",
"Not enough arguments provided for %s (%d instead of the minimum %d)",
fMethod->Name(ROOT::TMetaUtils::TNormalizedCtxt(fInterp->getLookupHelper())),
fMethod->Name(),
num_args, (int)GetMinRequiredArguments());
return;
}
Expand All @@ -1492,7 +1492,7 @@ void TClingCallFunc::exec(void *address, void *ret)
&& !dyn_cast<CXXConstructorDecl>(FD)) {
::Error("TClingCallFunc::exec",
"The method %s is called without an object.",
fMethod->Name(ROOT::TMetaUtils::TNormalizedCtxt(fInterp->getLookupHelper())));
fMethod->Name());
return;
}
vh_ary.reserve(num_args);
Expand Down
Loading