63#include "RConfigure.h"
64#include "compiledata.h"
83#include "clang/AST/ASTContext.h"
84#include "clang/AST/Decl.h"
85#include "clang/AST/DeclarationName.h"
86#include "clang/AST/GlobalDecl.h"
87#include "clang/AST/RecordLayout.h"
88#include "clang/AST/DeclVisitor.h"
89#include "clang/AST/RecursiveASTVisitor.h"
90#include "clang/AST/Type.h"
91#include "clang/Basic/SourceLocation.h"
92#include "clang/Basic/Specifiers.h"
93#include "clang/Basic/TargetInfo.h"
94#include "clang/CodeGen/ModuleBuilder.h"
95#include "clang/Frontend/CompilerInstance.h"
96#include "clang/Frontend/FrontendDiagnostic.h"
97#include "clang/Lex/HeaderSearch.h"
98#include "clang/Lex/Preprocessor.h"
99#include "clang/Lex/PreprocessorOptions.h"
100#include "clang/Parse/Parser.h"
101#include "clang/Sema/Lookup.h"
102#include "clang/Sema/Sema.h"
103#include "clang/Serialization/ASTReader.h"
104#include "clang/Serialization/GlobalModuleIndex.h"
106#include "cling/Interpreter/ClangInternalState.h"
107#include "cling/Interpreter/DynamicLibraryManager.h"
108#include "cling/Interpreter/Interpreter.h"
109#include "cling/Interpreter/LookupHelper.h"
110#include "cling/Interpreter/Value.h"
111#include "cling/Interpreter/Transaction.h"
112#include "cling/MetaProcessor/MetaProcessor.h"
113#include "cling/Utils/AST.h"
114#include "cling/Utils/ParserStateRAII.h"
115#include "cling/Utils/SourceNormalization.h"
116#include "cling/Interpreter/Exception.h"
118#include "llvm/IR/GlobalValue.h"
119#include "llvm/IR/Module.h"
121#include "llvm/Support/DynamicLibrary.h"
122#include "llvm/Support/raw_ostream.h"
123#include "llvm/Support/Path.h"
124#include "llvm/Support/Process.h"
125#include "llvm/Object/ELFObjectFile.h"
126#include "llvm/Object/ObjectFile.h"
127#include "llvm/Object/SymbolicFile.h"
128#include "llvm/Support/FileSystem.h"
142#include <unordered_map>
143#include <unordered_set>
151#define R__DLLEXPORT __attribute__ ((visibility ("default")))
159#include <mach-o/dyld.h>
160#include <mach-o/loader.h>
167#if defined(R__LINUX) || defined(R__FBSD)
174#if defined(__CYGWIN__)
175#include <sys/cygwin.h>
176#define HMODULE void *
178 __declspec(dllimport)
void * __stdcall GetCurrentProcess();
179 __declspec(dllimport)
bool __stdcall EnumProcessModules(
void *,
void **,
unsigned long,
unsigned long *);
180 __declspec(dllimport)
unsigned long __stdcall GetModuleFileNameExW(
void *,
void *,
wchar_t *,
unsigned long);
187# define STDIN_FILENO 0
190# define STDOUT_FILENO 1
193# define STDERR_FILENO 2
203#undef GetModuleFileName
204#define RTLD_DEFAULT ((void *)::GetModuleHandle(NULL))
205#define dlsym(library, function_name) ::GetProcAddress((HMODULE)library, function_name)
206#define dlopen(library_name, flags) ::LoadLibraryA(library_name)
207#define dlclose(library) ::FreeLibrary((HMODULE)library)
208#define R__DLLEXPORT __declspec(dllexport)
216 return D->getDeclContext();
219 return llvm::dyn_cast<clang::NamespaceDecl>(DC);
222 return llvm::dyn_cast<clang::RecordDecl>(DC);
225 return DC->dumpDeclContext();
234 return ((clang::Decl*)D)->dump();
237 if (clang::NamedDecl* ND = llvm::dyn_cast<clang::NamedDecl>(D)) {
240 llvm::raw_string_ostream OS(
name);
241 ND->getNameForDiagnostic(OS, D->getASTContext().getPrintingPolicy(),
244 printf(
"%s\n",
name.c_str());
252 return D->isInvalidDecl();
256 assert(info && info->
IsValid());
257 return info->
GetDecl()->isInvalidDecl();
260using std::string, std::vector;
261using namespace clang;
265 static const std::string gInterpreterClassDef = R
"ICF(
267#define ClassDef(name, id) \
268_ClassDefInterp_(name,id,virtual,) \
269static int DeclFileLine() { return __LINE__; }
271#define ClassDefNV(name, id) \
272_ClassDefInterp_(name,id,,) \
273static int DeclFileLine() { return __LINE__; }
274#undef ClassDefOverride
275#define ClassDefOverride(name, id) \
276_ClassDefInterp_(name,id,,override) \
277static int DeclFileLine() { return __LINE__; }
280 static const std::string gNonInterpreterClassDef = R
"ICF(
281#define __ROOTCLING__ 1
283#define ClassDef(name,id) \
284_ClassDefOutline_(name,id,virtual,) \
285static int DeclFileLine() { return __LINE__; }
287#define ClassDefNV(name, id)\
288_ClassDefOutline_(name,id,,)\
289static int DeclFileLine() { return __LINE__; }
290#undef ClassDefOverride
291#define ClassDefOverride(name, id)\
292_ClassDefOutline_(name,id,,override)\
293static int DeclFileLine() { return __LINE__; }
297 static const std::string gClassDefInterpMacro = R
"ICF(
300#define _ClassDefInterp_(name,id,virtual_keyword, overrd) \
303 static TClass *Class() { static TClass* sIsA = 0; if (!sIsA) sIsA = TClass::GetClass(#name); return sIsA; } \
304 static const char *Class_Name() { return #name; } \
305 virtual_keyword Bool_t CheckTObjectHashConsistency() const overrd { return true; } \
306 static Version_t Class_Version() { return id; } \
307 static TClass *Dictionary() { return 0; } \
308 virtual_keyword TClass *IsA() const overrd { return name::Class(); } \
309 virtual_keyword void ShowMembers(TMemberInspector&insp) const overrd { ::ROOT::Class_ShowMembers(name::Class(), this, insp); } \
310 virtual_keyword void Streamer(TBuffer&) overrd { ::Error("Streamer", "Cannot stream interpreted class."); } \
311 void StreamerNVirtual(TBuffer&ClassDef_StreamerNVirtual_b) { name::Streamer(ClassDef_StreamerNVirtual_b); } \
312 static const char *DeclFileName() { return __FILE__; } \
313 static int ImplFileLine() { return 0; } \
314 static const char *ImplFileName() { return __FILE__; }
353 return ((
TCling*)
gCling)->LibraryLoadingFailed(errmessage, libStem, permanent, resolved);
392 static vector<const NamedDecl*> updateList;
395 if (entered) topLevel =
kFALSE;
410 updateList.push_back(TD);
413 while (!updateList.empty()) {
415 updateList.pop_back();
422 const clang::Decl* D =
static_cast<const clang::Decl*
>(enumObj->
GetDeclId());
423 if(
const clang::EnumDecl* ED = dyn_cast<clang::EnumDecl>(D)) {
425 for (EnumDecl::enumerator_iterator EDI = ED->enumerator_begin(),
426 EDE = ED->enumerator_end(); EDI != EDE; ++EDI) {
428 std::string constbuf;
429 if (
const NamedDecl* END = llvm::dyn_cast<NamedDecl>(*EDI)) {
430 PrintingPolicy Policy((*EDI)->getASTContext().getPrintingPolicy());
431 llvm::raw_string_ostream stream(constbuf);
433 Policy.AnonymousTagLocations =
false;
434 (END)->getNameForDiagnostic(stream, Policy,
false);
436 const char* constantName = constbuf.c_str();
440 const llvm::APSInt valAPSInt = (*EDI)->getInitVal();
441 if (valAPSInt.isSigned()) {
442 value = valAPSInt.getSExtValue();
444 value = valAPSInt.getZExtValue();
451 DataMemberInfo_t* dmInfo = (DataMemberInfo_t*) tcDmInfo;
462 globals->
Add(enumConstant);
474 TEnum* enumType =
nullptr;
475 const clang::Decl* D =
static_cast<const clang::Decl*
>(VD);
477 if (
const EnumDecl* ED = llvm::dyn_cast<EnumDecl>(D)) {
479 PrintingPolicy Policy(ED->getASTContext().getPrintingPolicy());
480 llvm::raw_string_ostream stream(buf);
482 Policy.AnonymousTagLocations =
false;
483 ED->getNameForDiagnostic(stream, Policy,
false);
489 const char*
name = buf.c_str();
500 const clang::Decl* D =
static_cast<const clang::Decl*
>(DV);
502 if (!D->isCanonicalDecl() && !isa<clang::NamespaceDecl>(D)
503 && !dyn_cast<clang::RecordDecl>(D))
return;
505 if (isa<clang::FunctionDecl>(D->getDeclContext())
506 || isa<clang::TagDecl>(D->getDeclContext()))
510 if (
const clang::CXXRecordDecl* RD = dyn_cast<clang::CXXRecordDecl>(D)) {
511 if (RD->getDescribedClassTemplate())
513 }
else if (
const clang::FunctionDecl* FD = dyn_cast<clang::FunctionDecl>(D)) {
514 if (FD->getDescribedFunctionTemplate())
518 if (
const RecordDecl *TD = dyn_cast<RecordDecl>(D)) {
519 if (TD->isCanonicalDecl() || TD->isThisDeclarationADefinition())
522 else if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
524 if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
528 }
else if (
const NamespaceDecl* NSD = dyn_cast<NamespaceDecl>(D)) {
533 if (!isa<TranslationUnitDecl>(ND->getDeclContext()))
537 if (isa<EnumDecl>(ND))
542 if (!(isa<VarDecl>(ND)))
546 if (
gROOT->GetListOfGlobals()->FindObject(ND->getNameAsString().c_str()))
550 gROOT->GetListOfGlobals()->Add(
new TGlobal((DataMemberInfo_t *)
552 cast<ValueDecl>(ND),
nullptr)));
584 const char* canonicalName) {
585 ((
TCling*)
gCling)->LibraryLoaded(dyLibHandle, canonicalName);
590 ((
TCling *)
gCling)->RegisterRdictForLoadPCM(pcmFileNameFullPath, pcmContent);
594 const char* canonicalName) {
595 ((
TCling*)
gCling)->LibraryUnloaded(dyLibHandle, canonicalName);
601 return ((
TCling*)
gCling)->GetObjectAddress(Name, LookupCtx);
611 auto tcling =
new TCling(
"C++",
"cling C++ Interpreter", argv, interpLibHandle);
635 return ((
TCling*)
gCling)->GetClassSharedLibs(className);
641 return ((
TCling*)
gCling)->IsAutoLoadNamespaceCandidate(nsDecl);
646 string file(fileName);
652 string &args,
string &io,
string &fname)
654 string file(fileName);
655 TString f, amode, arguments, aclicio;
658 io = aclicio.
Data(); fname =
f.Data();
668 char *__unDName(
char *demangled,
const char *mangled,
int out_len,
669 void * (* pAlloc )(
size_t),
void (* pFree )(
void *),
670 unsigned short int flags);
682 using namespace clang;
683 if (NamespaceDecl* nsd = llvm::dyn_cast<NamespaceDecl>(decl)){
687 if (ClassTemplateDecl* ctd = llvm::dyn_cast<ClassTemplateDecl>(decl)){
700 const std::vector<std::string> &headers,
701 const std::vector<std::string> &fwdDecls,
702 const std::vector<std::string> &unknown)
708 if (classes.empty()) {
712 const std::string& className = classes[0];
714 TString fileName =
"AutoDict_";
715 std::string::const_iterator sIt;
716 for (sIt = className.begin(); sIt != className.end(); ++sIt) {
717 if (*sIt ==
'<' || *sIt ==
'>' ||
718 *sIt ==
' ' || *sIt ==
'*' ||
719 *sIt ==
',' || *sIt ==
'&' ||
727 if (classes.size() > 1) {
729 std::vector<std::string>::const_iterator it = classes.begin();
730 while ((++it) != classes.end()) {
732 chk = chk * 3 + it->at(
cursor);
745 static const std::set<std::string> sSTLTypes {
746 "vector",
"list",
"forward_list",
"deque",
"map",
"unordered_map",
"multimap",
747 "unordered_multimap",
"set",
"unordered_set",
"multiset",
"unordered_multiset",
748 "queue",
"priority_queue",
"stack",
"iterator"};
749 std::vector<std::string>::const_iterator it;
750 std::string fileContent(
"");
751 for (it = headers.begin(); it != headers.end(); ++it) {
752 fileContent +=
"#include \"" + *it +
"\"\n";
754 for (it = unknown.begin(); it != unknown.end(); ++it) {
760 while (dirbase.
Length() && dirbase !=
"."
761 && dirbase !=
"include" && dirbase !=
"inc"
762 && dirbase !=
"prec_stl") {
766 fileContent +=
TString(
"#include \"") + header +
"\"\n";
769 for (it = fwdDecls.begin(); it != fwdDecls.end(); ++it) {
770 fileContent +=
"class " + *it +
";\n";
772 fileContent +=
"#ifdef __CLING__ \n";
773 fileContent +=
"#pragma link C++ nestedclasses;\n";
774 fileContent +=
"#pragma link C++ nestedtypedefs;\n";
775 for (it = classes.begin(); it != classes.end(); ++it) {
777 size_t posTemplate =
n.find(
'<');
778 std::set<std::string>::const_iterator iSTLType = sSTLTypes.end();
779 if (posTemplate != std::string::npos) {
780 n.erase(posTemplate, std::string::npos);
781 if (
n.compare(0, 5,
"std::") == 0) {
784 iSTLType = sSTLTypes.find(
n);
786 fileContent +=
"#pragma link C++ class ";
787 fileContent += *it +
"+;\n" ;
788 fileContent +=
"#pragma link C++ class ";
789 if (iSTLType != sSTLTypes.end()) {
793 fileContent += *it +
"::*;\n" ;
798 fileContent += *it +
"::*+;\n" ;
801 fileContent +=
"#endif\n";
805 filePointer = fopen(fileName,
"w");
806 if (filePointer ==
nullptr) {
812 fprintf(filePointer,
"%s", fileContent.c_str());
828 const std::vector<std::string> &headers,
829 const std::vector<std::string> &fwdDecls,
830 const std::vector<std::string> &unknown)
836 std::vector<std::string> classes;
837 classes.push_back(className);
865 void exceptionErrorHandler(
void * ,
868 throw std::runtime_error(std::string(
">>> Interpreter compilation error:\n") + reason);
882 class clangDiagSuppr {
884 clangDiagSuppr(clang::DiagnosticsEngine& diag): fDiagEngine(diag){
885 fOldDiagValue = fDiagEngine.getIgnoreAllWarnings();
886 fDiagEngine.setIgnoreAllWarnings(
true);
890 fDiagEngine.setIgnoreAllWarnings(fOldDiagValue);
893 clang::DiagnosticsEngine& fDiagEngine;
916 if (strncmp(tname.c_str(),
"const ", 6) == 0) {
919 unsigned long end = tname.length();
920 while( end && (tname[end-1]==
'&' || tname[end-1]==
'*' || tname[end-1]==
']') ) {
921 if ( tname[end-1]==
']' ) {
923 while ( end && tname[end-1]!=
'[' ) --end;
927 std::string innerbuf;
929 if (end != tname.length()) {
931 inner = innerbuf.c_str();
933 inner = tname.c_str()+
offset;
937 if (
gROOT->GetListOfClasses()->FindObject(inner)
947 const char *newname =
type->GetFullTypeName();
949 newname =
"Long64_t";
951 newname =
"ULong64_t";
953 if (strcmp(inner,newname) == 0) {
958 if ( end != tname.length() ) {
959 result += tname.substr(end,tname.length()-end);
967 if (lastPos != inner)
971 const auto enName = lastPos;
972 const auto scopeNameSize = ((
Long64_t)lastPos - (
Long64_t)inner) /
sizeof(
decltype(*lastPos)) - 2;
973 char *scopeName =
new char[scopeNameSize + 1];
974 strncpy(scopeName, inner, scopeNameSize);
975 scopeName[scopeNameSize] =
'\0';
977 if (
auto scope =
static_cast<TClass *
>(
gROOT->GetListOfClasses()->FindObject(scopeName))) {
978 auto enumTable =
dynamic_cast<const THashList *
>(scope->GetListOfEnums(
false));
979 if (enumTable && enumTable->THashList::FindObject(enName)) {
delete [] scopeName;
return true; }
983 auto listOfEnums = scope->GetListOfEnums();
985 auto enumTable =
dynamic_cast<const THashList *
>(listOfEnums);
986 if (enumTable && enumTable->THashList::FindObject(enName)) {
delete [] scopeName;
return true; }
993 auto enumTable =
dynamic_cast<const THashList *
>(
gROOT->GetListOfEnums());
994 if (enumTable && enumTable->THashList::FindObject(inner))
return true;
1017 return fContent.c_str();
1025 bool notPresent = fLinesHashSet.emplace(fHashFunc(str)).second;
1039static bool LoadModule(
const std::string &ModuleName, cling::Interpreter &interp)
1049 assert(!currentDir.empty());
1052 ::Info(
"TCling::__LoadModule",
"Preloading module %s. \n",
1053 ModuleName.c_str());
1055 return interp.loadModule(ModuleName,
true);
1061static void LoadModules(
const std::vector<std::string> &modules, cling::Interpreter &interp)
1063 for (
const auto &modName : modules)
1069 const static bool foundSymbol = dlsym(RTLD_DEFAULT,
"usedToIdentifyRootClingByDlSym");
1074static bool HasASTFileOnDisk(clang::Module *M,
const clang::Preprocessor &PP, std::string *FullFileName =
nullptr)
1076 const HeaderSearchOptions &HSOpts = PP.getHeaderSearchInfo().getHeaderSearchOpts();
1078 std::string ModuleFileName;
1079 if (!HSOpts.PrebuiltModulePaths.empty())
1081 ModuleFileName = PP.getHeaderSearchInfo().getPrebuiltModuleFileName(M->Name);
1083 *FullFileName = ModuleFileName;
1085 return !ModuleFileName.empty();
1091 CompilerInstance &CI = *interp.getCI();
1092 Preprocessor &PP = CI.getPreprocessor();
1093 auto ModuleManager = CI.getASTReader();
1094 assert(ModuleManager);
1099 if (ModuleIndexPath.empty())
1102 ModuleManager->resetForReload();
1103 ModuleManager->loadGlobalIndex();
1104 GlobalModuleIndex *GlobalIndex = ModuleManager->getGlobalIndex();
1109 ModuleMap &MMap = PP.getHeaderSearchInfo().getModuleMap();
1110 bool RecreateIndex =
false;
1111 for (ModuleMap::module_iterator
I = MMap.module_begin(), E = MMap.module_end();
I != E; ++
I) {
1112 Module *TheModule =
I->second;
1117 RecreateIndex =
true;
1119 if (RecreateIndex) {
1120 cling::Interpreter::PushTransactionRAII deserRAII(&interp);
1121 clang::GlobalModuleIndex::UserDefinedInterestingIDs IDs;
1123 struct DefinitionFinder :
public RecursiveASTVisitor<DefinitionFinder> {
1124 DefinitionFinder(clang::GlobalModuleIndex::UserDefinedInterestingIDs& IDs,
1125 clang::TranslationUnitDecl* TU) : DefinitionIDs(IDs) {
1128 bool VisitNamedDecl(NamedDecl *ND) {
1129 if (!ND->isFromASTFile())
1131 if (!ND->getIdentifier())
1134 if (ND->getAccess() == AS_protected || ND->getAccess() == AS_private)
1137 if (TagDecl *TD = llvm::dyn_cast<TagDecl>(ND)) {
1138 if (TD->isCompleteDefinition())
1140 }
else if (NamespaceDecl *NSD = llvm::dyn_cast<NamespaceDecl>(ND)) {
1141 Register(NSD,
false);
1143 else if (TypedefNameDecl *TND = dyn_cast<TypedefNameDecl>(ND))
1149 clang::GlobalModuleIndex::UserDefinedInterestingIDs &DefinitionIDs;
1150 void Register(
const NamedDecl* ND,
bool AddSingleEntry =
true) {
1151 assert(ND->isFromASTFile());
1154 if (!ND->hasOwningModule()) {
1156 SourceManager &SM = ND->getASTContext().getSourceManager();
1157 SourceLocation Loc = ND->getLocation();
1158 const FileEntry *FE = SM.getFileEntryForID(SM.getFileID(Loc));
1160 assert(FE->getName().contains(
"input_line_"));
1165 Module *OwningModule = ND->getOwningModule()->getTopLevelModule();
1166 assert(OwningModule);
1167 assert(!ND->getName().empty() &&
"Empty name");
1168 if (AddSingleEntry && DefinitionIDs.count(ND->getName()))
1174 DefinitionIDs[ND->getName()].push_back(OwningModule->getASTFile());
1177 DefinitionFinder defFinder(IDs, CI.getASTContext().getTranslationUnitDecl());
1179 llvm::cantFail(GlobalModuleIndex::writeIndex(CI.getFileManager(),
1180 CI.getPCHContainerReader(),
1183 ModuleManager->resetForReload();
1184 ModuleManager->loadGlobalIndex();
1185 GlobalIndex = ModuleManager->getGlobalIndex();
1194 if (!clingInterp.getCI()->getLangOpts().Modules)
1198 cling::Interpreter::PushTransactionRAII deserRAII(&clingInterp);
1216 LoadModule(
"_Builtin_intrinsics", clingInterp);
1220 std::vector<std::string> CoreModules = {
"ROOT_Foundation_C",
1223 "ROOT_Foundation_Stage1_NoRTTI",
1232 std::vector<std::string> CommonModules = {
"MathCore"};
1238 std::vector<std::string> FIXMEModules = {
"Hist"};
1239 clang::CompilerInstance &CI = *clingInterp.getCI();
1240 clang::Preprocessor &PP = CI.getPreprocessor();
1241 ModuleMap &MMap = PP.getHeaderSearchInfo().getModuleMap();
1242 if (MMap.findModule(
"RInterface"))
1243 FIXMEModules.push_back(
"RInterface");
1247 GlobalModuleIndex *GlobalIndex =
nullptr;
1251 GlobalIndex = CI.getASTReader()->getGlobalIndex();
1253 llvm::StringSet<> KnownModuleFileNames;
1255 GlobalIndex->getKnownModuleFileNames(KnownModuleFileNames);
1257 std::vector<std::string> PendingModules;
1258 PendingModules.reserve(256);
1259 for (
auto I = MMap.module_begin(), E = MMap.module_end();
I != E; ++
I) {
1260 clang::Module *M =
I->second;
1264 std::string FullASTFilePath;
1268 if (GlobalIndex && KnownModuleFileNames.count(FullASTFilePath))
1271 if (M->IsUnimportable)
1279 if (std::find(CoreModules.begin(), CoreModules.end(), M->Name) != CoreModules.end())
1287 PendingModules.push_back(M->Name);
1294 assert(clingInterp.getMacro(
"gROOT") &&
"Couldn't load gROOT macro?");
1298 clingInterp.declare(R
"CODE(
1310 std::string PreIncludes;
1311 bool hasCxxModules = clingInterp.getCI()->getLangOpts().Modules;
1317 PreIncludes +=
"#include \"RtypesCore.h\"\n";
1320 PreIncludes +=
"#include \"Rtypes.h\"\n";
1322 PreIncludes += gClassDefInterpMacro +
"\n"
1323 + gInterpreterClassDef +
"\n"
1325 "#define ClassImp(X);\n";
1328 PreIncludes +=
"#include <string>\n";
1333 PreIncludes +=
"#include <cassert>\n";
1335 PreIncludes +=
"using namespace std;\n";
1336 clingInterp.declare(PreIncludes);
1356#ifdef R__USE_CXXMODULES
1360 llvm::install_fatal_error_handler(&exceptionErrorHandler);
1364 std::vector<std::string> clingArgsStorage;
1365 clingArgsStorage.push_back(
"cling4root");
1366 for (
const char*
const* arg = argv; *arg; ++arg)
1367 clingArgsStorage.push_back(*arg);
1370 if (!fromRootCling) {
1375 clingArgsStorage.push_back(
"-I" + interpInclude);
1378 clingArgsStorage.push_back(
"-I" + interpInclude +
"/cling");
1381 clingArgsStorage.push_back(
"-I" + interpInclude +
"/cling/plugins/include");
1392 std::string pchFilename = interpInclude +
"/allDict.cxx.pch";
1397 clingArgsStorage.push_back(
"-include-pch");
1398 clingArgsStorage.push_back(pchFilename);
1401 clingArgsStorage.push_back(
"-Wno-undefined-inline");
1402 clingArgsStorage.push_back(
"-fsigned-char");
1407 clingArgsStorage.push_back(
"-O1");
1410 clingArgsStorage.push_back(
"-mllvm");
1411 clingArgsStorage.push_back(
"-optimize-regalloc=0");
1416 std::optional<std::string> EnvOpt = llvm::sys::Process::GetEnv(
"EXTRA_CLING_ARGS");
1417 if (EnvOpt.has_value()) {
1418 StringRef Env(*EnvOpt);
1419 while (!Env.empty()) {
1421 std::tie(Arg, Env) = Env.split(
' ');
1422 clingArgsStorage.push_back(Arg.str());
1426 auto GetEnvVarPath = [](
const std::string &EnvVar, std::vector<std::string> &Paths) {
1427 std::optional<std::string> EnvOpt = llvm::sys::Process::GetEnv(EnvVar);
1428 if (EnvOpt.has_value()) {
1429 StringRef Env(*EnvOpt);
1430 while (!Env.empty()) {
1433 if (std::find(Paths.begin(), Paths.end(), Arg.str()) == Paths.end())
1434 Paths.push_back(Arg.str());
1440 std::vector<std::string> Paths;
1445 GetEnvVarPath(
"CLING_PREBUILT_MODULE_PATH", Paths);
1446 std::string EnvVarPath;
1447 for (
const std::string& P : Paths)
1450 gSystem->
Setenv(
"CLING_PREBUILT_MODULE_PATH", EnvVarPath.c_str());
1454 EnvOpt = llvm::sys::Process::GetEnv(
"ROOT_CLING_TIMING");
1455 if (EnvOpt.has_value())
1456 clingArgsStorage.push_back(
"-ftime-report");
1463 std::vector<std::string> ModuleMaps;
1466 GetEnvVarPath(
"CLING_MODULEMAP_FILES", ModuleMaps);
1470 if (llvm::sys::fs::exists(cwd + ModuleMapSuffix))
1471 ModuleMaps.push_back(cwd + ModuleMapSuffix);
1473 for (
const std::string& M : ModuleMaps)
1474 clingArgsStorage.push_back(
"-fmodule-map-file=" + M);
1476 std::string ModulesCachePath;
1477 EnvOpt = llvm::sys::Process::GetEnv(
"CLING_MODULES_CACHE_PATH");
1478 if (EnvOpt.has_value()){
1479 StringRef Env(*EnvOpt);
1480 assert(llvm::sys::fs::exists(Env) &&
"Path does not exist!");
1481 ModulesCachePath = Env.str();
1486 clingArgsStorage.push_back(
"-fmodules-cache-path=" + ModulesCachePath);
1489 std::vector<const char*> interpArgs;
1490 for (std::vector<std::string>::const_iterator iArg = clingArgsStorage.begin(),
1491 eArg = clingArgsStorage.end(); iArg != eArg; ++iArg)
1492 interpArgs.push_back(iArg->c_str());
1499 if (!fromRootCling) {
1501 interpArgs.push_back(
"-fmodules");
1502 interpArgs.push_back(
"-fno-implicit-module-maps");
1506 interpArgs.push_back(
"-Rmodule-build");
1512 interpArgs.push_back(
"-fno-autolink");
1517 interpArgs.push_back(
"-ffast-math");
1523 extraArgs && *extraArgs; ++extraArgs) {
1524 if (!strcmp(*extraArgs,
"-resource-dir")) {
1526 llvmResourceDir = *(++extraArgs);
1528 interpArgs.push_back(*extraArgs);
1532 std::vector<std::string> _empty;
1534 for (
const auto &arg: args)
1535 interpArgs.emplace_back(arg.c_str());
1538 cling::Interpreter::ModuleFileExtensions extensions;
1539 EnvOpt = llvm::sys::Process::GetEnv(
"ROOTDEBUG_RDICT");
1540 if (!EnvOpt.has_value())
1541 extensions.push_back(std::make_shared<TClingRdictModuleFileExtension>());
1543 fInterpreter = std::make_unique<cling::Interpreter>(interpArgs.size(),
1545 llvmResourceDir, extensions,
1549 fInterpreter->getCI()->getPreprocessorOpts().DisablePCHOrModuleValidation =
1550 DisableValidationForModuleKind::All;
1554 fInterpreter->getCI()->getLangOpts().SpellChecking =
false;
1557 auto isModulesArg = [](
const char* arg) {
return !strcmp(arg,
"-fmodules"); };
1558 bool hasModulesArg = std::find_if(interpArgs.begin(), interpArgs.end(), isModulesArg) != interpArgs.end();
1559 fInterpreter->getCI()->getLangOpts().Modules = hasModulesArg;
1564 static llvm::raw_fd_ostream fMPOuts (STDOUT_FILENO,
false);
1584 if (!fromRootCling) {
1589 fInterpreter->getRuntimeOptions().AllowRedefinition = 1;
1590 auto &Policy =
const_cast<clang::PrintingPolicy &
>(
fInterpreter->getCI()->getASTContext().getPrintingPolicy());
1594 Policy.SplitTemplateClosers =
true;
1596 Policy.SuppressDefaultTemplateArgs =
false;
1602 std::unique_ptr<TClingCallbacks>
1608 if (!fromRootCling) {
1609 cling::DynamicLibraryManager& DLM = *
fInterpreter->getDynamicLibraryManager();
1614 auto ShouldPermanentlyIgnore = [](llvm::StringRef FileName) ->
bool{
1615 llvm::StringRef stem = llvm::sys::path::stem(FileName);
1616 return stem.startswith(
"libNew") || stem.startswith(
"libcppyy_backend");
1619 DLM.initializeDyld(ShouldPermanentlyIgnore);
1657 assert(
GetRootMapFiles() ==
nullptr &&
"Must be called before LoadLibraryMap!");
1676 auto setFactory = []() {
1680 static bool doneFactory = setFactory();
1692 if (llvm::sys::fs::exists(pcmFileNameFullPath)) {
1693 ::Error(
"TCling::RegisterRdictForLoadPCM",
"Rdict '%s' is both in Module extension and in File system.", pcmFileNameFullPath.c_str());
1710 if (listOfKeys && ((listOfKeys->GetSize() == 0) ||
1711 ((listOfKeys->GetSize() == 1) &&
1712 !strcmp(((
TKey *)listOfKeys->At(0))->GetName(),
"EMPTY")
1719 ::Info(
"TCling::LoadPCMImpl",
"reading protoclasses for %s \n", pcmFile.
GetName());
1725 auto listOfGlobals =
gROOT->GetListOfGlobals();
1726 auto listOfEnums =
dynamic_cast<THashList *
>(
gROOT->GetListOfEnums());
1728 for (
auto selEnum : *enums) {
1729 const char *enumScope = selEnum->
GetTitle();
1730 const char *enumName = selEnum->GetName();
1731 if (strcmp(enumScope,
"") == 0) {
1734 if (!listOfEnums->THashList::FindObject(enumName)) {
1735 ((
TEnum *)selEnum)->SetClass(
nullptr);
1736 listOfEnums->Add(selEnum);
1738 for (
auto enumConstant : *
static_cast<TEnum *
>(selEnum)->GetConstants()) {
1739 if (!listOfGlobals->FindObject(enumConstant)) {
1740 listOfGlobals->Add(enumConstant);
1747 if (!nsTClassEntry) {
1750 auto listOfEnums = nsTClassEntry->
fEnums.load();
1761 if (listOfEnums && !listOfEnums->THashList::FindObject(enumName)) {
1762 ((
TEnum *)selEnum)->SetClass(nsTClassEntry);
1763 listOfEnums->Add(selEnum);
1771 pcmFile.
GetObject(
"__ProtoClasses", protoClasses);
1774 for (
auto obj : *protoClasses) {
1784 for (
auto proto : *protoClasses) {
1792 ::Error(
"TCling::LoadPCM",
"Inconsistent TClassTable for %s",
proto->GetName());
1803 protoClasses->
Clear();
1804 delete protoClasses;
1808 pcmFile.
GetObject(
"__Typedefs", dataTypes);
1810 for (
auto typedf : *dataTypes)
1811 gROOT->GetListOfTypes()->Add(typedf);
1824 assert(!pcmFileNameFullPath.empty());
1825 assert(llvm::sys::path::is_absolute(pcmFileNameFullPath));
1828 TString pcmFileName = pcmFileNameFullPath;
1836 llvm::SaveAndRestore<Int_t> SaveGDebug(
gDebug);
1839 ::Info(
"TCling::LoadPCM",
"Loading ROOT PCM %s", pcmFileName.
Data());
1844 if (llvm::sys::fs::is_symlink_file(pcmFileNameFullPath))
1849 llvm::StringRef pcmContent = pendingRdict->second;
1851 std::string RDictFileOpts = pcmFileNameFullPath +
"?filetype=pcm";
1852 TMemFile pcmMemFile(RDictFileOpts.c_str(), range);
1867 if (!llvm::sys::fs::exists(pcmFileNameFullPath)) {
1868 ::Error(
"TCling::LoadPCM",
"ROOT PCM %s file does not exist",
1869 pcmFileNameFullPath.data());
1872 ::Info(
"TCling::LoadPCM",
"In-memory ROOT PCM candidate %s\n",
1873 rdict.first.c_str());
1877 if (!
gROOT->IsRootFile(pcmFileName)) {
1878 Fatal(
"LoadPCM",
"The file %s is not a ROOT as was expected\n", pcmFileName.
Data());
1881 TFile pcmFile(pcmFileName +
"?filetype=pcm",
"READ");
1888 using namespace clang;
1890 class ExtLexicalStorageAdder:
public RecursiveASTVisitor<ExtLexicalStorageAdder>{
1895 bool VisitRecordDecl(clang::RecordDecl* rcd){
1897 Info(
"ExtLexicalStorageAdder",
1898 "Adding external lexical storage to class %s",
1899 rcd->getNameAsString().c_str());
1900 auto reDeclPtr = rcd->getMostRecentDecl();
1902 reDeclPtr->setHasExternalLexicalStorage();
1903 }
while ((reDeclPtr = reDeclPtr->getPreviousDecl()));
1916 const std::string &ModuleMapName )
const
1918 assert(llvm::sys::path::is_absolute(FullPath));
1919 Preprocessor &PP =
fInterpreter->getCI()->getPreprocessor();
1920 FileManager &FM = PP.getFileManager();
1923 if (
auto DE = FM.getOptionalDirectoryRef(FullPath)) {
1924 HeaderSearch &HS = PP.getHeaderSearchInfo();
1925 HeaderSearchOptions &HSOpts = HS.getHeaderSearchOpts();
1926 const auto &ModPaths = HSOpts.PrebuiltModulePaths;
1927 bool pathExists = std::find(ModPaths.begin(), ModPaths.end(), FullPath) != ModPaths.end();
1929 HSOpts.AddPrebuiltModulePath(FullPath);
1934 llvm::SmallString<256> ModuleMapFileName(DE->getName());
1935 llvm::sys::path::append(ModuleMapFileName, ModuleMapName);
1936 if (
auto FE = FM.getOptionalFileRef(ModuleMapFileName,
false,
1938 if (!HS.loadModuleMapFile(*FE,
false))
1940 Error(
"RegisterPrebuiltModulePath",
"Could not load modulemap in %s", ModuleMapFileName.c_str());
1957 "libforward_listDict",
1965 "libunordered_setDict",
1966 "libunordered_multisetDict",
1967 "libunordered_mapDict",
1968 "libunordered_multimapDict",
1976 char dyLibError[1000];
1977 FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
1978 dyLibError,
sizeof(dyLibError), NULL);
1980 const char *dyLibError = dlerror();
1982 ::Error(
"TCling::RegisterModule",
"Cannot open shared library %s for dictionary %s:\n %s", dyLibName, modulename,
1983 (dyLibError) ? dyLibError :
"");
2020 const char** headers,
2021 const char** includePaths,
2022 const char* payloadCode,
2023 const char* fwdDeclsCode,
2024 void (*triggerFunc)(),
2026 const char** classesHeaders,
2027 Bool_t lateRegistration ,
2034 if (fromRootCling)
return;
2043 bool isACLiC = strstr(modulename,
"_ACLiC_dict") !=
nullptr;
2044 if (hasHeaderParsingOnDemand && isACLiC) {
2046 Info(
"TCling::RegisterModule",
2047 "Header parsing on demand is active but this is an Aclic library. Disabling it for this library.");
2048 hasHeaderParsingOnDemand =
false;
2062 for (
const char** inclPath = includePaths; *inclPath; ++inclPath) {
2065 cling::Transaction* T =
nullptr;
2067 for (
auto& fwdDeclArgToSkipPair : fwdDeclsArgToSkip){
2068 const std::string& fwdDecl = fwdDeclArgToSkipPair.first;
2069 const int nArgsToSkip = fwdDeclArgToSkipPair.second;
2070 auto compRes =
fInterpreter->declare(fwdDecl.c_str(), &T);
2071 assert(cling::Interpreter::kSuccess == compRes &&
2072 "A fwd declaration could not be compiled");
2073 if (compRes!=cling::Interpreter::kSuccess){
2074 Warning(
"TCling::RegisterModule",
2075 "Problems in declaring string '%s' were encountered.",
2090 TString code = gNonInterpreterClassDef;
2092 code += payloadCode;
2094 std::string dyLibName = cling::DynamicLibraryManager::getSymbolLocation(triggerFunc);
2095 assert(!llvm::sys::fs::is_symlink_file(dyLibName));
2097 if (dyLibName.empty()) {
2098 ::Error(
"TCling::RegisterModule",
"Dictionary trigger function for %s not found", modulename);
2103 bool isSharedLib = cling::DynamicLibraryManager::isSharedLibrary(dyLibName);
2105 bool wasDlopened =
false;
2110 if (!lateRegistration) {
2117 void* dyLibHandle = dlopen(dyLibName.c_str(), RTLD_LAZY | RTLD_GLOBAL);
2127 if (hasHeaderParsingOnDemand && fwdDeclsCode){
2130 std::string fwdDeclsCodeLessEnums;
2134 std::string fwdDeclsLine;
2135 std::istringstream fwdDeclsCodeStr(fwdDeclsCode);
2136 std::vector<std::string> scopes;
2137 while (std::getline(fwdDeclsCodeStr, fwdDeclsLine)) {
2138 const auto enumPos = fwdDeclsLine.find(
"enum __attribute__((annotate(\"");
2140 if (enumPos != std::string::npos) {
2147 auto nsPos = fwdDeclsLine.find(
"namespace");
2148 R__ASSERT(nsPos < enumPos &&
"Inconsistent enum and enclosing scope parsing!");
2149 while (nsPos < enumPos && nsPos != std::string::npos) {
2151 const auto nsNameStart = nsPos + 10;
2152 const auto nsNameEnd = fwdDeclsLine.find(
'{', nsNameStart);
2153 const auto nsName = fwdDeclsLine.substr(nsNameStart, nsNameEnd - nsNameStart);
2154 scopes.push_back(nsName);
2155 nsPos = fwdDeclsLine.find(
"namespace", nsNameEnd);
2158 clang::DeclContext* DC =
nullptr;
2159 for (
auto &&aScope: scopes) {
2160 DC = cling::utils::Lookup::Namespace(&
fInterpreter->getSema(), aScope.c_str(), DC);
2166 if (scopes.empty() || DC) {
2170 size_t posEnumName = fwdDeclsLine.rfind(
"\"))) ");
2171 R__ASSERT(posEnumName != std::string::npos &&
"Inconsistent enum fwd decl!");
2173 while (isspace(fwdDeclsLine[posEnumName]))
2175 size_t posEnumNameEnd = fwdDeclsLine.find(
" : ", posEnumName);
2176 R__ASSERT(posEnumNameEnd != std::string::npos &&
"Inconsistent enum fwd decl (end)!");
2177 while (isspace(fwdDeclsLine[posEnumNameEnd]))
2181 std::string enumName = fwdDeclsLine.substr(posEnumName,
2182 posEnumNameEnd - posEnumName + 1);
2184 if (clang::NamedDecl* enumDecl
2185 = cling::utils::Lookup::Named(&
fInterpreter->getSema(),
2186 enumName.c_str(), DC)) {
2189 R__ASSERT(llvm::dyn_cast<clang::EnumDecl>(enumDecl) &&
"not an enum decl!");
2196 fwdDeclsCodeLessEnums += fwdDeclsLine +
"\n";
2200 if (!fwdDeclsCodeLessEnums.empty()){
2201 auto compRes =
fInterpreter->declare(fwdDeclsCodeLessEnums, &T);
2202 assert(cling::Interpreter::kSuccess == compRes &&
2203 "The forward declarations could not be compiled");
2204 if (compRes!=cling::Interpreter::kSuccess){
2205 Warning(
"TCling::RegisterModule",
2206 "Problems in compiling forward declarations for module %s: '%s'",
2207 modulename, fwdDeclsCodeLessEnums.c_str()) ;
2215 ExtLexicalStorageAdder elsa;
2216 for (
auto dciIt = T->decls_begin();dciIt!=T->decls_end();dciIt++){
2217 cling::Transaction::DelayCallInfo& dci = *dciIt;
2218 for(
auto dit = dci.m_DGR.begin(); dit != dci.m_DGR.end(); ++dit) {
2219 clang::Decl* declPtr = *dit;
2220 elsa.TraverseDecl(declPtr);
2234 for (
const char** classesHeader = classesHeaders; *classesHeader; ++classesHeader) {
2235 temp=*classesHeader;
2237 size_t theTemplateHash = 0;
2238 bool addTemplate =
false;
2239 size_t posTemplate = temp.find(
'<');
2240 if (posTemplate != std::string::npos) {
2242 std::string templateName = temp.substr(0, posTemplate);
2248 for (
const char** classesHeader_inner = classesHeader; 0!=strcmp(*classesHeader_inner,
"@"); ++classesHeader_inner,++classesHeader){
2250 if (payloadCode == *classesHeader_inner ){
2252 if (addTemplate)
fPayloads.insert(theTemplateHash);
2255 Info(
"TCling::RegisterModule",
2256 "Adding a header for %s", temp.c_str());
2262 addTemplate =
false;
2270 bool ModuleWasSuccessfullyLoaded =
false;
2272 std::string ModuleName = modulename;
2273 if (llvm::StringRef(modulename).startswith(
"lib"))
2274 ModuleName = llvm::StringRef(modulename).substr(3).str();
2279 clang::Preprocessor &PP = TheSema.getPreprocessor();
2280 std::string ModuleMapName;
2282 ModuleMapName = ModuleName +
".modulemap";
2284 ModuleMapName =
"module.modulemap";
2292 if (!ModuleWasSuccessfullyLoaded) {
2294 clang::HeaderSearch &headerSearch = PP.getHeaderSearchInfo();
2295 clang::ModuleMap &moduleMap = headerSearch.getModuleMap();
2296 if (moduleMap.findModule(ModuleName))
2297 Info(
"TCling::RegisterModule",
"Module %s in modulemap failed to load.", ModuleName.c_str());
2302 llvm::SmallString<256> pcmFileNameFullPath(dyLibName);
2305 llvm::sys::fs::make_absolute(pcmFileNameFullPath);
2306 llvm::sys::path::remove_filename(pcmFileNameFullPath);
2307 llvm::sys::path::append(pcmFileNameFullPath,
2309 LoadPCM(pcmFileNameFullPath.str().str());
2316 clangDiagSuppr diagSuppr(TheSema.getDiagnostics());
2318#if defined(R__MUST_REVISIT)
2319#if R__MUST_REVISIT(6,2)
2320 Warning(
"TCling::RegisterModule",
"Diagnostics suppression should be gone by now.");
2324 if (!ModuleWasSuccessfullyLoaded && !hasHeaderParsingOnDemand){
2327 const cling::Transaction* watermark =
fInterpreter->getLastTransaction();
2328 cling::Interpreter::CompilationResult compRes =
fInterpreter->parseForModule(code.
Data());
2334 assert(cling::Interpreter::kSuccess == compRes &&
2335 "Payload code of a dictionary could not be parsed correctly.");
2336 if (compRes!=cling::Interpreter::kSuccess) {
2337 Warning(
"TCling::RegisterModule",
2338 "Problems declaring payload for module %s.", modulename) ;
2351 if (!ModuleWasSuccessfullyLoaded && !hasHeaderParsingOnDemand) {
2354 "#undef __ROOTCLING__\n"
2355 + gInterpreterClassDef +
2360 assert(isSharedLib);
2363 dlclose(dyLibHandle);
2369 ASTContext &C = CI.getASTContext();
2377 if (IdentifierInfoLookup *External = C.Idents.getExternalIdentifierLookup()) {
2378 std::unique_ptr<IdentifierIterator> Iter(External->getIdentifiers());
2379 for (llvm::StringRef Ident = Iter->Next(); !Ident.empty(); Ident = Iter->Next()) {
2380 std::string
I = Ident.str();
2404 typedef std::vector<std::pair<TClass*,DictFuncPtr_t> >::iterator iterator;
2410 if ( i->first == oldcl ) {
2433 const char* input_line,
2434 cling::Interpreter::CompilationResult& compRes,
2438 return metaProcessor->process(input_line, compRes,
result);
2440 catch (cling::InterpreterException&
ex)
2442 Error(
"HandleInterpreterException",
"%s\n%s",
ex.what(),
"Execution of your code was aborted.");
2444 compRes = cling::Interpreter::kFailure;
2453 if (
auto ie =
dynamic_cast<const cling::InterpreterException*
>(&
e)) {
2479 gROOT->SetLineIsProcessing();
2483 gROOT->SetLineHasBeenProcessed();
2496 gROOT->SetLineIsProcessing();
2498 struct InterpreterFlagsRAII {
2499 cling::Interpreter* fInterpreter;
2500 bool fWasDynamicLookupEnabled;
2502 InterpreterFlagsRAII(cling::Interpreter* interp):
2503 fInterpreter(interp),
2504 fWasDynamicLookupEnabled(interp->isDynamicLookupEnabled())
2506 fInterpreter->enableDynamicLookup(
true);
2508 ~InterpreterFlagsRAII() {
2509 fInterpreter->enableDynamicLookup(fWasDynamicLookupEnabled);
2510 gROOT->SetLineHasBeenProcessed();
2519 cling::Interpreter::CompilationResult compRes = cling::Interpreter::kSuccess;
2520 if (!strncmp(sLine.
Data(),
".L", 2) || !strncmp(sLine.
Data(),
".x", 2) ||
2521 !strncmp(sLine.
Data(),
".X", 2)) {
2529 aclicMode, arguments, io);
2530 if (aclicMode.
Length()) {
2532 R__ASSERT(aclicMode[0]==
'+' &&
"ACLiC mode must start with a +");
2534 if (aclicMode[1]==
'+') {
2540 compRes = cling::Interpreter::kFailure;
2542 if (strncmp(sLine.
Data(),
".L", 2) != 0) {
2545 if (arguments.
Length()==0) {
2554 mod_line =
function + arguments + io;
2560 size_t unnamedMacroOpenCurly;
2563 std::string codeline;
2566 std::ifstream in(fname, std::ifstream::binary);
2568 std::getline(in, codeline);
2569 code += codeline +
"\n";
2571 unnamedMacroOpenCurly
2572 = cling::utils::isUnnamedMacro(code,
fInterpreter->getCI()->getLangOpts());
2576 if (unnamedMacroOpenCurly != std::string::npos) {
2578 unnamedMacroOpenCurly);
2588 if (0!=strncmp(sLine.
Data(),
".autodict ",10) && sLine !=
".autodict") {
2593 bool isInclusionDirective = sLine.
Contains(
"\n#include") || sLine.
BeginsWith(
"#include");
2594 if (isInclusionDirective) {
2611 case cling::Interpreter::kSuccess: *error =
kNoError;
break;
2612 case cling::Interpreter::kFailure: *error =
kRecoverable;
break;
2613 case cling::Interpreter::kMoreInputExpected: *error =
kProcessing;
break;
2616 if (compRes == cling::Interpreter::kSuccess
2647 if (path[0] ==
'-' && path[1] ==
'I')
2654 snprintf(drive, 3,
"%c:", _getdrive() +
'A' - 1);
2679 static const TClassRef clRefString(
"std::string");
2680 if (clRefString == cl) {
2690 const char* cobj = (
const char*) obj;
2697 auto inspInspect = [&] (ptrdiff_t
offset){
2703 switch(complexType) {
2710 inspInspect(
sizeof(
float));
2715 inspInspect(
sizeof(
double));
2720 inspInspect(
sizeof(
int));
2725 inspInspect(
sizeof(
long));
2730 static clang::PrintingPolicy
2732 if (printPol.Indentation) {
2734 printPol.Indentation = 0;
2735 printPol.SuppressInitializers =
true;
2738 const char* clname = cl->
GetName();
2741 const clang::ASTContext& astContext =
fInterpreter->getCI()->getASTContext();
2742 const clang::Decl *scopeDecl =
nullptr;
2743 const clang::Type *recordType =
nullptr;
2747 scopeDecl = clingCI->
GetDecl();
2748 recordType = clingCI->
GetType();
2750 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
2752 scopeDecl = lh.findScope(clname, cling::LookupHelper::NoDiagnostics,
2756 Error(
"InspectMembers",
"Cannot find Decl for class %s", clname);
2759 const clang::CXXRecordDecl* recordDecl
2760 = llvm::dyn_cast<const clang::CXXRecordDecl>(scopeDecl);
2762 Error(
"InspectMembers",
"Cannot find Decl for class %s is not a CXXRecordDecl.", clname);
2771 astContext.getASTRecordLayout(recordDecl);
2773 for (clang::RecordDecl::field_iterator iField = recordDecl->field_begin(),
2774 eField = recordDecl->field_end(); iField != eField; ++iField) {}
2777 const clang::ASTRecordLayout& recLayout
2778 = astContext.getASTRecordLayout(recordDecl);
2785 if (cl->
Size() != recLayout.getSize().getQuantity()) {
2786 Error(
"InspectMembers",
"TClass and cling disagree on the size of the class %s, respectively %d %lld\n",
2790 unsigned iNField = 0;
2793 for (clang::RecordDecl::field_iterator iField = recordDecl->field_begin(),
2794 eField = recordDecl->field_end(); iField != eField;
2795 ++iField, ++iNField) {
2798 clang::QualType memberQT = iField->getType();
2803 memberQT = cling::utils::Transform::GetPartiallyDesugaredType(astContext, memberQT,
fNormalizedCtxt->
GetConfig(),
false );
2804 if (memberQT.isNull()) {
2805 std::string memberName;
2806 llvm::raw_string_ostream stream(memberName);
2808 printPol.AnonymousTagLocations =
false;
2809 iField->getNameForDiagnostic(stream, printPol,
true );
2811 Error(
"InspectMembers",
2812 "Cannot retrieve QualType for member %s while inspecting class %s",
2813 memberName.c_str(), clname);
2816 const clang::Type* memType = memberQT.getTypePtr();
2818 std::string memberName;
2819 llvm::raw_string_ostream stream(memberName);
2821 printPol.AnonymousTagLocations =
false;
2822 iField->getNameForDiagnostic(stream, printPol,
true );
2824 Error(
"InspectMembers",
2825 "Cannot retrieve Type for member %s while inspecting class %s",
2826 memberName.c_str(), clname);
2830 const clang::Type* memNonPtrType = memType;
2831 Bool_t ispointer =
false;
2832 if (memNonPtrType->isPointerType()) {
2834 clang::QualType ptrQT
2835 = memNonPtrType->getAs<clang::PointerType>()->getPointeeType();
2840 ptrQT = cling::utils::Transform::GetPartiallyDesugaredType(astContext, ptrQT,
fNormalizedCtxt->
GetConfig(),
false );
2841 if (ptrQT.isNull()) {
2842 std::string memberName;
2843 llvm::raw_string_ostream stream(memberName);
2845 printPol.AnonymousTagLocations =
false;
2846 iField->getNameForDiagnostic(stream, printPol,
true );
2848 Error(
"InspectMembers",
2849 "Cannot retrieve pointee Type for member %s while inspecting class %s",
2850 memberName.c_str(), clname);
2853 memNonPtrType = ptrQT.getTypePtr();
2857 llvm::SmallString<8> arraySize;
2858 const clang::ArrayType* arrType = memNonPtrType->getAsArrayTypeUnsafe();
2859 unsigned arrLevel = 0;
2860 bool haveErrorDueToArray =
false;
2864 const clang::ConstantArrayType* constArrType =
2865 clang::dyn_cast<clang::ConstantArrayType>(arrType);
2867 constArrType->getSize().toStringUnsigned(arraySize);
2870 clang::QualType subArrQT = arrType->getElementType();
2871 if (subArrQT.isNull()) {
2872 std::string memberName;
2873 llvm::raw_string_ostream stream(memberName);
2875 printPol.AnonymousTagLocations =
false;
2876 iField->getNameForDiagnostic(stream, printPol,
true );
2878 Error(
"InspectMembers",
2879 "Cannot retrieve QualType for array level %d (i.e. element type of %s) for member %s while inspecting class %s",
2880 arrLevel, subArrQT.getAsString(printPol).c_str(),
2881 memberName.c_str(), clname);
2882 haveErrorDueToArray =
true;
2885 arrType = subArrQT.getTypePtr()->getAsArrayTypeUnsafe();
2887 if (haveErrorDueToArray) {
2892 std::string fieldName;
2893 if (memType->isPointerType()) {
2898 std::string ioname(iField->getName());
2900 fieldName += ioname;
2901 fieldName += arraySize;
2906 clang::CharUnits
offset(astContext.toCharUnitsFromBits(recLayout.getFieldOffset(iNField)));
2907 ptrdiff_t fieldOffset =
offset.getQuantity();
2917 auto iFiledQtype = iField->getType();
2918 if (
auto tagDecl = iFiledQtype->getAsTagDecl()){
2919 auto declAccess = tagDecl->getAccess();
2920 if (declAccess == AS_private || declAccess == AS_protected) {
2926 insp.
Inspect(
const_cast<TClass*
>(cl), insp.
GetParent(), fieldName.c_str(), cobj + fieldOffset, isTransient);
2929 const clang::CXXRecordDecl* fieldRecDecl = memNonPtrType->getAsCXXRecordDecl();
2930 if (fieldRecDecl && !fieldRecDecl->isAnonymousStructOrUnion()) {
2933 std::string sFieldRecName;
2936 clang::QualType(memNonPtrType,0),
2946 insp.
InspectMember(sFieldRecName.c_str(), cobj + fieldOffset,
2947 (fieldName +
'.').c_str(), transient);
2955 unsigned iNBase = 0;
2956 for (clang::CXXRecordDecl::base_class_const_iterator iBase
2957 = recordDecl->bases_begin(), eBase = recordDecl->bases_end();
2958 iBase != eBase; ++iBase, ++iNBase) {
2959 clang::QualType baseQT = iBase->getType();
2960 if (baseQT.isNull()) {
2961 Error(
"InspectMembers",
2962 "Cannot find QualType for base number %d while inspecting class %s",
2966 const clang::CXXRecordDecl* baseDecl
2967 = baseQT->getAsCXXRecordDecl();
2969 Error(
"InspectMembers",
2970 "Cannot find CXXRecordDecl for base number %d while inspecting class %s",
2975 std::string sBaseName;
2977 std::vector<TClass*> foundClasses;
2979 if (foundClasses.size()==1){
2980 baseCl=foundClasses[0];
2993 std::string qualNameForDiag;
2995 Error(
"InspectMembers",
2996 "Cannot find TClass for base class %s", qualNameForDiag.c_str() );
3001 if (iBase->isVirtual()) {
3004 Error(
"InspectMembers",
3005 "Base %s of class %s is virtual but no object provided",
3006 sBaseName.c_str(), clname);
3014 baseOffset = ci->
GetBaseOffset(baseCi,
const_cast<void*
>(obj),
3016 if (baseOffset == -1) {
3017 Error(
"InspectMembers",
3018 "Error calculating offset of virtual base %s of class %s",
3019 sBaseName.c_str(), clname);
3022 Error(
"InspectMembers",
3023 "Cannot calculate offset of virtual base %s of class %s",
3024 sBaseName.c_str(), clname);
3029 baseOffset = recLayout.getBaseClassOffset(baseDecl).getQuantity();
3076 bool oldDynLookup =
fInterpreter->isDynamicLookupEnabled();
3105 return fInterpreter->getDynamicLibraryManager()->isLibraryLoaded(tLibName.
Data());
3120 llvm::StringRef ModuleName(libname);
3121 ModuleName = llvm::sys::path::stem(ModuleName);
3122 ModuleName.consume_front(
"lib");
3130 clang::ModuleMap &moduleMap =
fInterpreter->getCI()->getPreprocessor().getHeaderSearchInfo().getModuleMap();
3131 clang::Module *M = moduleMap.findModule(ModuleName);
3132 return M && !M->IsUnimportable && M->getASTFile();
3151 size_t at = std::string::npos;
3152 while ((at = file_name.find(
"/./")) != std::string::npos)
3153 file_name.replace(at, 3,
"/");
3155 std::string filesStr =
"";
3156 llvm::raw_string_ostream filesOS(filesStr);
3157 clang::SourceManager &SM =
fInterpreter->getCI()->getSourceManager();
3158 cling::ClangInternalState::printIncludedFiles(filesOS, SM);
3161 llvm::SmallVector<llvm::StringRef, 100> files;
3162 llvm::StringRef(filesStr).split(files,
"\n");
3164 std::set<std::string> fileMap;
3165 llvm::StringRef file_name_ref(file_name);
3167 for (llvm::SmallVector<llvm::StringRef, 100>::const_iterator
3168 iF = files.begin(), iE = files.end(); iF != iE; ++iF) {
3169 if ((*iF) == file_name_ref)
return kTRUE;
3170 fileMap.insert(iF->str());
3173 if (fileMap.empty())
return kFALSE;
3176 TString sFilename(file_name.c_str());
3178 && fileMap.count(sFilename.
Data())) {
3186 while (incPath.
Index(
" :") != -1) {
3190 sFilename = file_name.c_str();
3192 && fileMap.count(sFilename.
Data())) {
3201 clang::ConstSearchDirIterator *CurDir =
nullptr;
3202 clang::Preprocessor &PP =
fInterpreter->getCI()->getPreprocessor();
3203 clang::HeaderSearch &HS = PP.getHeaderSearchInfo();
3204 auto FE = HS.LookupFile(file_name.c_str(),
3205 clang::SourceLocation(),
3208 clang::ArrayRef<std::pair<
const clang::FileEntry *,
3209 const clang::DirectoryEntry *>>(),
3222 clang::SourceManager &SM =
fInterpreter->getCI()->getSourceManager();
3224 clang::FileID FID = SM.translateFile(*FE);
3225 if (!FID.isInvalid() && FID.getHashValue() == 0)
3228 clang::SrcMgr::SLocEntry SLocE = SM.getSLocEntry(FID);
3229 if (SLocE.isFile() && !SLocE.getFile().getContentCache().getBufferIfLoaded())
3231 if (!FID.isInvalid())
3235 sFilename = FE->getName().str();
3237 && fileMap.count(sFilename.
Data())) {
3245#if defined(R__MACOSX)
3253static bool R__UpdateLibFileForLinking(
TString &lib)
3255 const char *mapfile =
nullptr;
3257 mapfile =
"/System/Library/dyld/dyld_shared_cache_x86_64.map";
3259 mapfile =
"/System/Library/dyld/dyld_shared_cache_arm64e.map";
3261 #error unsupported architecture
3263 if (std::ifstream cacheMap{mapfile}) {
3265 while (getline(cacheMap,
line)) {
3266 if (
line.find(lib) != std::string::npos) {
3278#if defined (R__LINUX) || defined (R__FBSD)
3284static int callback_for_dl_iterate_phdr(
struct dl_phdr_info *info,
size_t size,
void *
data)
3287 static std::unordered_set<
decltype(info->dlpi_addr)> sKnownLoadedLibBaseAddrs;
3289 auto newLibs =
static_cast<std::vector<std::string>*
>(
data);
3290 if (!sKnownLoadedLibBaseAddrs.count(info->dlpi_addr)) {
3292 if (info->dlpi_name && info->dlpi_name[0]
3297 && strncmp(info->dlpi_name,
"[vdso]", 6)
3301 && strncmp(info->dlpi_name,
"/libexec/ld-elf.so.1", 20)
3303 && strncmp(info->dlpi_name,
"linux-vdso.so", 13)
3304 && strncmp(info->dlpi_name,
"linux-vdso32.so", 15)
3305 && strncmp(info->dlpi_name,
"linux-vdso64.so", 15)
3306 && strncmp(info->dlpi_name,
"linux-gate.so", 13))
3307 newLibs->emplace_back(info->dlpi_name);
3308 sKnownLoadedLibBaseAddrs.insert(info->dlpi_addr);
3321#if defined(R__WIN32) || defined(__CYGWIN__)
3322 HMODULE hModules[1024];
3324 unsigned long cbModules;
3326 hProcess = (
void *)::GetCurrentProcess();
3327 ::EnumProcessModules(hProcess, hModules,
sizeof(hModules), &cbModules);
3329 for (i = 1; i < (cbModules /
sizeof(
void *)); i++) {
3330 static const int bufsize = 260;
3331 wchar_t winname[bufsize];
3332 char posixname[bufsize];
3333 ::GetModuleFileNameExW(hProcess, hModules[i], winname, bufsize);
3334#if defined(__CYGWIN__)
3335 cygwin_conv_path(CCP_WIN_W_TO_POSIX, winname, posixname, bufsize);
3337 std::wstring wpath = winname;
3338 std::replace(wpath.begin(), wpath.end(),
'\\',
'/');
3339 string path(wpath.begin(), wpath.end());
3340 strncpy(posixname, path.c_str(), bufsize);
3346#elif defined(R__MACOSX)
3350 while (
const mach_header* mh = _dyld_get_image_header(imageIndex)) {
3352 if (mh->filetype == MH_DYLIB) {
3353 if (
const char* imageName = _dyld_get_image_name(imageIndex)) {
3361#elif defined(R__LINUX) || defined(R__FBSD)
3365 std::vector<std::string> newLibs;
3366 dl_iterate_phdr(callback_for_dl_iterate_phdr, &newLibs);
3367 for (
auto &&lib: newLibs)
3370 Error(
"TCling::UpdateListOfLoadedSharedLibraries",
3371 "Platform not supported!");
3377static bool StartsWithStrLit(
const char *haystack,
const char (&needle)[
N]) {
3378 return !strncmp(haystack, needle,
N - 1);
3393 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
3394 if (!DLM->isLibraryLoaded(
filename)) {
3395 DLM->loadLibrary(
filename,
true ,
true );
3398#if defined(R__MACOSX)
3400 auto lenFilename = strlen(
filename);
3401 auto isInMacOSSystemDir = [](
const char *fn) {
3402 return StartsWithStrLit(fn,
"/usr/lib/") || StartsWithStrLit(fn,
"/System/Library/");
3404 if (!strcmp(
filename,
"cl_kernels")
3407 || StartsWithStrLit(
filename,
"/usr/lib/system/")
3408 || StartsWithStrLit(
filename,
"/usr/lib/libc++")
3409 || StartsWithStrLit(
filename,
"/System/Library/Frameworks/")
3410 || StartsWithStrLit(
filename,
"/System/Library/PrivateFrameworks/")
3411 || StartsWithStrLit(
filename,
"/System/Library/CoreServices/")
3412 || StartsWithStrLit(
filename,
"/usr/lib/libSystem")
3413 || StartsWithStrLit(
filename,
"/usr/lib/libstdc++")
3414 || StartsWithStrLit(
filename,
"/usr/lib/libicucore")
3415 || StartsWithStrLit(
filename,
"/usr/lib/libbsm")
3416 || StartsWithStrLit(
filename,
"/usr/lib/libobjc")
3417 || StartsWithStrLit(
filename,
"/usr/lib/libresolv")
3418 || StartsWithStrLit(
filename,
"/usr/lib/libauto")
3419 || StartsWithStrLit(
filename,
"/usr/lib/libcups")
3420 || StartsWithStrLit(
filename,
"/usr/lib/libDiagnosticMessagesClient")
3421 || StartsWithStrLit(
filename,
"/usr/lib/liblangid")
3422 || StartsWithStrLit(
filename,
"/usr/lib/libCRFSuite")
3423 || StartsWithStrLit(
filename,
"/usr/lib/libpam")
3424 || StartsWithStrLit(
filename,
"/usr/lib/libOpenScriptingUtil")
3425 || StartsWithStrLit(
filename,
"/usr/lib/libextension")
3426 || StartsWithStrLit(
filename,
"/usr/lib/libAudioToolboxUtility")
3427 || StartsWithStrLit(
filename,
"/usr/lib/liboah")
3428 || StartsWithStrLit(
filename,
"/usr/lib/libRosetta")
3429 || StartsWithStrLit(
filename,
"/usr/lib/libCoreEntitlements")
3430 || StartsWithStrLit(
filename,
"/usr/lib/libssl.")
3431 || StartsWithStrLit(
filename,
"/usr/lib/libcrypto.")
3437 || StartsWithStrLit(
filename,
"/usr/lib/system/libsystem_kernel")
3438 || StartsWithStrLit(
filename,
"/usr/lib/system/libsystem_platform")
3439 || StartsWithStrLit(
filename,
"/usr/lib/system/libsystem_pthread")
3444 || (lenFilename > 4 && !strcmp(
filename + lenFilename - 4,
".tbd")))
3447 R__UpdateLibFileForLinking(sFileName);
3449#elif defined(__CYGWIN__)
3451 static const int bufsize = 260;
3452 char posixwindir[bufsize];
3453 char *windir = getenv(
"WINDIR");
3455 cygwin_conv_path(CCP_WIN_A_TO_POSIX, windir, posixwindir, bufsize);
3457 snprintf(posixwindir,
sizeof(posixwindir),
"/Windows/");
3458 if (strstr(
filename, posixwindir) ||
3461#elif defined(R__WIN32)
3464#elif defined (R__LINUX)
3488 assert(!
IsFromRootCling() &&
"Trying to load library from rootcling!");
3492 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
3493 std::string canonLib = DLM->lookupLibrary(
filename);
3494 cling::DynamicLibraryManager::LoadLibResult res
3495 = cling::DynamicLibraryManager::kLoadLibNotFound;
3496 if (!canonLib.empty()) {
3498 res = DLM->loadLibrary(
filename, system,
true);
3502 cling::Interpreter::CompilationResult compRes;
3504 if (compRes == cling::Interpreter::kSuccess)
3505 res = cling::DynamicLibraryManager::kLoadLibSuccess;
3509 if (res == cling::DynamicLibraryManager::kLoadLibSuccess) {
3513 case cling::DynamicLibraryManager::kLoadLibSuccess:
return 0;
3514 case cling::DynamicLibraryManager::kLoadLibAlreadyLoaded:
return 1;
3564 Warning(
"Calc",
"waiting for cling thread to free");
3567 gROOT->SetLineIsProcessing();
3574 cling::Value valRef;
3575 cling::Interpreter::CompilationResult cr = cling::Interpreter::kFailure;
3579 catch (cling::InterpreterException&
ex)
3581 Error(
"Calc",
"%s.\n%s",
ex.what(),
"Evaluation of your expression was aborted.");
3583 cr = cling::Interpreter::kFailure;
3586 if (cr != cling::Interpreter::kSuccess) {
3594 if (!valRef.isValid()) {
3603 if (valRef.isVoid()) {
3610 gROOT->SetLineHasBeenProcessed();
3620 void (*histaddFunc)(
const char*
line))
3625#if defined(R__MUST_REVISIT)
3626#if R__MUST_REVISIT(6,2)
3627 Warning(
"SetGetline",
"Cling should support the equivalent of SetGetlineFunc(getlineFunc, histaddFunc)");
3640 if ((std::distance(T.decls_begin(), T.decls_end()) != 1)
3641 || T.deserialized_decls_begin() != T.deserialized_decls_end()
3642 || T.macros_begin() != T.macros_end()
3643 || ((!T.getFirstDecl().isNull()) && ((*T.getFirstDecl().begin()) != T.getWrapperFD()))) {
3666 std::set<TObject*>::iterator iSpecial = ((std::set<TObject*>*)
fgSetOfSpecials)->find(obj);
3684#if defined(R__MUST_REVISIT)
3685#if R__MUST_REVISIT(6,2)
3687 Warning(
"Reset",
"Cling should support the equivalent of scratch_upto(&fDictPos)");
3697#if defined(R__MUST_REVISIT)
3698#if R__MUST_REVISIT(6,2)
3700 Warning(
"ResetAll",
"Cling should support the equivalent of complete reset (unload everything but the startup decls.");
3727#if defined(R__MUST_REVISIT)
3728#if R__MUST_REVISIT(6,2)
3730 Warning(
"ResetGlobalVar",
"Cling should support the equivalent of resetglobalvar(obj)");
3742#if defined(R__MUST_REVISIT)
3743#if R__MUST_REVISIT(6,2)
3745 Warning(
"RewindDictionary",
"Cling should provide a way to revert transaction similar to rewinddictionary()");
3756#if defined(R__MUST_REVISIT)
3757#if R__MUST_REVISIT(6,2)
3759 Warning(
"DeleteGlobal",
"Cling should provide the equivalent of deleteglobal(obj), see also DeleteVariable.");
3771#if defined(R__MUST_REVISIT)
3772#if R__MUST_REVISIT(6,2)
3773 Warning(
"DeleteVariable",
"should do more that just reseting the value to zero");
3778 llvm::StringRef srName(
name);
3779 const char* unscopedName =
name;
3780 llvm::StringRef::size_type posScope = srName.rfind(
"::");
3781 const clang::DeclContext* declCtx =
nullptr;
3782 if (posScope != llvm::StringRef::npos) {
3783 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
3784 const clang::Decl* scopeDecl
3785 = lh.findScope(srName.substr(0, posScope),
3786 cling::LookupHelper::WithDiagnostics);
3788 Error(
"DeleteVariable",
"Cannot find enclosing scope for variable %s",
3792 declCtx = llvm::dyn_cast<clang::DeclContext>(scopeDecl);
3794 Error(
"DeleteVariable",
3795 "Enclosing scope for variable %s is not a declaration context",
3799 unscopedName += posScope + 2;
3803 clang::NamedDecl* nVarDecl
3804 = cling::utils::Lookup::Named(&
fInterpreter->getSema(), unscopedName, declCtx);
3806 Error(
"DeleteVariable",
"Unknown variable %s",
name);
3809 clang::VarDecl* varDecl = llvm::dyn_cast<clang::VarDecl>(nVarDecl);
3811 Error(
"DeleteVariable",
"Entity %s is not a variable",
name);
3815 clang::QualType qType = varDecl->getType();
3816 const clang::Type*
type = qType->getUnqualifiedDesugaredType();
3819 if (
type->isPointerType()) {
3820 int** ppInt = (
int**)
fInterpreter->getAddressOfGlobal(GlobalDecl(varDecl));
3822 if (ppInt) *ppInt =
nullptr;
3832#if defined(R__MUST_REVISIT)
3833#if R__MUST_REVISIT(6,2)
3835 Warning(
"SaveContext",
"Cling should provide a way to record a state watermark similar to store_dictposition(&fDictPos)");
3845#if defined(R__MUST_REVISIT)
3846#if R__MUST_REVISIT(6,2)
3848 Warning(
"SaveGlobalsContext",
"Cling should provide a way to record a watermark for the list of global variable similar to store_dictposition(&fDictPosGlobals)");
3896 std::tuple<int,double>
value;
3900 size_t offset0 = ((
char*)&(std::get<0>(
value))) - ((
char*)&
value);
3901 size_t offset1 = ((
char*)&(std::get<1>(
value))) - ((
char*)&
value);
3903 size_t ascOffset0 = ((
char*)&(asc.
_0)) - ((
char*)&asc);
3904 size_t ascOffset1 = ((
char*)&(asc.
_1)) - ((
char*)&asc);
3906 size_t desOffset0 = ((
char*)&(des.
_0)) - ((
char*)&des);
3907 size_t desOffset1 = ((
char*)&(des.
_1)) - ((
char*)&des);
3909 if (offset0 == ascOffset0 && offset1 == ascOffset1) {
3911 }
else if (offset0 == desOffset0 && offset1 == desOffset1) {
3918static std::string
AlternateTuple(
const char *classname,
const cling::LookupHelper& lh)
3921 std::string alternateName =
"TEmulatedTuple";
3922 alternateName.append( classname + 5 );
3924 std::string fullname =
"ROOT::Internal::" + alternateName;
3925 if (lh.findScope(fullname, cling::LookupHelper::NoDiagnostics,
3929 std::string guard_name;
3931 std::ostringstream guard;
3932 guard <<
"ROOT_INTERNAL_TEmulated_";
3933 guard << guard_name;
3935 std::ostringstream alternateTuple;
3936 alternateTuple <<
"#ifndef " << guard.str() <<
"\n";
3937 alternateTuple <<
"#define " << guard.str() <<
"\n";
3938 alternateTuple <<
"namespace ROOT { namespace Internal {\n";
3939 alternateTuple <<
"template <class... Types> struct TEmulatedTuple;\n";
3940 alternateTuple <<
"template <> struct " << alternateName <<
" {\n";
3945 unsigned int nMember = 0;
3946 auto iter = tupleContent.
fElements.begin() + 1;
3947 auto theEnd = tupleContent.
fElements.end() - 1;
3948 while (iter != theEnd) {
3949 alternateTuple <<
" " << *iter <<
" _" << nMember <<
";\n";
3956 unsigned int nMember = tupleContent.
fElements.size() - 3;
3957 auto iter = tupleContent.
fElements.rbegin() + 1;
3958 auto theEnd = tupleContent.
fElements.rend() - 1;
3959 while (iter != theEnd) {
3960 alternateTuple <<
" " << *iter <<
" _" << nMember <<
";\n";
3967 Fatal(
"TCling::SetClassInfo::AlternateTuple",
3968 "Layout of std::tuple on this platform is unexpected.");
3973 alternateTuple <<
"};\n";
3974 alternateTuple <<
"}}\n";
3975 alternateTuple <<
"#endif\n";
3977 Error(
"Load",
"Could not declare %s",alternateName.c_str());
3980 alternateName =
"ROOT::Internal::" + alternateName;
3981 return alternateName;
4021 auto SetWithoutClassInfoState = [](
TClass *cl)
4034 if (strncmp(cl->
GetName(),
"tuple<",strlen(
"tuple<"))==0) {
4037 if (reload ||
name.empty()) {
4039 SetWithoutClassInfoState(cl);
4051 SetWithoutClassInfoState(cl);
4068 zombieCandidate =
kTRUE;
4075 zombieCandidate =
kTRUE;
4129 static const char *anonEnum =
"anonymous enum ";
4130 static const int cmplen = strlen(anonEnum);
4157 const char *classname =
name;
4160 class MaybeSuspendAutoLoadParse {
4161 int fStoreAutoLoad = 0;
4162 int fStoreAutoParse = 0;
4163 bool fSuspendedAutoParse =
false;
4165 MaybeSuspendAutoLoadParse(
int autoload) {
4166 fStoreAutoLoad = ((
TCling*)
gCling)->SetClassAutoLoading(autoload);
4170 fSuspendedAutoParse =
true;
4171 fStoreAutoParse = ((
TCling*)
gCling)->SetSuspendAutoParsing(
true);
4174 ~MaybeSuspendAutoLoadParse() {
4175 if (fSuspendedAutoParse)
4176 ((
TCling*)
gCling)->SetSuspendAutoParsing(fStoreAutoParse);
4177 ((
TCling*)
gCling)->SetClassAutoLoading(fStoreAutoLoad);
4181 MaybeSuspendAutoLoadParse autoLoadParseRAII( autoload );
4183 autoLoadParseRAII.SuspendAutoParsing();
4192 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
4193 const clang::Type *
type =
nullptr;
4194 const clang::Decl *decl
4195 = lh.findScope(classname,
4196 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
4197 : cling::LookupHelper::NoDiagnostics,
4201 decl = lh.findScope(buf,
4202 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
4203 : cling::LookupHelper::NoDiagnostics,
4220 clang::ClassTemplateSpecializationDecl *tmpltDecl =
4221 llvm::dyn_cast_or_null<clang::ClassTemplateSpecializationDecl>
4222 (
type->getAsCXXRecordDecl());
4223 if (tmpltDecl && !tmpltDecl->getPointOfInstantiation().isValid()) {
4240 if (tci.
Property() & propertiesMask) {
4241 bool hasClassDefInline =
false;
4242 if (isClassOrNamespaceOnly) {
4248 if (hasDictionary.IsValid() && implLineFunc.IsValid()) {
4250 bool success =
false;
4251 std::tie(success, lineNumber) =
4253 hasClassDefInline = success && (lineNumber == -1);
4261 if (hasClassDefInline)
4300 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
4303 const clang::Decl *decl
4304 = lh.findClassTemplate(
name,
4305 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
4306 : cling::LookupHelper::NoDiagnostics);
4308 std::string strname =
"std::";
4310 decl = lh.findClassTemplate(strname,
4311 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
4312 : cling::LookupHelper::NoDiagnostics);
4314 return nullptr != decl;
4338 cl->
fBase = listOfBase;
4354 D =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
4357 if (
const clang::DeclContext* DC = dyn_cast<clang::DeclContext>(D)) {
4360 llvm::SmallVector< DeclContext *, 4> allDeclContexts;
4361 const_cast< clang::DeclContext *
>(DC)->collectAllContexts(allDeclContexts);
4362 for (llvm::SmallVector<DeclContext*, 4>::iterator declIter = allDeclContexts.begin(), declEnd = allDeclContexts.end();
4363 declIter != declEnd; ++declIter) {
4365 for (clang::DeclContext::decl_iterator DI = (*declIter)->decls_begin(),
4366 DE = (*declIter)->decls_end(); DI != DE; ++DI) {
4367 if (
const clang::EnumDecl* ED = dyn_cast<clang::EnumDecl>(*DI)) {
4370 PrintingPolicy Policy(ED->getASTContext().getPrintingPolicy());
4371 llvm::raw_string_ostream stream(buf);
4373 Policy.AnonymousTagLocations =
false;
4374 ED->getNameForDiagnostic(stream, Policy,
false);
4378 const char*
name = buf.c_str();
4402 D =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
4406 if (
const clang::DeclContext* DC = dyn_cast<clang::DeclContext>(D)) {
4409 llvm::SmallVector< DeclContext *, 4> allDeclContexts;
4410 const_cast< clang::DeclContext *
>(DC)->collectAllContexts(allDeclContexts);
4411 for (llvm::SmallVector<DeclContext*, 4>::iterator declIter = allDeclContexts.begin(),
4412 declEnd = allDeclContexts.end(); declIter != declEnd; ++declIter) {
4414 for (clang::DeclContext::decl_iterator DI = (*declIter)->decls_begin(),
4415 DE = (*declIter)->decls_end(); DI != DE; ++DI) {
4416 if (
const clang::FunctionTemplateDecl* FTD = dyn_cast<clang::FunctionTemplateDecl>(*DI)) {
4417 funcTempList->
Get(FTD);
4475 if (
m->fMethodArgs) {
4486 m->fMethodArgs = arglist;
4533 if (llvm::isa<clang::NamespaceDecl>(cli->
GetDecl())) {
4542 Error(
"GenerateTClass",
4543 "Cannot find %s::Class_Version()! Class version might be wrong.",
4550 if (newvers == -1) {
4558 newvers = callfunc.
ExecInt(
nullptr);
4560 Error(
"GenerateTClass",
4561 "Cannot invoke %s::Class_Version()! Class version might be wrong.",
4565 if (newvers != oldvers) {
4582static void GenerateTClass_GatherInnerIncludes(cling::Interpreter *interp,
TString &includes,
TClingClassInfo *info)
4586 const clang::ClassTemplateSpecializationDecl *templateCl
4587 = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(info->
GetDecl());
4589 for(
unsigned int i=0; i < templateCl->getTemplateArgs().
size(); ++i) {
4590 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
4591 if (arg.getKind() == clang::TemplateArgument::Type) {
4594 if (!uType->isFundamentalType() && !uType->isEnumeralType()) {
4596 const clang::CXXRecordDecl *argdecl = uType->getAsCXXRecordDecl();
4599 TClingClassInfo subinfo(interp,*(argdecl->getASTContext().getRecordType(argdecl).getTypePtr()));
4600 GenerateTClass_GatherInnerIncludes(interp, includes, &subinfo);
4603 llvm::raw_string_ostream OS(Result);
4604 arg.print(argdecl->getASTContext().getPrintingPolicy(),OS);
4605 Warning(
"TCling::GenerateTClass",
"Missing header file for %s",OS.str().c_str());
4620 if (!info || !info->
IsValid()) {
4621 Fatal(
"GenerateTClass",
"Requires a valid ClassInfo object");
4626 std::string classname;
4630 Info(
"GenerateTClass",
"Will (try to) generate the compiled TClass for %s.",classname.c_str());
4634 GenerateTClass_GatherInnerIncludes(
fInterpreter,includes,info);
4640 Error(
"GenerateTClass",
"Even though the dictionary generation for %s seemed successful we can't find the TClass bootstrap!",classname.c_str());
4644 if (cl ==
nullptr) {
4646 cl =
new TClass(classinfo, version,
nullptr,
nullptr, -1, -1, silent);
4652 cl =
new TClass(classinfo, 1,
nullptr,
nullptr, -1, -1, silent);
4677 if (classes ==
nullptr || classes[0] == 0) {
4678 Error(
"TCling::GenerateDictionary",
"Cannot generate dictionary without passing classes.");
4682 std::vector<std::string> listClasses;
4684 const char* current = classes, *prev = classes;
4688 if (*current ==
';') {
4689 listClasses.push_back(std::string(prev, current - prev));
4692 else if (*(current + 1) == 0) {
4693 listClasses.push_back(std::string(prev, current + 1 - prev));
4697 std::vector<std::string> listIncludes;
4701 const char* current = includes, *prev = includes;
4705 if (*current ==
';') {
4706 listIncludes.push_back(std::string(prev, current - prev));
4709 else if (*(current + 1) == 0) {
4710 listIncludes.push_back(std::string(prev, current + 1 - prev));
4716 std::vector<std::string>(), std::vector<std::string>());
4740 if (
const ValueDecl* decl = (
const ValueDecl*)
d){
4743 if (hasIoName && ioName !=
name)
return nullptr;
4755 using namespace clang;
4757 DeclarationName DName = &SemaR.Context.Idents.get(
name);
4759 LookupResult
R(SemaR, DName, SourceLocation(), Sema::LookupOrdinaryName,
4760 Sema::ForExternalRedeclaration);
4762 cling::utils::Lookup::Named(&SemaR,
R);
4764 LookupResult::Filter
F =
R.makeFilter();
4766 while (
F.hasNext()) {
4767 NamedDecl *D =
F.next();
4768 if (isa<VarDecl>(D) || isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) ||
4769 isa<IndirectFieldDecl>(D))
4775 if (
R.isSingleResult())
4776 return R.getFoundDecl();
4788 const clang::Decl* possibleEnum =
nullptr;
4793 const clang::DeclContext* dc =
nullptr;
4794 if (
const clang::Decl* D = cci->
GetDecl()) {
4795 if (!(dc = dyn_cast<clang::NamespaceDecl>(D))) {
4796 dc = dyn_cast<clang::RecordDecl>(D);
4803 possibleEnum = cling::utils::Lookup::Tag(&
fInterpreter->getSema(),
name, dc);
4805 Error(
"TCling::GetEnum",
"DeclContext not found for %s .\n",
name);
4814 if (possibleEnum && (possibleEnum != (clang::Decl*)-1)
4815 && isa<clang::EnumDecl>(possibleEnum)) {
4816 return possibleEnum;
4826 if (!gv)
return nullptr;
4828 llvm::StringRef mangled_name = gv->getName();
4843 std::string scopename(demangled_name_c);
4844 free(demangled_name_c);
4850 std::string dataname;
4852 if (!strncmp(scopename.c_str(),
"typeinfo for ",
sizeof(
"typeinfo for ")-1)) {
4853 scopename.erase(0,
sizeof(
"typeinfo for ")-1);
4854 }
else if (!strncmp(scopename.c_str(),
"vtable for ",
sizeof(
"vtable for ")-1)) {
4855 scopename.erase(0,
sizeof(
"vtable for ")-1);
4858 std::string::size_type pos = scopename.rfind(
'(');
4859 if (pos != std::string::npos) {
4863 pos = scopename.rfind(
':');
4864 if (pos != std::string::npos) {
4865 if ((pos != 0) && (scopename[pos-1] ==
':')) {
4866 dataname = scopename.substr(pos+1);
4867 scopename.erase(pos-1);
4871 dataname = scopename;
4879 if (scopename.size()) {
4895 Error(
"GetDataMemberWithValue()",
"not implemented");
4905 Error(
"GetDataMemberAtAddr()",
"not implemented");
4915 const char* params,
Bool_t objectIsConst )
4933 return mangled_name;
4948 GetMethod(method,
proto, objectIsConst,
nullptr ,
mode).GetMangledName();
4960 const char* params,
Bool_t objectIsConst )
5001 std::vector<DeclId_t>& res)
const
5004 clang::ASTContext& Ctx = S.Context;
5005 const clang::Decl* CtxDecl
5007 Ctx.getTranslationUnitDecl();
5008 auto RecDecl = llvm::dyn_cast<const clang::RecordDecl>(CtxDecl);
5009 const clang::DeclContext* DeclCtx = RecDecl;
5012 DeclCtx = dyn_cast<clang::NamespaceDecl>(CtxDecl);
5013 if (!DeclCtx)
return;
5015 clang::DeclarationName DName;
5020 if (RecDecl->getNameAsString() == funcname) {
5021 clang::QualType QT = Ctx.getTypeDeclType(RecDecl);
5022 DName = Ctx.DeclarationNames.getCXXConstructorName(Ctx.getCanonicalType(QT));
5023 }
else if (funcname[0] ==
'~' && RecDecl->getNameAsString() == funcname + 1) {
5024 clang::QualType QT = Ctx.getTypeDeclType(RecDecl);
5025 DName = Ctx.DeclarationNames.getCXXDestructorName(Ctx.getCanonicalType(QT));
5027 DName = &Ctx.Idents.get(funcname);
5030 DName = &Ctx.Idents.get(funcname);
5034 clang::LookupResult
R(S, DName, clang::SourceLocation(),
5035 Sema::LookupOrdinaryName, clang::Sema::NotForRedeclaration);
5036 R.suppressDiagnostics();
5037 S.LookupQualifiedName(
R,
const_cast<DeclContext*
>(DeclCtx));
5038 if (
R.empty())
return;
5040 res.reserve(res.size() + (
R.end() -
R.begin()));
5041 for (clang::LookupResult::iterator IR =
R.begin(), ER =
R.end();
5043 if (
const clang::FunctionDecl* FD
5044 = llvm::dyn_cast<const clang::FunctionDecl>(*IR)) {
5045 if (!FD->getDescribedFunctionTemplate()) {
5048 }
else if (
const auto *USD = llvm::dyn_cast<const clang::UsingShadowDecl>(*IR)) {
5050 if (llvm::isa<clang::FunctionDecl>(USD->getTargetDecl())) {
5071 GetMethod(method,
proto, objectIsConst,
nullptr ,
mode).InterfaceMethod();
5210 const char* params,
Bool_t objectIsConst,
int* error)
5230 const char* params,
int* error)
5232 Execute(obj,cl,method,params,
false,error);
5247 Error(
"Execute",
"No method was defined");
5256 if (argc > nparms) {
5257 Error(
"Execute",
"Too many parameters to call %s, got %d but expected at most %d.",method->
GetName(),argc,nparms);
5260 if (nparms != argc) {
5270 Int_t firstDefault = -1;
5271 for (
Int_t i = 0; i < nparms; i ++) {
5278 if (firstDefault >= 0) {
5279 Error(
"Execute",
"Too few arguments to call %s, got only %d but expected at least %d and at most %d.",method->
GetName(),argc,firstDefault,nparms);
5281 Error(
"Execute",
"Too few arguments to call %s, got only %d but expected %d.",method->
GetName(),argc,nparms);
5287 const char* listpar =
"";
5292 for (
Int_t i = 0; i < argc; i ++) {
5301 chpar += (nxtpar->
String()).ReplaceAll(
"\"",
"\\\"");
5308 complete += nxtpar->
String();
5311 listpar = complete.
Data();
5338 const void* args[] ,
5343 Error(
"ExecuteWithArgsAndReturn",
"No method was defined");
5370 Warning(
"GetTopLevelMacroName",
"Must change return type!");
5417#if defined(R__MUST_REVISIT)
5418#if R__MUST_REVISIT(6,0)
5419 Warning(
"GetCurrentMacroName",
"Must change return type!");
5432 TTHREAD_TLS_DECL(std::string,t);
5434 if (!strstr(typeDesc,
"(*)(")) {
5435 const char *s = strchr(typeDesc,
' ');
5436 const char *template_start = strchr(typeDesc,
'<');
5437 if (!strcmp(typeDesc,
"long long")) {
5440 else if (!strncmp(typeDesc,
"unsigned ", s + 1 - typeDesc)) {
5447 else if (s && (template_start ==
nullptr || (s < template_start))) {
5457 auto l = t.length();
5458 while (
l > 0 && (t[
l - 1] ==
'*' || t[
l - 1] ==
'&'))
5466 assert(rootmapfile && *rootmapfile);
5468 llvm::StringRef libName = llvm::sys::path::filename(rootmapfile);
5469 libName.consume_back(
".rootmap");
5471 return !
gInterpreter->HasPCMForLibrary(libName.str().c_str());
5482 if (!(rootmapfile && *rootmapfile))
5489 const std::map<char, unsigned int> keyLenMap = {{
'c',6},{
'n',10},{
't',8},{
'h',7},{
'e',5},{
'v',4}};
5491 std::string rootmapfileNoBackslash(rootmapfile);
5493 std::replace(rootmapfileNoBackslash.begin(), rootmapfileNoBackslash.end(),
'\\',
'/');
5500 std::string lineDirective = std::string(
"\n#line 2 \"Forward declarations from ") + rootmapfileNoBackslash +
"\"\n";
5502 std::ifstream file(rootmapfileNoBackslash);
5505 std::string lib_name;
5507 bool newFormat =
false;
5508 while (getline(file,
line,
'\n')) {
5509 if (!newFormat && (
line.compare(0, 8,
"Library.") == 0 ||
line.compare(0, 8,
"Declare.") == 0)) {
5515 if (
line.compare(0, 9,
"{ decls }") == 0) {
5518 while (getline(file,
line,
'\n')) {
5521 if (!uniqueString) {
5522 Error(
"ReadRootmapFile",
"Cannot handle \"{ decls }\" sections in custom rootmap file %s",
5523 rootmapfileNoBackslash.c_str());
5526 if (!lineDirective.empty())
5527 uniqueString->
Append(lineDirective);
5531 const char firstChar =
line[0];
5532 if (firstChar ==
'[') {
5534 auto brpos =
line.find(
']');
5535 if (brpos == string::npos)
5537 lib_name =
line.substr(1, brpos - 1);
5539 lib_name.erase(lib_name.find_last_not_of(
' ') + 1);
5540 lib_name.erase(0, lib_name.find_first_not_of(
' '));
5542 TString lib_nameTstr(lib_name.c_str());
5547 Info(
"ReadRootmapFile",
"%s: New section for %s", rootmapfile, lib_nameTstr.
Data());
5549 Info(
"ReadRootmapFile",
"%s: Section for %s (library does not exist)", rootmapfile, lib_nameTstr.
Data());
5555 auto keyLenIt = keyLenMap.find(firstChar);
5556 if (keyLenIt == keyLenMap.end())
5558 unsigned int keyLen = keyLenIt->second;
5560 const char *keyname =
line.c_str() + keyLen;
5562 Info(
"ReadRootmapFile",
"%s: class %s in %s", rootmapfile, keyname, lib_name.c_str());
5565 if (lib_name != isThere->
GetValue()) {
5566 if (firstChar ==
'n') {
5568 Info(
"ReadRootmapFile",
5569 "While processing %s, namespace %s was found to be associated to %s although it is already "
5571 rootmapfile, keyname, lib_name.c_str(), isThere->
GetValue());
5572 }
else if (firstChar ==
'h') {
5578 "While processing %s, %s %s was found to be associated to %s although it is already "
5580 rootmapfile,
line.substr(0, keyLen - 1).c_str(), keyname, lib_name.c_str(),
5585 Info(
"ReadRootmapFile",
"While processing %s, key %s was found to be already defined for %s",
5586 rootmapfile, keyname, lib_name.c_str());
5647 using namespace clang;
5649 class ExtVisibleStorageAdder:
public RecursiveASTVisitor<ExtVisibleStorageAdder>{
5655 ExtVisibleStorageAdder(std::unordered_set<const NamespaceDecl*>& nsSet): fNSSet(nsSet) {};
5656 bool VisitNamespaceDecl(NamespaceDecl* nsDecl) {
5661 nsDecl->setHasExternalVisibleStorage();
5662 fNSSet.insert(nsDecl);
5665 bool VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl* specDecl) {
5668 if (specDecl->getTemplateSpecializationKind() == TSK_ExplicitSpecialization)
5670 specDecl->setHasExternalLexicalStorage();
5682 std::unordered_set<const NamespaceDecl*>& fNSSet;
5729 for (
Int_t j = 0; j < i; j++) {
5740 Info(
"LoadLibraryMap",
"%s",
d.Data());
5745 if (
f.EndsWith(
".rootmap")) {
5751 Info(
"LoadLibraryMap",
" rootmap file: %s",
p.Data());
5769 if (
f.BeginsWith(
"rootmap")) {
5774 Warning(
"LoadLibraryMap",
"please rename %s to end with \".rootmap\"",
p.Data());
5787 if (rootmapfile && *rootmapfile) {
5794 else if (res == -3) {
5804 while ((rec = (
TEnvRec*) next())) {
5806 if (!strncmp(cls.
Data(),
"Library.", 8) && cls.
Length() > 8) {
5808 TString libs = rec->GetValue();
5825 Info(
"LoadLibraryMap",
"class %s in %s", cls.
Data(), wlib);
5828 Info(
"LoadLibraryMap",
"class %s in %s (library does not exist)", cls.
Data(), lib);
5834 else if (!strncmp(cls.
Data(),
"Declare.", 8) && cls.
Length() > 8) {
5844 cling::Transaction* T =
nullptr;
5846 assert(cling::Interpreter::kSuccess == compRes &&
"A declaration in a rootmap could not be compiled");
5848 if (compRes!=cling::Interpreter::kSuccess){
5850 "Problems in %s declaring '%s' were encountered.", rootmapfile, uniqueString.
Data()) ;
5855 for (
auto declIt = T->decls_begin(); declIt < T->decls_end(); ++declIt) {
5856 if (declIt->m_DGR.isSingleDecl()) {
5857 if (Decl* D = declIt->m_DGR.getSingleDecl()) {
5858 if (clang::isa<TagDecl>(D) || clang::isa<NamespaceDecl>(D)) {
5859 evsAdder.TraverseDecl(D);
5894 for (
Int_t ilib = 0; ilib < nrSharedLibs; ilib++) {
5901 TString rootMapBaseStr = sharedLibBaseStr;
5902 if (sharedLibBaseStr.
EndsWith(
".dll")) {
5905 else if (sharedLibBaseStr.
EndsWith(
".DLL")) {
5908 else if (sharedLibBaseStr.
EndsWith(
".so")) {
5911 else if (sharedLibBaseStr.
EndsWith(
".sl")) {
5914 else if (sharedLibBaseStr.
EndsWith(
".dl")) {
5917 else if (sharedLibBaseStr.
EndsWith(
".a")) {
5921 Error(
"ReloadAllSharedLibraryMaps",
"Unknown library type %s", sharedLibBaseStr.
Data());
5925 rootMapBaseStr +=
".rootmap";
5928 Error(
"ReloadAllSharedLibraryMaps",
"Could not find rootmap %s in path", rootMapBaseStr.
Data());
5935 Error(
"ReloadAllSharedLibraryMaps",
"Error loading map %s", rootMap);
5970 if (!
fMapfile || !library || !*library) {
5983 while ((rec = (
TEnvRec *) next())) {
5987 TString libs = rec->GetValue();
5994 if (!strncmp(cls.
Data(),
"Library.", 8) && cls.
Length() > 8) {
6003 if (!strncmp(lib, libname.
Data(),
len)) {
6005 Error(
"UnloadLibraryMap",
"entry for <%s, %s> not found in library map table", cls.
Data(), lib);
6013 TString library_rootmap(library);
6014 if (!library_rootmap.
EndsWith(
".rootmap"))
6015 library_rootmap.
Append(
".rootmap");
6066 if (err)
return nullptr;
6068 free(demangled_name);
6086 std::string demangled_name(demangled_name_c);
6087 free(demangled_name_c);
6119 if (
gROOT->LoadClass(cls, deplib) == 0) {
6122 "loaded dependent library %s for %s", deplib, cls);
6127 "failure loading dependent library %s for %s",
6132 if (lib && lib[0]) {
6133 if (
gROOT->LoadClass(cls, lib) == 0) {
6136 "loaded library %s for %s", lib, cls);
6142 "failure loading library %s for %s", lib, cls);
6157 bool nameIsNormalized)
6163 if (!visited.insert(std::string(cls)).second)
6173 for (
auto element :
proto->GetData()) {
6174 if (element->IsBasic())
6176 const char *subtypename = element->GetTypeName();
6192 if (classinfo &&
gInterpreter->ClassInfo_IsValid(classinfo)
6196 while (
gInterpreter->DataMemberInfo_Next(memberinfo)) {
6229 Info(
"TCling::AutoLoad",
"Explicitly disabled (the class name is %s)", cls);
6249 Info(
"TCling::AutoLoad",
6250 "Trying to autoload for %s", cls);
6255 Info(
"TCling::AutoLoad",
6256 "Disabled due to gROOT or gInterpreter being invalid/not ready (the class name is %s)", cls);
6277 std::unordered_set<std::string> visited;
6286 cling::Interpreter *interpreter)
6288 std::string code = gNonInterpreterClassDef ;
6295 code += (
"#include \"");
6299 code += (
"#ifdef __ROOTCLING__\n"
6300 "#undef __ROOTCLING__\n"
6301 + gInterpreterClassDef +
6304 cling::Interpreter::CompilationResult cr;
6310 Sema &SemaR = interpreter->getSema();
6312 clangDiagSuppr diagSuppr(SemaR.getDiagnostics());
6314 #if defined(R__MUST_REVISIT)
6315 #if R__MUST_REVISIT(6,2)
6316 Warning(
"TCling::RegisterModule",
"Diagnostics suppression should be gone by now.");
6320 cr = interpreter->parseForModule(code);
6338 Int_t nHheadersParsed = 0;
6339 unsigned long offset = 0;
6340 if (strncmp(cls,
"const ", 6) == 0) {
6345 bool skipFirstEntry =
false;
6346 std::vector<std::string> autoparseKeys;
6347 if (strchr(cls,
'<')) {
6353 if (!autoparseKeys.empty() && !autoparseKeys[0].empty()) {
6358 TString templateName(autoparseKeys[0]);
6359 auto tokens = templateName.
Tokenize(
"::");
6360 clang::NamedDecl* previousScopeAsNamedDecl =
nullptr;
6361 clang::DeclContext* previousScopeAsContext =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
6363 previousScopeAsContext =
fInterpreter->getSema().getStdNamespace();
6365 for (
Int_t tk = 0; tk < nTokens; ++tk) {
6366 auto scopeObj = tokens->UncheckedAt(tk);
6367 auto scopeName = ((
TObjString*) scopeObj)->String().Data();
6368 previousScopeAsNamedDecl = cling::utils::Lookup::Named(&
fInterpreter->getSema(), scopeName, previousScopeAsContext);
6370 if ((clang::NamedDecl*)-1 == previousScopeAsNamedDecl)
break;
6371 previousScopeAsContext = llvm::dyn_cast_or_null<clang::DeclContext>(previousScopeAsNamedDecl);
6372 if (!previousScopeAsContext)
break;
6376 if ((clang::NamedDecl*)-1 != previousScopeAsNamedDecl) {
6377 if (
auto templateDecl = llvm::dyn_cast_or_null<clang::ClassTemplateDecl>(previousScopeAsNamedDecl)) {
6378 if (
auto templatedDecl = templateDecl->getTemplatedDecl()) {
6379 skipFirstEntry = templatedDecl->hasDefinition();
6386 if (topLevel) autoparseKeys.emplace_back(cls);
6388 for (
const auto & apKeyStr : autoparseKeys) {
6389 if (skipFirstEntry) {
6390 skipFirstEntry=
false;
6393 if (apKeyStr.empty())
continue;
6394 const char *apKey = apKeyStr.c_str();
6398 Info(
"TCling::AutoParse",
6399 "Starting autoparse for %s\n", apKey);
6404 const cling::Transaction *T =
fInterpreter->getCurrentTransaction();
6406 auto const &hNamesPtrs = iter->second;
6408 Info(
"TCling::AutoParse",
6409 "We can proceed for %s. We have %s headers.", apKey, std::to_string(hNamesPtrs.size()).c_str());
6411 for (
auto & hName : hNamesPtrs) {
6413 if (0 !=
fPayloads.count(normNameHash)) {
6414 float initRSSval=0.f, initVSIZEval=0.f;
6416 (void) initVSIZEval;
6419 "Parsing full payload for %s", apKey);
6426 if (cRes != cling::Interpreter::kSuccess) {
6427 if (hName[0] ==
'\n')
6428 Error(
"AutoParse",
"Error parsing payload code for class %s with content:\n%s", apKey, hName);
6437 Info(
"Autoparse",
">>> RSS key %s - before %.3f MB - after %.3f MB - delta %.3f MB", apKey, initRSSval, endRSSval, endRSSval-initRSSval);
6438 Info(
"Autoparse",
">>> VSIZE key %s - before %.3f MB - after %.3f MB - delta %.3f MB", apKey, initVSIZEval, endVSIZEval, endVSIZEval-initVSIZEval);
6444 "Parsing single header %s", hName);
6447 if (cRes != cling::Interpreter::kSuccess) {
6448 Error(
"AutoParse",
"Error parsing headerfile %s for class %s.", hName, apKey);
6460 if (strchr(apKey,
'<')) {
6467 return nHheadersParsed;
6477 if (llvm::StringRef(cls).contains(
"(lambda)"))
6491 Info(
"TCling::AutoParse",
6492 "Trying to autoparse for %s", cls);
6514 return nHheadersParsed > 0 ? 1 : 0;
6522 StringRef errMsg(errmessage);
6523 if (errMsg.contains(
"undefined symbol: ")) {
6525 std::string mangled_name = std::string(errMsg.split(
"undefined symbol: ").second);
6526 void* res = ((
TCling*)
gCling)->LazyFunctionCreatorAutoload(mangled_name);
6527 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
6528 if (res && DLM && (DLM->loadLibrary(libStem, permanent, resolved) == cling::DynamicLibraryManager::kLoadLibSuccess))
6547 if (
void* Addr = llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(dlsym_mangled_name))
6550 const cling::DynamicLibraryManager &DLM = *
GetInterpreterImpl()->getDynamicLibraryManager();
6553 auto LibLoader = [](
const std::string& LibName) ->
bool {
6554 if (
gSystem->
Load(LibName.c_str(),
"",
false) < 0) {
6555 ::Error(
"TCling__LazyFunctionCreatorAutoloadForModule",
6556 "Failed to load library %s", LibName.c_str());
6562 std::string libName = DLM.searchLibrariesForSymbol(mangled_name,
6565 assert(!llvm::StringRef(libName).startswith(
"libNew") &&
6566 "We must not resolve symbols from libNew!");
6568 if (libName.empty())
6571 if (!LibLoader(libName))
6574 return llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(dlsym_mangled_name);
6594 const NamedDecl *oldDef = llvm::dyn_cast_or_null<NamedDecl>(cci->
GetDecl());
6595 if (!oldDef || (def && def != oldDef)) {
6609 if (!alias && def !=
nullptr)
6632 const TagDecl *td = dyn_cast<TagDecl>(ND);
6633 const NamespaceDecl *ns = dyn_cast<NamespaceDecl>(ND);
6634 const NamedDecl *canon =
nullptr;
6637 TagDecl* tdDef =
nullptr;
6639 canon = tdDef = td->getDefinition();
6643 if (!tdDef->isCompleteDefinition() || llvm::isa<clang::FunctionDecl>(tdDef->getDeclContext())) {
6649 auto declName = tdDef->getNameAsString();
6660 clang::QualType
type(tdDef->getTypeForDecl(), 0);
6663 canon = ns->getCanonicalDecl();
6664 name = ND->getQualifiedNameAsString();
6666 name = ND->getQualifiedNameAsString();
6715 std::set<TClass*> modifiedTClasses;
6720 bool isTUTransaction =
false;
6721 if (!T.empty() && T.decls_begin() + 1 == T.decls_end() && !T.hasNestedTransactions()) {
6722 clang::Decl* FirstDecl = *(T.decls_begin()->m_DGR.begin());
6723 if (llvm::isa<clang::TranslationUnitDecl>(FirstDecl)) {
6726 isTUTransaction =
true;
6730 std::set<const void*> TransactionDeclSet;
6731 if (!isTUTransaction && T.decls_end() - T.decls_begin()) {
6732 const clang::Decl* WrapperFD = T.getWrapperFD();
6733 for (cling::Transaction::const_iterator
I = T.decls_begin(), E = T.decls_end();
6735 if (
I->m_Call != cling::Transaction::kCCIHandleTopLevelDecl
6736 &&
I->m_Call != cling::Transaction::kCCIHandleTagDeclDefinition)
6739 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
6740 DE =
I->m_DGR.end(); DI != DE; ++DI) {
6741 if (*DI == WrapperFD)
6743 TransactionDeclSet.insert(*DI);
6744 ((
TCling*)
gCling)->HandleNewDecl(*DI,
false, modifiedTClasses);
6751 for (cling::Transaction::const_iterator
I = T.deserialized_decls_begin(),
6752 E = T.deserialized_decls_end();
I != E; ++
I) {
6753 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
6754 DE =
I->m_DGR.end(); DI != DE; ++DI)
6755 if (TransactionDeclSet.find(*DI) == TransactionDeclSet.end()) {
6771 std::vector<TClass*> modifiedTClassesDiff(modifiedTClasses.size());
6772 std::vector<TClass*>::iterator it;
6773 it = set_difference(modifiedTClasses.begin(), modifiedTClasses.end(),
6776 modifiedTClassesDiff.begin());
6777 modifiedTClassesDiff.resize(it - modifiedTClassesDiff.begin());
6780 ((
TCling*)
gCling)->GetModTClasses().insert(modifiedTClassesDiff.begin(),
6781 modifiedTClassesDiff.end());
6782 for (std::vector<TClass*>::const_iterator
I = modifiedTClassesDiff.begin(),
6783 E = modifiedTClassesDiff.end();
I != E; ++
I) {
6785 if (!
gROOT->GetListOfClasses()->FindObject(*
I)) {
6807 cling::Transaction::const_nested_iterator iNested = T.nested_begin();
6808 for (cling::Transaction::const_iterator
I = T.decls_begin(), E = T.decls_end();
6810 if (
I->m_Call == cling::Transaction::kCCIHandleVTable)
6812 if (
I->m_Call == cling::Transaction::kCCINone) {
6818 for (
auto &D :
I->m_DGR)
6844 if (D->isFromASTFile())
6852 if (isa<VarDecl>(D) || isa<FieldDecl>(D) || isa<EnumConstantDecl>(D)) {
6858 }
else if (isa<FunctionDecl>(D)) {
6860 }
else if (isa<FunctionTemplateDecl>(D)) {
6862 }
else if (isa<EnumDecl>(D)) {
6873 }
else if (isa<RecordDecl>(D) || isa<NamespaceDecl>(D)) {
6874 if (isa<RecordDecl>(D) && !cast<RecordDecl>(D)->isCompleteDefinition())
6877 std::vector<TClass *> Classes;
6880 for (
auto &C : Classes) {
6885 for (
auto &
I : cast<DeclContext>(D)->decls())
6889 if (D->getKind() != Decl::Namespace
6890 || cast<NamespaceDecl>(D)->isOriginalNamespace())
6891 C->ResetClassInfo();
6903 std::size_t normNameHash = triter->second;
6909 auto const &hNamesPtrs = iter->second;
6910 for (
auto &hName : hNamesPtrs) {
6912 Info(
"TransactionRollback",
6913 "Restoring ability to autoaparse: %s", hName);
6950 using namespace clang;
6951 if (
const Decl *D = LH.findScope(cls, cling::LookupHelper::NoDiagnostics,
6953 if (!D->isFromASTFile()) {
6955 Warning(
"GetClassSharedLibsForModule",
"Decl found for %s is not part of a module", cls);
6958 class ModuleCollector :
public ConstDeclVisitor<ModuleCollector> {
6959 llvm::DenseSet<Module *> &m_TopLevelModules;
6962 ModuleCollector(llvm::DenseSet<Module *> &TopLevelModules) : m_TopLevelModules(TopLevelModules) {}
6963 void Collect(
const Decl *D) { Visit(D); }
6965 void VisitDecl(
const Decl *D)
6975 if (!D->hasOwningModule())
6977 if (Module *M = D->getOwningModule()->getTopLevelModule())
6978 m_TopLevelModules.insert(M);
6981 void VisitTemplateArgument(
const TemplateArgument &
TA)
6983 switch (
TA.getKind()) {
6984 case TemplateArgument::Null:
6985 case TemplateArgument::Integral:
6986 case TemplateArgument::Pack:
6987 case TemplateArgument::NullPtr:
6988 case TemplateArgument::Expression:
6989 case TemplateArgument::Template:
6990 case TemplateArgument::TemplateExpansion:
return;
6991 case TemplateArgument::Type:
6992 if (
const TagType *TagTy = dyn_cast<TagType>(
TA.getAsType()))
6993 return Visit(TagTy->getDecl());
6995 case TemplateArgument::Declaration:
return Visit(
TA.getAsDecl());
6997 llvm_unreachable(
"Invalid TemplateArgument::Kind!");
7000 void VisitClassTemplateSpecializationDecl(
const ClassTemplateSpecializationDecl *CTSD)
7002 if (CTSD->getOwningModule())
7005 VisitDecl(CTSD->getSpecializedTemplate());
7006 const TemplateArgumentList &ArgList = CTSD->getTemplateArgs();
7007 for (
const TemplateArgument *Arg = ArgList.data(), *ArgEnd = Arg + ArgList.size(); Arg != ArgEnd; ++Arg) {
7008 VisitTemplateArgument(*Arg);
7013 llvm::DenseSet<Module *> TopLevelModules;
7014 ModuleCollector
m(TopLevelModules);
7017 for (
auto M : TopLevelModules) {
7020 if (!M->LinkLibraries.size())
7023 if (M->Name ==
"Core")
7025 assert(M->LinkLibraries.size() == 1);
7028 result += M->LinkLibraries[0].Library;
7049 llvm::StringRef className = cls;
7055 if (className.contains(
"(lambda)"))
7059 cling::LookupHelper &LH =
fInterpreter->getLookupHelper();
7061 if (!libs.empty()) {
7067 if (!cls || !*cls) {
7072 TEnvRec* libs_record =
nullptr;
7075 const char* libs = libs_record->
GetValue();
7076 return (*libs) ? libs :
nullptr;
7090 TEnvRec* libs_record =
nullptr;
7093 const char* libs = libs_record->
GetValue();
7094 return (*libs) ? libs :
nullptr;
7108 cling::Interpreter *interp,
7109 bool skipLoadedLibs =
true)
7112 if (!llvm::sys::path::is_absolute(lib)) {
7114 Error(
"TCling__GetSharedLibImmediateDepsSlow",
"Cannot find library '%s'", lib.c_str());
7118 assert(llvm::sys::fs::exists(lib) &&
"Must exist!");
7119 lib = llvm::sys::path::filename(lib).str();
7122 auto ObjF = llvm::object::ObjectFile::createObjectFile(LibFullPath.
Data());
7124 Warning(
"TCling__GetSharedLibImmediateDepsSlow",
"Failed to read object file %s", lib.c_str());
7128 llvm::object::ObjectFile *BinObjFile = ObjF.get().getBinary();
7130 std::set<string> DedupSet;
7131 std::string Result = lib +
' ';
7132 for (
const auto &S : BinObjFile->symbols()) {
7133 uint32_t Flags = llvm::cantFail(S.getFlags());
7135 if (!(Flags & llvm::object::SymbolRef::SF_Undefined))
7139 if (Flags & llvm::object::SymbolRef::SF_Weak)
7141 llvm::Expected<StringRef> SymNameErr = S.getName();
7143 Warning(
"GetSharedLibDepsForModule",
"Failed to read symbol");
7146 llvm::StringRef SymName = SymNameErr.get();
7147 if (SymName.empty())
7150 if (BinObjFile->isELF()) {
7154 if (SymName.contains(
"@GLIBCXX") || SymName.contains(
"@CXXABI") ||
7155 SymName.contains(
"@GLIBC") || SymName.contains(
"@GCC"))
7163 static constexpr llvm::StringRef RegisterClasses(
"_Jv_RegisterClasses");
7164 static constexpr llvm::StringRef RegisterCloneTable(
"_ITM_registerTMCloneTable");
7165 static constexpr llvm::StringRef DeregisterCloneTable(
"_ITM_deregisterTMCloneTable");
7166 if (SymName == RegisterClasses ||
7167 SymName == RegisterCloneTable ||
7168 SymName == DeregisterCloneTable)
7173 if (skipLoadedLibs) {
7175 if (llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(SymNameForDlsym))
7180 std::string found = interp->getDynamicLibraryManager()->searchLibrariesForSymbol(SymName,
false);
7186 if (!found.empty()) {
7187 std::string cand = llvm::sys::path::filename(found).str();
7188 if (!DedupSet.insert(cand).second)
7191 Result += cand +
' ';
7201 llvm::SmallString<256> rootmapName;
7202 if (!lib.startswith(
"lib"))
7203 rootmapName.append(
"lib");
7205 rootmapName.append(llvm::sys::path::filename(lib));
7206 llvm::sys::path::replace_extension(rootmapName,
"rootmap");
7212 llvm::StringRef rootmapNameNoLib = rootmapName.str();
7213 if (rootmapNameNoLib.consume_front(
"lib"))
7237 if (llvm::sys::path::is_absolute(lib) && !llvm::sys::fs::exists(lib))
7241 llvm::SmallString<512> rootmapName(lib);
7242 llvm::sys::path::replace_extension(rootmapName,
"rootmap");
7243 if (llvm::sys::fs::exists(rootmapName)) {
7245 Info(
"Load",
"loading %s", rootmapName.c_str());
7252 Warning(
"TCling::GetSharedLibDeps",
"Precomputed dependencies available but scanning '%s'", lib);
7257 if (!libs.empty()) {
7263 if (!
fMapfile || !lib || !lib[0]) {
7274 while ((rec = (
TEnvRec*) next())) {
7275 const char* libs = rec->GetValue();
7276 if (!strncmp(libs, libname.
Data(),
len) && strlen(libs) >=
len
7277 && (!libs[
len] || libs[
len] ==
' ' || libs[
len] ==
'.')) {
7290#if defined(R__MUST_REVISIT)
7291#if R__MUST_REVISIT(6,2)
7292 Warning(
"IsErrorMessagesEnabled",
"Interface not available yet.");
7304#if defined(R__MUST_REVISIT)
7305#if R__MUST_REVISIT(6,2)
7306 Warning(
"SetErrorMessages",
"Interface not available yet.");
7322 llvm::SmallVector<std::string, 10> includePaths;
7324 fInterpreter->GetIncludePaths(includePaths,
false,
true);
7325 if (
const size_t nPaths = includePaths.size()) {
7326 assert(!(nPaths & 1) &&
"GetIncludePath, number of paths and options is not equal");
7328 for (
size_t i = 0; i < nPaths; i += 2) {
7333 if (includePaths[i] !=
"-I")
7367 assert(fout !=
nullptr &&
"DisplayIncludePath, 'fout' parameter is null");
7369 llvm::SmallVector<std::string, 10> includePaths;
7371 fInterpreter->GetIncludePaths(includePaths,
false,
true);
7372 if (
const size_t nPaths = includePaths.size()) {
7373 assert(!(nPaths & 1) &&
"DisplayIncludePath, number of paths and options is not equal");
7375 std::string allIncludes(
"include path:");
7376 for (
size_t i = 0; i < nPaths; i += 2) {
7378 allIncludes += includePaths[i];
7380 if (includePaths[i] !=
"-I")
7382 allIncludes += includePaths[i + 1];
7385 fprintf(fout,
"%s\n", allIncludes.c_str());
7404#if defined(R__MUST_REVISIT)
7405#if R__MUST_REVISIT(6,2)
7406 Warning(
"GenericError",
"Interface not available yet.");
7434#if defined(R__MUST_REVISIT)
7435#if R__MUST_REVISIT(6,2)
7436 Warning(
"GetSecurityError",
"Interface not available yet.");
7449 cling::Interpreter::CompilationResult compRes;
7451 return compRes == cling::Interpreter::kFailure;
7470 TTHREAD_TLS_DECL(std::string,buffer);
7472 return buffer.c_str();
7553#if defined(R__MUST_REVISIT)
7554#if R__MUST_REVISIT(6,2)
7555 Warning(
"SetErrmsgcallback",
"Interface not available yet.");
7564 &
fInterpreter->getDiagnostics().getDiagnosticOptions(),
7566 [] (clang::DiagnosticsEngine::Level Level,
const std::string &
Info) {
7567 if (Level == clang::DiagnosticsEngine::Warning) {
7568 ::Warning(
"cling",
"%s", Info.c_str());
7569 }
else if (Level == clang::DiagnosticsEngine::Error
7570 || Level == clang::DiagnosticsEngine::Fatal) {
7576 fInterpreter->replaceDiagnosticConsumer(consumer,
true);
7578 fInterpreter->replaceDiagnosticConsumer(
nullptr);
7597 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
7598 std::string canonical = DLM->lookupLibrary(path);
7599 if (canonical.empty()) {
7603 cling::Interpreter::CompilationResult compRes;
7605 return compRes == cling::Interpreter::kFailure;
7609 return std::unique_ptr<TInterpreterValue>(
new TClingValue);
7616 std::vector<std::string>& completions)
7625 auto V =
reinterpret_cast<cling::Value*
>(
value.GetValAddr());
7627 return compRes!=cling::Interpreter::kSuccess ? 0 : 1 ;
7634 using namespace cling;
7648 if (
value.isValid() &&
value.needsManagedAllocation()) {
7669 auto iSpecObj = iSpecObjMap->second.find(Name);
7670 if (iSpecObj != iSpecObjMap->second.end()) {
7672 return iSpecObj->second;
7679 ASTContext& C = SemaR.getASTContext();
7680 Preprocessor &PP = SemaR.getPreprocessor();
7681 Parser& P =
const_cast<Parser&
>(
fInterpreter->getParser());
7682 Preprocessor::CleanupAndRestoreCacheRAII cleanupRAII(PP);
7683 Parser::ParserCurTokRestoreRAII savedCurToken(P);
7686 Token& Tok =
const_cast<Token&
>(P.getCurToken());
7687 Tok.setKind(tok::semi);
7693 Sema::ContextAndScopeRAII pushedDCAndS(SemaR, C.getTranslationUnitDecl(),
7696 TObject* specObj =
gROOT->FindSpecialObject(Name, LookupCtx);
7699 Error(
"GetObjectAddress",
"Got a special object without LookupCtx!");
7713 clang::CXXRecordDecl* klass)
const
7715 using namespace clang;
7716 ASTContext& Ctx = klass->getASTContext();
7717 FriendDecl::FriendUnion friendUnion(
function);
7720 FriendDecl* friendDecl = FriendDecl::Create(Ctx, klass, sl, friendUnion, sl);
7721 klass->pushFriendDecl(friendDecl);
7735 if (func)
return ((
TClingCallFunc*)func)->GetDecl()->getCanonicalDecl();
7806 f->
Exec(address, &val);
7820 const void* args[] ,
7987 f->SetFunc(ci, method, params,
offset);
7996 f->SetFunc(ci, method, params, objectIsConst,
offset);
8034 llvm::SmallVector<clang::QualType, 4> funcProto;
8035 for (std::vector<TypeInfo_t*>::const_iterator iter =
proto.begin(), end =
proto.end();
8036 iter != end; ++iter) {
8037 funcProto.push_back( ((
TClingTypeInfo*)(*iter))->GetQualType() );
8039 f->SetFuncProto(ci, method, funcProto,
offset,
mode);
8049 llvm::SmallVector<clang::QualType, 4> funcProto;
8050 for (std::vector<TypeInfo_t*>::const_iterator iter =
proto.begin(), end =
proto.end();
8051 iter != end; ++iter) {
8052 funcProto.push_back( ((
TClingTypeInfo*)(*iter))->GetQualType() );
8054 f->SetFuncProto(ci, method, funcProto, objectIsConst,
offset,
mode);
8060 std::string wrapper_name;
8061 std::string wrapper;
8081 const clang::DeclContext *ctxt =
nullptr;
8083 ctxt = clang::Decl::castToDeclContext(((
TClingClassInfo*)info)->GetDecl());
8085 ctxt =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
8090 const clang::Decl *decl =
reinterpret_cast<const clang::Decl*
>(declid);
8094 const clang::DeclContext *declDC = decl->getDeclContext();
8097 if (declDC->isTransparentContext()) {
8098 declDC = declDC->getParent();
8101 if (
const auto *declRD = llvm::dyn_cast<clang::RecordDecl>(declDC)) {
8102 if (declRD->isAnonymousStructOrUnion()) {
8103 declDC = declRD->getParent();
8107 if (
const auto *declNS = llvm::dyn_cast<clang::NamespaceDecl>(declDC)) {
8108 if (declNS->isAnonymousNamespace() || declNS->isInlineNamespace()) {
8109 declDC = declNS->getParent();
8116 return declDC->Equals(ctxt);
8227 TClinginfo->
Init(tagnum);
8300 return TClinginfo->
Next();
8348 return TClinginfo->
Size();
8356 return TClinginfo->
Tagnum();
8372 TTHREAD_TLS_DECL(std::string,
output);
8382 return TClinginfo->
Name();
8390 return TClinginfo->
Title();
8427 ClassInfo_t* base)
const
8440 return TClinginfo->
Next();
8448 return TClinginfo->
Next(onlyDirect);
8456 return TClinginfo->
Offset(address, isDerivedObject);
8469 return TClinginfo->
GetBaseOffset(TClinginfoBase, address, isDerivedObject);
8485 return (ClassInfo_t *)TClinginfo->
GetBase();
8493 return TClinginfo->
Tagnum();
8501 TTHREAD_TLS_DECL(std::string,
output);
8511 return TClinginfo->
Name();
8556 const clang::Decl* decl =
reinterpret_cast<const clang::Decl*
>(declid);
8557 const clang::ValueDecl* vd = llvm::dyn_cast_or_null<clang::ValueDecl>(decl);
8590 return TClinginfo->
Next();
8598 return TClinginfo->
Offset();
8646 return TClinginfo->
Name();
8654 return TClinginfo->
Title();
8661 TTHREAD_TLS_DECL(std::string,
result);
8672 Decl* decl =
static_cast<Decl*
>(
const_cast<void*
>(declId));
8673 ASTContext &C = decl->getASTContext();
8674 decl->addAttr(AnnotateAttr::CreateImplicit(C, attribute));
8685 cling::Interpreter &interp,
8688 const clang::TypeDecl* td = llvm::dyn_cast<clang::TypeDecl>(decl->getDeclContext());
8691 clang::QualType qualType(td->getTypeForDecl(),0);
8693 unsigned int level = 0;
8696 else if (
name[
cursor] ==
'<' && level) --level;
8697 else if (level == 0 &&
name[
cursor] ==
':') {
8710 const auto *FD = llvm::dyn_cast<clang::FunctionDecl>(decl);
8711 if (
const auto *USD = llvm::dyn_cast<clang::UsingShadowDecl>(decl)) {
8712 FD = llvm::dyn_cast<clang::FunctionDecl>(USD->getTargetDecl());
8715 Error(
"GetFunctionName",
"NULL Decl!");
8722 if (llvm::isa<clang::CXXConstructorDecl>(FD))
8726 }
else if (llvm::isa<clang::CXXDestructorDecl>(decl))
8731 llvm::raw_string_ostream stream(
output);
8732 auto printPolicy = decl->getASTContext().getPrintingPolicy();
8734 printPolicy.AnonymousTagLocations =
false;
8735 FD->getNameForDiagnostic(stream, printPolicy,
false);
8765 return (FuncTempInfo_t*)
const_cast<void*
>(declid);
8776 return (FuncTempInfo_t*)ft_info;
8787 return t_info !=
nullptr;
8796 if (!ft_info)
return 0;
8797 const clang::FunctionTemplateDecl *ft = (
const clang::FunctionTemplateDecl*)ft_info;
8798 return ft->getTemplateParameters()->size();
8807 if (!ft_info)
return 0;
8808 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
8809 return ft->getTemplateParameters()->getMinRequiredArguments();
8817 if (!ft_info)
return 0;
8822 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
8824 switch (ft->getAccess()) {
8825 case clang::AS_public:
8828 case clang::AS_protected:
8831 case clang::AS_private:
8834 case clang::AS_none:
8835 if (ft->getDeclContext()->isNamespace())
8843 const clang::FunctionDecl *fd = ft->getTemplatedDecl();
8844 if (
const clang::CXXMethodDecl *md =
8845 llvm::dyn_cast<clang::CXXMethodDecl>(fd)) {
8846 if (md->getMethodQualifiers().hasConst()) {
8849 if (md->isVirtual()) {
8855 if (
const clang::CXXConstructorDecl *cd =
8856 llvm::dyn_cast<clang::CXXConstructorDecl>(md)) {
8857 if (cd->isExplicit()) {
8861 else if (
const clang::CXXConversionDecl *cd =
8862 llvm::dyn_cast<clang::CXXConversionDecl>(md)) {
8863 if (cd->isExplicit()) {
8877 if (!ft_info)
return 0;
8882 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
8883 const clang::FunctionDecl *fd = ft->getTemplatedDecl();
8885 if (fd->isOverloadedOperator())
8887 if (llvm::isa<clang::CXXConversionDecl>(fd))
8889 if (llvm::isa<clang::CXXConstructorDecl>(fd))
8891 if (llvm::isa<clang::CXXDestructorDecl>(fd))
8893 if (fd->isInlined())
8904 if (!ft_info)
return;
8905 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
8917 if (!ft_info)
return;
8918 const clang::FunctionTemplateDecl *ft = (
const clang::FunctionTemplateDecl*)ft_info;
8922 if (
const RedeclarableTemplateDecl *AnnotFD
8924 if (AnnotateAttr *A = AnnotFD->getAttr<AnnotateAttr>()) {
8925 output = A->getAnnotation().str();
8929 if (!ft->isFromASTFile()) {
8980 const clang::Decl* decl =
reinterpret_cast<const clang::Decl*
>(declid);
9014 return info->
NArg();
9030 return info->
Next();
9057 return (TypeInfo_t*)info->
Type();
9065 TTHREAD_TLS_DECL(
TString, mangled_name);
9068 return mangled_name;
9086 return info->
Name();
9116 return info->
Title();
9124 return MethodInfo_MethodCallReturnType(func->fInfo);
9126 return EReturnType::kOther;
9135 if (info && info->
IsValid()) {
9137 clang::QualType QT( typeinfo->
GetQualType().getCanonicalType() );
9138 if (QT->isEnumeralType()) {
9139 return EReturnType::kLong;
9140 }
else if (QT->isPointerType()) {
9142 QT = llvm::cast<clang::PointerType>(QT)->getPointeeType();
9143 if ( QT->isCharType() ) {
9144 return EReturnType::kString;
9146 return EReturnType::kOther;
9148 }
else if ( QT->isFloatingType() ) {
9149 int sz = typeinfo->
Size();
9150 if (sz == 4 || sz == 8) {
9152 return EReturnType::kDouble;
9154 return EReturnType::kOther;
9156 }
else if ( QT->isIntegerType() ) {
9157 int sz = typeinfo->
Size();
9166 return EReturnType::kLong;
9168 return EReturnType::kOther;
9171 return EReturnType::kOther;
9174 return EReturnType::kOther;
9210 return (MethodArgInfo_t*)
9227 return info->
Next();
9251 return info->
Name();
9275 return (TypeInfo_t*) info->
Type();
9335 return TClinginfo->
Name();
9359 return TClinginfo->
Size();
9417 const char*
name)
const
9437 return TClinginfo->
Next();
9453 return TClinginfo->
Size();
9469 return TClinginfo->
Name();
9477 return TClinginfo->
Title();
9484 clang::QualType QT1 = clang::QualType::getFromOpaquePtr(QualTypePtr1);
9485 clang::QualType QT2 = clang::QualType::getFromOpaquePtr(QualTypePtr2);
9486 return fInterpreter->getCI()->getASTContext().hasSameType(QT1, QT2);
9493 clang::QualType QT = clang::QualType::getFromOpaquePtr(QualTypePtr);
9494 return QT->hasIntegerRepresentation();
9501 clang::QualType QT = clang::QualType::getFromOpaquePtr(QualTypePtr);
9502 return QT->hasSignedIntegerRepresentation();
9509 clang::QualType QT = clang::QualType::getFromOpaquePtr(QualTypePtr);
9510 return QT->hasUnsignedIntegerRepresentation();
9517 clang::QualType QT = clang::QualType::getFromOpaquePtr(QualTypePtr);
9518 return QT->hasFloatingRepresentation();
9525 clang::QualType QT = clang::QualType::getFromOpaquePtr(QualTypePtr);
9526 return QT->hasPointerRepresentation();
9533 clang::QualType QT = clang::QualType::getFromOpaquePtr(QualTypePtr);
9534 return QT->isVoidPointerType();
9541 clang::FunctionDecl *FD = (clang::FunctionDecl *) fdeclid;
9542 return llvm::isa_and_nonnull<clang::CXXMethodDecl>(FD);
9551 Error(
"SnapshotMutexState",
"fRecurseCount != 0 even though initial mutex state is unset!");
9567 Error(
"ForgetMutexState",
"mutex state's recurse count already 0!");
9583 std::unique_ptr<MutexStateAndRecurseCountDelta> uniqueP{typedDelta};
9597 Error(
"ApplyToInterpreterMutex",
9598 "After returning from user code that turned on thread safety support, we notice that fInitialMutex is already used ... "
9599 "so the rest of this function/stack execution might have race condition (with the other thread that thinks it has exclusive access to the interpreter state.");
9615 return uniqueP.release();
The file contains utilities which are foundational and could be used across the core component of ROO...
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned long long ULong64_t
TClass *(* DictFuncPtr_t)()
R__EXTERN TApplication * gApplication
R__EXTERN TClassTable * gClassTable
static bool IsFromRootCling()
static void indent(ostringstream &buf, int indent_level)
The file contains facilities to work with C++ module files extensions used to store rdict files.
void TCling__RestoreInterpreterMutex(void *delta)
Re-apply the lock count delta that TCling__ResetInterpreterMutex() caused.
void TCling__TransactionRollback(const cling::Transaction &T)
static void RegisterPreIncludedHeaders(cling::Interpreter &clingInterp)
static bool hasParsedRootmapForLibrary(llvm::StringRef lib)
static std::string GetClassSharedLibsForModule(const char *cls, cling::LookupHelper &LH)
void TCling__InvalidateGlobal(const clang::Decl *D)
bool TClingLookupHelper__AutoParse(const char *cname)
Allow calling autoparsing from TMetaUtils.
void * TCling__LockCompilationDuringUserCodeExecution()
Lock the interpreter.
void TCling__UpdateListsOnUnloaded(const cling::Transaction &T)
void TCling__GetNormalizedContext(const ROOT::TMetaUtils::TNormalizedCtxt *&normCtxt)
int TCling__LoadLibrary(const char *library)
Load a library.
void TCling__DEBUG__dump(clang::DeclContext *DC)
ETupleOrdering
Check in what order the member of a tuple are layout.
bool TCling__LibraryLoadingFailed(const std::string &errmessage, const std::string &libStem, bool permanent, bool resolved)
Lookup libraries in LD_LIBRARY_PATH and DYLD_LIBRARY_PATH with mangled_name, which is extracted by er...
static const std::unordered_set< std::string > gIgnoredPCMNames
List of dicts that have the PCM information already in the PCH.
static Bool_t s_IsLibraryLoaded(const char *libname, cling::Interpreter *fInterpreter)
static std::string AlternateTuple(const char *classname, const cling::LookupHelper &lh)
static GlobalModuleIndex * loadGlobalModuleIndex(cling::Interpreter &interp)
bool TClingLookupHelper__ExistingTypeCheck(const std::string &tname, std::string &result)
Try hard to avoid looking up in the Cling database as this could enduce an unwanted autoparsing.
static bool HasASTFileOnDisk(clang::Module *M, const clang::Preprocessor &PP, std::string *FullFileName=nullptr)
Checks if there is an ASTFile on disk for the given module M.
void TCling__UnlockCompilationDuringUserCodeExecution(void *)
Unlock the interpreter.
const char * TCling__GetClassSharedLibs(const char *className)
static bool R__InitStreamerInfoFactory()
Helper to initialize TVirtualStreamerInfo's factor early.
int TCling__AutoParseCallback(const char *className)
clang::RecordDecl * TCling__DEBUG__DCtoRecordDecl(clang::DeclContext *DC)
int TCling_GenerateDictionary(const std::vector< std::string > &classes, const std::vector< std::string > &headers, const std::vector< std::string > &fwdDecls, const std::vector< std::string > &unknown)
static bool HaveFullGlobalModuleIndex
bool TCling__TEST_isInvalidDecl(clang::Decl *D)
void TCling__LibraryUnloadedRTTI(const void *dyLibHandle, const char *canonicalName)
void TCling__UpdateListsOnCommitted(const cling::Transaction &T, cling::Interpreter *)
const Decl * TCling__GetObjectDecl(TObject *obj)
static ETupleOrdering IsTupleAscending()
void TCling__RegisterRdictForLoadPCM(const std::string &pcmFileNameFullPath, llvm::StringRef *pcmContent)
static void TCling__UpdateClassInfo(const NamedDecl *TD)
Update TClingClassInfo for a class (e.g. upon seeing a definition).
clang::DeclContext * TCling__DEBUG__getDeclContext(clang::Decl *D)
int TCling__CompileMacro(const char *fileName, const char *options)
void * TCling__ResetInterpreterMutex()
Reset the interpreter lock to the state it had before interpreter-related calls happened.
void TCling__DEBUG__decl_dump(void *D)
int TCling__AutoLoadCallback(const char *className)
static bool LoadModule(const std::string &ModuleName, cling::Interpreter &interp)
static void RegisterCxxModules(cling::Interpreter &clingInterp)
static void ConstructorName(std::string &name, const clang::Decl *decl, cling::Interpreter &interp, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt)
void TCling__PrintStackTrace()
Print a StackTrace!
static int HandleInterpreterException(cling::MetaProcessor *metaProcessor, const char *input_line, cling::Interpreter::CompilationResult &compRes, cling::Value *result)
Let cling process a command line.
static std::string GetSharedLibImmediateDepsSlow(std::string lib, cling::Interpreter *interp, bool skipLoadedLibs=true)
This interface returns a list of dependent libraries in the form: lib libA.so libB....
void TCling__DEBUG__printName(clang::Decl *D)
static clang::ClassTemplateDecl * FindTemplateInNamespace(clang::Decl *decl)
Find a template decl within N nested namespaces, 0<=N<inf Assumes 1 and only 1 template present and 1...
static void PrintDlError(const char *dyLibName, const char *modulename)
TInterpreter * CreateInterpreter(void *interpLibHandle, const char *argv[])
void TCling__LibraryLoadedRTTI(const void *dyLibHandle, const char *canonicalName)
static cling::Interpreter::CompilationResult ExecAutoParse(const char *what, Bool_t header, cling::Interpreter *interpreter)
Parse the payload or header.
static bool requiresRootMap(const char *rootmapfile)
clang::NamespaceDecl * TCling__DEBUG__DCtoNamespace(clang::DeclContext *DC)
TObject * TCling__GetObjectAddress(const char *Name, void *&LookupCtx)
static void LoadModules(const std::vector< std::string > &modules, cling::Interpreter &interp)
Loads the C++ modules that we require to run any ROOT program.
int TCling__IsAutoLoadNamespaceCandidate(const clang::NamespaceDecl *nsDecl)
void DestroyInterpreter(TInterpreter *interp)
static bool hasPrecomputedLibraryDeps(llvm::StringRef lib)
void TCling__SplitAclicMode(const char *fileName, string &mode, string &args, string &io, string &fname)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Int_t gErrorIgnoreLevel
Error handling routines.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t cursor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t property
Option_t Option_t TPoint TPoint const char text
R__EXTERN TVirtualMutex * gInterpreterMutex
#define R__LOCKGUARD_CLING(mutex)
R__EXTERN TInterpreter * gCling
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Bool_t R_ISREG(Int_t mode)
R__EXTERN TSystem * gSystem
R__EXTERN TVirtualMutex * gGlobalMutex
#define R__LOCKGUARD(mutex)
#define R__WRITE_LOCKGUARD(mutex)
#define R__READ_LOCKGUARD(mutex)
virtual std::unique_ptr< StateDelta > Rewind(const State &earlierState)=0
virtual void Apply(std::unique_ptr< StateDelta > &&delta)=0
virtual std::unique_ptr< State > GetStateBefore()=0
static Longptr_t ExecuteFile(const char *file, Int_t *error=nullptr, Bool_t keep=kFALSE)
Execute a file containing a C++ macro (static method).
virtual TApplicationImp * GetApplicationImp()
virtual Bool_t IsCmdThread()
Each class (see TClass) has a linked list of its base class(es).
TClassRef is used to implement a permanent reference to a TClass object.
static DictFuncPtr_t GetDict(const char *cname)
Given the class name returns the Dictionary() function of a class (uses hash of name).
static TProtoClass * GetProtoNorm(const char *cname)
Given the class normalized name returns the TClassProto object for the class.
static DictFuncPtr_t GetDictNorm(const char *cname)
Given the normalized class name returns the Dictionary() function of a class (uses hash of name).
static TProtoClass * GetProto(const char *cname)
Given the class name returns the TClassProto object for the class.
static Bool_t Check(const char *cname, std::string &normname)
static void Add(const char *cname, Version_t id, const std::type_info &info, DictFuncPtr_t dict, Int_t pragmabits)
Add a class to the class table (this is a static function).
TClass instances represent classes, structs and namespaces in the ROOT type system.
TDataMember * GetDataMember(const char *datamember) const
Return pointer to datamember object with name "datamember".
ROOT::ESTLType GetCollectionType() const
Return the 'type' of the STL the TClass is representing.
EState fState
cached of the streaming method to use
std::atomic< TList * > fBase
static void AddClassToDeclIdMap(TDictionary::DeclId_t id, TClass *cl)
static: Add a TClass* to the map of classes.
TList * GetListOfFunctionTemplates(Bool_t load=kTRUE)
Return TListOfFunctionTemplates for a class.
void * DynamicCast(const TClass *base, void *obj, Bool_t up=kTRUE)
Cast obj of this class type up to baseclass cl if up is true.
static void RemoveClassDeclId(TDictionary::DeclId_t id)
Bool_t CallShowMembers(const void *obj, TMemberInspector &insp, Bool_t isTransient=kFALSE) const
Call ShowMembers() on the obj of this class type, passing insp and parent.
std::atomic< TListOfEnums * > fEnums
static Bool_t HasNoInfoOrEmuOrFwdDeclaredDecl(const char *)
virtual void PostLoadCheck()
Do the initialization that can only be done after the CINT dictionary has been fully populated and ca...
static TClass * LoadClass(const char *requestedname, Bool_t silent)
Helper function used by TClass::GetClass().
Int_t Size() const
Return size of object of this class.
TObjArray * fStreamerInfo
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
ClassInfo_t * GetClassInfo() const
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
void ResetCaches()
To clean out all caches.
Long_t Property() const override
Returns the properties of the TClass as a bit field stored as a Long_t value.
static Int_t ReadRules()
Read the class.rules files from the default location:.
Version_t GetClassVersion() const
std::atomic< Bool_t > fHasRootPcmInfo
C++ Property of the class (is abstract, has virtual table, etc.)
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Emulation of the CINT BaseClassInfo class.
const char * TmpltName() const
const char * Name() const
ptrdiff_t Offset(void *address=0, bool isDerivedObject=true) const
void FullName(std::string &output, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
TClingClassInfo * GetBase() const
Emulation of the CINT CallFunc class.
void ExecWithReturn(void *address, void *ret=nullptr)
void SetArgs(const char *args)
double ExecDouble(void *address)
void SetArgArray(Longptr_t *argArr, int narg)
Longptr_t ExecInt(void *address)
TInterpreter::CallFuncIFacePtr_t IFacePtr()
void SetFunc(const TClingClassInfo *info, const char *method, const char *arglist, Longptr_t *poffset)
void ExecWithArgsAndReturn(void *address, const void *args[]=0, int nargs=0, void *ret=0)
void Exec(void *address, TInterpreterValue *interpVal=0)
TClingMethodInfo * FactoryMethod() const
int get_wrapper_code(std::string &wrapper_name, std::string &wrapper)
void IgnoreExtraArgs(bool ignore)
long long ExecInt64(void *address)
bool IsAutoLoadingEnabled() const
void SetAutoParsingSuspended(bool val=true)
void SetAutoLoadingEnabled(bool val=true)
Emulation of the CINT ClassInfo class.
static bool IsEnum(cling::Interpreter *interp, const char *name)
long ClassProperty() const
void Init(const char *name)
void FullName(std::string &output, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
EDataType GetUnderlyingType() const
const char * TmpltName() const
const clang::Type * GetType() const
ptrdiff_t GetBaseOffset(TClingClassInfo *toBase, void *address, bool isDerivedObject)
bool IsScopedEnum() const
ROOT::TMetaUtils::EIOCtorCategory HasDefaultConstructor(bool checkio=false, std::string *type_name=nullptr) const
TClingMethodInfo GetMethodWithArgs(const char *fname, const char *arglist, Longptr_t *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch, EInheritanceMode imode=kWithInheritance) const
const clang::FunctionTemplateDecl * GetFunctionTemplate(const char *fname) const
int GetMethodNArg(const char *method, const char *proto, Bool_t objectIsConst, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
bool IsValidMethod(const char *method, const char *proto, Bool_t objectIsConst, Longptr_t *offset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
bool HasMethod(const char *name) const
TDictionary::DeclId_t GetDeclId() const
void DeleteArray(void *arena, bool dtorOnly, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
void * New(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
TClingMethodInfo GetMethod(const char *fname) const
const clang::ValueDecl * GetDataMember(const char *name) const
void Destruct(void *arena, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
std::vector< std::string > GetUsingNamespaces()
bool IsBase(const char *name) const
void Delete(void *arena, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Emulation of the CINT DataMemberInfo class.
const char * TypeName() const
const char * TypeTrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
int MaxIndex(int dim) const
llvm::StringRef ValidArrayIndex() const
const char * Name() const override
long TypeProperty() const
virtual const char * Name() const
virtual bool IsValid() const
virtual const clang::Decl * GetDecl() const
Uses clang::TextDiagnosticPrinter to format diagnostics, which are then passed to a user-specified fu...
Emulation of the CINT MethodInfo class.
bool IsValid() const override
const char * DefaultValue() const
const TClingTypeInfo * Type() const
const char * TypeName() const
Emulation of the CINT MethodInfo class.
std::string GetMangledName() const
const char * TypeName() const
const char * Name() const override
const clang::FunctionDecl * GetTargetFunctionDecl() const
Get the FunctionDecl, or if this represents a UsingShadowDecl, the underlying target FunctionDecl.
const char * GetPrototype()
long ExtraProperty() const
void * InterfaceMethod() const
void CreateSignature(TString &signature) const
TDictionary::DeclId_t GetDeclId() const
TClingTypeInfo * Type() const
Emulation of the CINT TypeInfo class.
std::string NormalizedName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Return the normalized name of the type (i.e.
const char * Name() const override
void * QualTypePtr() const
Return the QualType as a void pointer.
bool IsValid() const override
clang::QualType GetQualType() const
void Init(const char *name)
const char * TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Return the normalized name of the type (i.e.
Emulation of the CINT TypedefInfo class.
const char * TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Get the name of the underlying type of the current typedef.
long Property() const
Return a bit mask of metadata about the current typedef.
const char * Name() const override
Get the name of the current typedef.
void Init(const char *name)
Lookup named typedef and reset the iterator to point to it.
int Next()
Increment the iterator.
int Size() const
Return the size in bytes of the underlying type of the current typedef.
Bridge between cling::Value and ROOT.
bool Append(const std::string &str)
Append string to the storage if not added already.
This class defines an interface to the cling C++ interpreter.
static Int_t DeepAutoLoadImpl(const char *cls, std::unordered_set< std::string > &visited, bool nameIsNormalized)
const char * MethodArgInfo_DefaultValue(MethodArgInfo_t *marginfo) const final
bool ClassInfo_IsScopedEnum(ClassInfo_t *info) const final
const char * TypeInfo_Name(TypeInfo_t *) const final
void * MethodInfo_InterfaceMethod(MethodInfo_t *minfo) const final
void LoadEnums(TListOfEnums &cl) const final
Create list of pointers to enums for TClass cl.
void UpdateListOfGlobals() final
No op: see TClingCallbacks (used to update the list of globals)
bool TypedefInfo_IsValid(TypedefInfo_t *tinfo) const final
Int_t AutoLoad(const char *classname, Bool_t knowDictNotLoaded=kFALSE) final
Load library containing the specified class.
void CallFunc_Init(CallFunc_t *func) const final
void SetGetline(const char *(*getlineFunc)(const char *prompt), void(*histaddFunc)(const char *line)) final
Set a getline function to call when input is needed.
bool LibraryLoadingFailed(const std::string &, const std::string &, bool, bool)
void GenericError(const char *error) const final
Let the interpreter issue a generic error, and set its error state.
std::vector< void * > fRegisterModuleDyLibs
void CallFunc_ExecWithReturn(CallFunc_t *func, void *address, void *ret) const final
TypeInfo_t * MethodInfo_Type(MethodInfo_t *minfo) const final
std::vector< std::string > fAutoLoadLibStorage
void CallFunc_Delete(CallFunc_t *func) const final
int LoadFile(const char *path) const final
Load a source file or library called path into the interpreter.
void ResetAll() final
Reset the Cling state to its initial state.
void SetDeclAttr(DeclId_t, const char *) final
void HandleNewDecl(const void *DV, bool isDeserialized, std::set< TClass * > &modifiedClasses)
void InvalidateCachedDecl(const std::tuple< TListOfDataMembers *, TListOfFunctions *, TListOfFunctionTemplates *, TListOfEnums * > &Lists, const clang::Decl *D)
Invalidate cached TCling information for the given declaration, and removed it from the appropriate o...
Long_t MethodInfo_Property(MethodInfo_t *minfo) const final
virtual void LoadFunctionTemplates(TClass *cl) const final
Create list of pointers to function templates for TClass cl.
bool ClassInfo_IsValidMethod(ClassInfo_t *info, const char *method, const char *proto, Longptr_t *offset, ROOT::EFunctionMatchMode=ROOT::kConversionMatch) const final
Long_t DataMemberInfo_Property(DataMemberInfo_t *dminfo) const final
int SetClassAutoparsing(int) final
Enable/Disable the Autoparsing of headers.
std::vector< const char * > fCurExecutingMacros
void CreateListOfDataMembers(TClass *cl) const final
Create list of pointers to data members for TClass cl.
void RewindDictionary() final
Rewind Cling dictionary to the point where it was before executing the current macro.
bool ClassInfo_IsValid(ClassInfo_t *info) const final
void UpdateListsOnCommitted(const cling::Transaction &T)
int TypeInfo_RefType(TypeInfo_t *) const final
void CreateListOfBaseClasses(TClass *cl) const final
Create list of pointers to base class(es) for TClass cl.
ClassInfo_t * ClassInfo_Factory(Bool_t all=kTRUE) const final
const char * MethodInfo_Name(MethodInfo_t *minfo) const final
BaseClassInfo_t * BaseClassInfo_Factory(ClassInfo_t *info) const final
void SetClassInfo(TClass *cl, Bool_t reload=kFALSE) final
Set pointer to the TClingClassInfo in TClass.
Bool_t LoadText(const char *text) const final
Load the declarations from text into the interpreter.
const char * GetSharedLibDeps(const char *lib, bool tryDyld=false) final
Get the list a libraries on which the specified lib depends.
EReturnType MethodInfo_MethodCallReturnType(MethodInfo_t *minfo) const final
TObject * GetObjectAddress(const char *Name, void *&LookupCtx)
If the interpreter encounters Name, check whether that is an object ROOT could retrieve.
Longptr_t ProcessLineAsynch(const char *line, EErrorCode *error=nullptr)
Let cling process a command line asynch.
bool MethodInfo_IsValid(MethodInfo_t *minfo) const final
FuncTempInfo_t * FuncTempInfo_Factory(DeclId_t declid) const final
Construct a FuncTempInfo_t.
TypeInfo_t * TypeInfo_Factory() const final
bool IsClassAutoLoadingEnabled() const
Returns if class AutoLoading is currently enabled.
void InvalidateGlobal(const clang::Decl *D)
Invalidate cached TCling information for the given global declaration.
int Evaluate(const char *, TInterpreterValue &) final
Get the interpreter value corresponding to the statement.
std::unique_ptr< TInterpreterValue > MakeInterpreterValue() const final
void UpdateListOfLoadedSharedLibraries()
const char * TypedefInfo_Title(TypedefInfo_t *tinfo) const final
void CallFunc_SetFuncProto(CallFunc_t *func, ClassInfo_t *info, const char *method, const char *proto, Longptr_t *Offset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const final
Interface to cling function.
void InitRootmapFile(const char *name)
Create a resource table and read the (possibly) three resource files, i.e.
Int_t AutoParse(const char *cls) final
Parse the headers relative to the class Returns 1 in case of success, 0 in case of failure.
bool FunctionDeclId_IsMethod(DeclId_t fdeclid) const
void LoadPCM(std::string pcmFileNameFullPath)
Tries to load a rdict PCM, issues diagnostics if it fails.
void UpdateListOfMethods(TClass *cl) const final
Update the list of pointers to method for TClass cl This is now a nop.
virtual ~TCling()
Destroy the interpreter interface.
void AddFriendToClass(clang::FunctionDecl *, clang::CXXRecordDecl *) const
Inject function as a friend into klass.
void PrintIntro() final
No-op; see TRint instead.
Bool_t fCxxModulesEnabled
int BaseClassInfo_Next(BaseClassInfo_t *bcinfo) const final
void RefreshClassInfo(TClass *cl, const clang::NamedDecl *def, bool alias)
Internal function. Actually do the update of the ClassInfo when seeing.
CallFunc_t * CallFunc_FactoryCopy(CallFunc_t *func) const final
Double_t CallFunc_ExecDouble(CallFunc_t *func, void *address) const final
void CallFunc_ResetArg(CallFunc_t *func) const final
const char * GetCurrentMacroName() const final
Return the file name of the currently interpreted file, included or not.
Bool_t IsLoaded(const char *filename) const final
Return true if the file has already been loaded by cint.
void SaveGlobalsContext() final
Save the current Cling state of global objects.
void CallFunc_IgnoreExtraArgs(CallFunc_t *func, bool ignore) const final
void ApplyToInterpreterMutex(void *delta)
Re-apply the lock count delta that TCling__ResetInterpreterMutex() caused.
void * LazyFunctionCreatorAutoload(const std::string &mangled_name)
Autoload a library based on a missing symbol.
Int_t GenerateDictionary(const char *classes, const char *includes="", const char *options=nullptr) final
Generate the dictionary for the C++ classes listed in the first argument (in a semi-colon separated l...
Bool_t ClassInfo_Contains(ClassInfo_t *info, DeclId_t declid) const final
Return true if the entity pointed to by 'declid' is declared in the context described by 'info'.
Bool_t IsLibraryLoaded(const char *libname) const final
Long_t GetExecByteCode() const final
This routines used to return the address of the internal wrapper function (of the interpreter) that w...
int DataMemberInfo_ArrayDim(DataMemberInfo_t *dminfo) const final
TypeInfo_t * MethodArgInfo_TypeInfo(MethodArgInfo_t *marginfo) const
DataMemberInfo_t * DataMemberInfo_FactoryCopy(DataMemberInfo_t *dminfo) const final
Bool_t HandleNewTransaction(const cling::Transaction &T)
Helper function to increase the internal Cling count of transactions that change the AST.
int ReadRootmapFile(const char *rootmapfile, TUniqueString *uniqueString=nullptr)
Read and parse a rootmapfile in its new format, and return 0 in case of success, -1 if the file has a...
std::map< SpecialObjectLookupCtx_t, SpecialObjectMap_t > fSpecialObjectMaps
int ClassInfo_Next(ClassInfo_t *info) const final
void SetErrmsgcallback(void *p) const final
Set a callback to receive error messages.
bool MethodArgInfo_IsValid(MethodArgInfo_t *marginfo) const final
int TypeInfo_Size(TypeInfo_t *tinfo) const final
Int_t DeleteGlobal(void *obj) final
Delete obj from Cling symbol table so it cannot be accessed anymore.
int GetSecurityError() const final
Interface to cling function.
void SetTempLevel(int val) const final
Create / close a scope for temporaries.
std::set< size_t > fPayloads
UInt_t FuncTempInfo_TemplateNargs(FuncTempInfo_t *) const final
Return the maximum number of template arguments of the function template described by ft_info.
DeclId_t GetFunctionWithPrototype(ClassInfo_t *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) final
Return pointer to cling interface function for a method of a class with a certain prototype,...
TypedefInfo_t * TypedefInfo_Factory() const final
TObjArray * fRootmapFiles
bool IsVoidPointerType(const void *QualTypePtr) const
Longptr_t ProcessLine(const char *line, EErrorCode *error=nullptr) final
int ClassInfo_Size(ClassInfo_t *info) const final
const char * MethodArgInfo_TypeName(MethodArgInfo_t *marginfo) const final
cling::Interpreter * GetInterpreterImpl() const
Longptr_t ExecuteMacro(const char *filename, EErrorCode *error=nullptr) final
Execute a cling macro.
std::vector< std::pair< TClass *, DictFuncPtr_t > > fClassesToUpdate
int DataMemberInfo_Next(DataMemberInfo_t *dminfo) const final
const char * TypedefInfo_Name(TypedefInfo_t *tinfo) const final
void BaseClassInfo_Delete(BaseClassInfo_t *bcinfo) const final
Long_t MethodInfo_ExtraProperty(MethodInfo_t *minfo) const final
void LoadMacro(const char *filename, EErrorCode *error=nullptr) final
Load a macro file in cling's memory.
const char * GetClassSharedLibs(const char *cls) final
Get the list of shared libraries containing the code for class cls.
FuncTempInfo_t * FuncTempInfo_FactoryCopy(FuncTempInfo_t *) const final
Construct a FuncTempInfo_t.
int DataMemberInfo_MaxIndex(DataMemberInfo_t *dminfo, Int_t dim) const final
Bool_t FuncTempInfo_IsValid(FuncTempInfo_t *) const final
Check validity of a FuncTempInfo_t.
void AddIncludePath(const char *path) final
Add a directory to the list of directories in which the interpreter looks for include files.
bool ClassInfo_IsBase(ClassInfo_t *info, const char *name) const final
void RecursiveRemove(TObject *obj) final
Delete object from cling symbol table so it can not be used anymore.
const char * DataMemberInfo_TypeName(DataMemberInfo_t *dminfo) const final
DeclId_t GetDataMemberAtAddr(const void *addr) const final
Return pointer to cling DeclId for a data member with a given name.
void CallFunc_SetArgArray(CallFunc_t *func, Longptr_t *paramArr, Int_t nparam) const final
std::string CallFunc_GetWrapperCode(CallFunc_t *func) const final
void * RewindInterpreterMutex()
Reset the interpreter lock to the state it had before interpreter-related calls happened.
const char * MethodArgInfo_Name(MethodArgInfo_t *marginfo) const final
Bool_t HasPCMForLibrary(const char *libname) const final
Return true if ROOT has cxxmodules pcm for a given library name.
void TypedefInfo_Init(TypedefInfo_t *tinfo, const char *name) const final
const char * DataMemberInfo_Title(DataMemberInfo_t *dminfo) const final
Longptr_t CallFunc_ExecInt(CallFunc_t *func, void *address) const final
void ClearStack() final
Delete existing temporary values.
void SetAlloclockfunc(void(*)()) const final
[Place holder for Mutex Lock] Provide the interpreter with a way to acquire a lock used to protect cr...
Bool_t SetErrorMessages(Bool_t enable=kTRUE) final
If error messages are disabled, the interpreter should suppress its failures and warning messages fro...
MethodInfo_t * CallFunc_FactoryMethod(CallFunc_t *func) const final
bool IsUnsignedIntegerType(const void *QualTypePtr) const
TypedefInfo_t * TypedefInfo_FactoryCopy(TypedefInfo_t *tinfo) const final
void GetFunctionOverloads(ClassInfo_t *cl, const char *funcname, std::vector< DeclId_t > &res) const final
Insert overloads of name in cl to res.
void UnRegisterTClassUpdate(const TClass *oldcl) final
If the dictionary is loaded, we can remove the class from the list (otherwise the class might be load...
std::string MethodArgInfo_TypeNormalizedName(MethodArgInfo_t *marginfo) const final
DeclId_t GetEnum(TClass *cl, const char *name) const final
Return pointer to cling Decl of global/static variable that is located at the address given by addr.
Long_t MethodArgInfo_Property(MethodArgInfo_t *marginfo) const final
int TypedefInfo_Size(TypedefInfo_t *tinfo) const final
void CallFunc_ExecWithArgsAndReturn(CallFunc_t *func, void *address, const void *args[]=nullptr, int nargs=0, void *ret=nullptr) const final
void GetInterpreterTypeName(const char *name, std::string &output, Bool_t full=kFALSE) final
The 'name' is known to the interpreter, this function returns the internal version of this name (usua...
std::map< std::string, llvm::StringRef > fPendingRdicts
static void UpdateClassInfoWork(const char *name)
Int_t Load(const char *filenam, Bool_t system=kFALSE) final
Load a library file in cling's memory.
int TypedefInfo_Next(TypedefInfo_t *tinfo) const final
void * GetInterfaceMethod(TClass *cl, const char *method, const char *params, Bool_t objectIsConst=kFALSE) final
Return pointer to cling interface function for a method of a class with parameters params (params is ...
void TypeInfo_Init(TypeInfo_t *tinfo, const char *funcname) const final
Bool_t SetSuspendAutoParsing(Bool_t value) final
Suspend the Autoparsing of headers.
int DataMemberInfo_TypeSize(DataMemberInfo_t *dminfo) const final
static void * fgSetOfSpecials
const char * ClassInfo_Title(ClassInfo_t *info) const final
const char * DataMemberInfo_Name(DataMemberInfo_t *dminfo) const final
const char * TypeName(const char *typeDesc) final
Return the absolute type of typeDesc.
ROOT::TMetaUtils::TNormalizedCtxt * fNormalizedCtxt
bool IsSignedIntegerType(const void *QualTypePtr) const
void ForgetMutexState() final
int MethodInfo_Next(MethodInfo_t *minfo) const final
Long_t ClassInfo_ClassProperty(ClassInfo_t *info) const final
void MethodInfo_Delete(MethodInfo_t *minfo) const final
Interface to cling function.
void MethodArgInfo_Delete(MethodArgInfo_t *marginfo) const final
DataMemberInfo_t * DataMemberInfo_Factory(ClassInfo_t *clinfo, TDictionary::EMemberSelection selection) const final
void ClassInfo_Destruct(ClassInfo_t *info, void *arena) const final
TClass * GetClass(const std::type_info &typeinfo, Bool_t load) const final
Demangle the name (from the typeinfo) and then request the class via the usual name based interface (...
Int_t UnloadAllSharedLibraryMaps() final
Unload the library map entries coming from all the loaded shared libraries.
void ClassInfo_Init(ClassInfo_t *info, const char *funcname) const final
std::set< TClass * > & GetModTClasses()
ClassInfo_t * BaseClassInfo_ClassInfo(BaseClassInfo_t *) const final
TClingCallbacks * fClingCallbacks
Long64_t CallFunc_ExecInt64(CallFunc_t *func, void *address) const final
Long_t ClassInfo_Property(ClassInfo_t *info) const final
Longptr_t ClassInfo_GetBaseOffset(ClassInfo_t *fromDerived, ClassInfo_t *toBase, void *address, bool isDerivedObject) const final
void UpdateEnumConstants(TEnum *enumObj, TClass *cl) const final
void ExecuteWithArgsAndReturn(TMethod *method, void *address, const void *args[]=nullptr, int nargs=0, void *ret=nullptr) const final
Bool_t IsErrorMessagesEnabled() const final
If error messages are disabled, the interpreter should suppress its failures and warning messages fro...
int DisplayIncludePath(FILE *fout) const final
Interface to cling function.
void TransactionRollback(const cling::Transaction &T)
Long_t FuncTempInfo_Property(FuncTempInfo_t *) const final
Return the property of the function template.
TEnum * CreateEnum(void *VD, TClass *cl) const final
const char * TypeInfo_TrueName(TypeInfo_t *tinfo) const final
Int_t UnloadLibraryMap(const char *library) final
Unload library map entries coming from the specified library.
void RegisterTemporary(const TInterpreterValue &value)
MutexStateAndRecurseCount fInitialMutex
const char * GetSharedLibs() final
Return the list of shared libraries loaded into the process.
int MethodArgInfo_Next(MethodArgInfo_t *marginfo) const final
void SnapshotMutexState(ROOT::TVirtualRWMutex *mtx) final
Long_t TypeInfo_Property(TypeInfo_t *tinfo) const final
const char * MethodInfo_GetPrototype(MethodInfo_t *minfo) const final
UInt_t FuncTempInfo_TemplateMinReqArgs(FuncTempInfo_t *) const final
Return the number of required template arguments of the function template described by ft_info.
std::vector< cling::Value > * fTemporaries
void RegisterModule(const char *modulename, const char **headers, const char **includePaths, const char *payloadCode, const char *fwdDeclsCode, void(*triggerFunc)(), const FwdDeclArgsToKeepCollection_t &fwdDeclsArgToSkip, const char **classesHeaders, Bool_t lateRegistration=false, Bool_t hasCxxModule=false) final
Inject the module named "modulename" into cling; load all headers.
static Int_t ShallowAutoLoadImpl(const char *cls)
void MethodInfo_CreateSignature(MethodInfo_t *minfo, TString &signature) const final
Bool_t CheckClassTemplate(const char *name) final
Return true if there is a class template by the given name ...
void LibraryLoaded(const void *dyLibHandle, const char *canonicalName)
void RegisterTClassUpdate(TClass *oldcl, DictFuncPtr_t dict) final
Register classes that already existed prior to their dictionary loading and that already had a ClassI...
TObjArray * GetRootMapFiles() const final
bool DataMemberInfo_IsValid(DataMemberInfo_t *dminfo) const final
bool ClassInfo_IsEnum(const char *name) const final
int MethodInfo_NDefaultArg(MethodInfo_t *minfo) const final
void CreateListOfMethods(TClass *cl) const final
Create list of pointers to methods for TClass cl.
Int_t RescanLibraryMap() final
Scan again along the dynamic path for library maps.
std::map< const cling::Transaction *, size_t > fTransactionHeadersMap
void ReportDiagnosticsToErrorHandler(bool enable=true) final
Report diagnostics to the ROOT error handler (see TError.h).
const char * MethodInfo_GetMangledName(MethodInfo_t *minfo) const final
Bool_t fHeaderParsingOnDemand
bool IsIntegerType(const void *QualTypePtr) const
std::hash< std::string > fStringHashFunction
static void RemoveAndInvalidateObject(List &L, Object *O)
void * GetInterfaceMethodWithPrototype(TClass *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) final
Return pointer to cling interface function for a method of a class with a certain prototype,...
void * ClassInfo_New(ClassInfo_t *info) const final
int DisplayClass(FILE *fout, const char *name, int base, int start) const final
virtual void GetFunctionName(const clang::Decl *decl, std::string &name) const
void CreateListOfMethodArgs(TFunction *m) const final
Create list of pointers to method arguments for TMethod m.
virtual const char * GetSTLIncludePath() const final
Return the directory containing CINT's stl cintdlls.
MethodArgInfo_t * MethodArgInfo_FactoryCopy(MethodArgInfo_t *marginfo) const final
Longptr_t BaseClassInfo_Offset(BaseClassInfo_t *toBaseClassInfo, void *address, bool isDerivedObject) const final
ECheckClassInfo CheckClassInfo(const char *name, Bool_t autoload, Bool_t isClassOrNamespaceOnly=kFALSE) final
Checks if an entity with the specified name is defined in Cling.
void * FindSym(const char *entry) const final
Interface to cling function.
void RegisterLoadedSharedLibrary(const char *name)
Register a new shared library name with the interpreter; add it to fSharedLibs.
void TypeInfo_Delete(TypeInfo_t *tinfo) const final
int MethodInfo_NArg(MethodInfo_t *minfo) const final
DeclId_t GetDataMemberWithValue(const void *ptrvalue) const final
NOT IMPLEMENTED.
std::unordered_set< const clang::NamespaceDecl * > fNSFromRootmaps
EReturnType MethodCallReturnType(TFunction *func) const final
void ProcessClassesToUpdate()
DeclId_t GetFunctionWithValues(ClassInfo_t *cl, const char *method, const char *params, Bool_t objectIsConst=kFALSE) final
Return pointer to cling DeclId for a method of a class with a certain prototype, i....
TString GetMangledName(TClass *cl, const char *method, const char *params, Bool_t objectIsConst=kFALSE) final
Return the cling mangled name for a method of a class with parameters params (params is a string of a...
const char * MethodInfo_Title(MethodInfo_t *minfo) const final
const char * BaseClassInfo_TmpltName(BaseClassInfo_t *bcinfo) const final
Bool_t Declare(const char *code) final
Declare code to the interpreter, without any of the interpreter actions that could trigger a re-inter...
const char * BaseClassInfo_FullName(BaseClassInfo_t *bcinfo) const final
void CallFunc_SetArgs(CallFunc_t *func, const char *param) const final
int UnloadFile(const char *path) const final
void CallFunc_Exec(CallFunc_t *func, void *address) const final
bool IsPointerType(const void *QualTypePtr) const
bool IsFloatingType(const void *QualTypePtr) const
Long_t FuncTempInfo_ExtraProperty(FuncTempInfo_t *) const final
Return the property not already defined in Property See TDictionary's EFunctionProperty.
bool CallFunc_IsValid(CallFunc_t *func) const final
const char * BaseClassInfo_Name(BaseClassInfo_t *bcinfo) const final
ROOT::TMetaUtils::TClingLookupHelper * fLookupHelper
const char * DataMemberInfo_ValidArrayIndex(DataMemberInfo_t *dminfo) const final
Int_t GetMore() const final
Return whether we are waiting for more input either because the collected input contains unbalanced b...
Bool_t fIsAutoParsingSuspended
std::string ToString(const char *type, void *obj) final
DeclId_t GetDeclId(const llvm::GlobalValue *gv) const
Return pointer to cling DeclId for a global value.
void Execute(const char *function, const char *params, int *error=nullptr) final
Execute a global function with arguments params.
bool ClassInfo_IsLoaded(ClassInfo_t *info) const final
Longptr_t ClassInfo_Tagnum(ClassInfo_t *info) const final
Long_t BaseClassInfo_Property(BaseClassInfo_t *bcinfo) const final
void CallFunc_SetFunc(CallFunc_t *func, ClassInfo_t *info, const char *method, const char *params, Longptr_t *Offset) const final
std::vector< std::string > GetUsingNamespaces(ClassInfo_t *cl) const final
Get the scopes representing using declarations of namespace.
const char * ClassInfo_FileName(ClassInfo_t *info) const final
void FuncTempInfo_Title(FuncTempInfo_t *, TString &name) const final
Return the comments associates with this function template.
const char * ClassInfo_TmpltName(ClassInfo_t *info) const final
void SaveContext() final
Save the current Cling state.
void LoadPCMImpl(TFile &pcmFile)
Tries to load a PCM from TFile; returns true on success.
Bool_t IsAutoLoadNamespaceCandidate(const clang::NamespaceDecl *nsDecl)
void ResetGlobals() final
Reset in Cling the list of global variables to the state saved by the last call to TCling::SaveGlobal...
void CodeComplete(const std::string &, size_t &, std::vector< std::string > &) final
The call to Cling's tab complition.
void ResetGlobalVar(void *obj) final
Reset the Cling 'user' global objects/variables state to the state saved by the last call to TCling::...
const char * MapCppName(const char *) const final
Interface to cling function.
Longptr_t Calc(const char *line, EErrorCode *error=nullptr) final
Directly execute an executable statement (e.g.
Int_t ReloadAllSharedLibraryMaps() final
Reload the library map entries coming from all the loaded shared libraries, after first unloading the...
void UpdateListOfGlobalFunctions() final
No op: see TClingCallbacks (used to update the list of global functions)
void DataMemberInfo_Delete(DataMemberInfo_t *dminfo) const final
const char * GetTopLevelMacroName() const final
Return the file name of the current un-included interpreted file.
void * fPrevLoadedDynLibInfo
void UpdateListOfDataMembers(TClass *cl) const
Update the list of pointers to data members for TClass cl This is now a nop.
void InspectMembers(TMemberInspector &, const void *obj, const TClass *cl, Bool_t isTransient) final
Visit all members over members, recursing over base classes.
Int_t SetClassSharedLibs(const char *cls, const char *libs) final
Register the AutoLoading information for a class.
MethodInfo_t * MethodInfo_FactoryCopy(MethodInfo_t *minfo) const final
std::set< const char * > fParsedPayloadsAddresses
CallFuncIFacePtr_t CallFunc_IFacePtr(CallFunc_t *func) const final
MethodArgInfo_t * MethodArgInfo_Factory() const final
static void UpdateClassInfo(char *name, Long_t tagnum)
No op: see TClingCallbacks.
DeclId_t GetFunction(ClassInfo_t *cl, const char *funcname) final
Return pointer to cling interface function for a method of a class with a certain name.
void ClassInfo_Delete(ClassInfo_t *info) const final
std::unique_ptr< cling::Interpreter > fInterpreter
EDataType ClassInfo_GetUnderlyingType(ClassInfo_t *info) const final
void FuncTempInfo_Delete(FuncTempInfo_t *) const final
Delete the FuncTempInfo_t.
DeclId_t GetFunctionTemplate(ClassInfo_t *cl, const char *funcname) final
Return pointer to cling interface function for a method of a class with a certain name.
Int_t DeleteVariable(const char *name) final
Undeclare obj called name.
Longptr_t DataMemberInfo_Offset(DataMemberInfo_t *dminfo) const final
CallFunc_t * CallFunc_Factory() const final
MethodInfo_t * MethodInfo_Factory() const final
Long_t DataMemberInfo_TypeProperty(DataMemberInfo_t *dminfo) const final
void ClearFileBusy() final
Reset the interpreter internal state in case a previous action was not correctly terminated.
cling::MetaProcessor * GetMetaProcessorImpl() const
bool DiagnoseIfInterpreterException(const std::exception &e) const final
void SetAllocunlockfunc(void(*)()) const final
[Place holder for Mutex Unlock] Provide the interpreter with a way to release a lock used to protect ...
std::set< size_t > fLookedUpClasses
virtual void AddAvailableIndentifiers(TSeqCollection &Idents) final
void TypedefInfo_Delete(TypedefInfo_t *tinfo) const final
void Reset() final
Pressing Ctrl+C should forward here.
const char * TypedefInfo_TrueName(TypedefInfo_t *tinfo) const final
int SetClassAutoLoading(int) const final
Enable/Disable the AutoLoading of libraries.
const char * ClassInfo_FullName(ClassInfo_t *info) const final
UInt_t AutoParseImplRecurse(const char *cls, bool topLevel)
Helper routine for TCling::AutoParse implementing the actual call to the parser and looping over temp...
const char * MethodInfo_TypeName(MethodInfo_t *minfo) const final
void CallFunc_SetArg(CallFunc_t *func, Long_t param) const final
const char * GetIncludePath() final
Refresh the list of include paths known to the interpreter and return it with -I prepended.
void UpdateListsOnUnloaded(const cling::Transaction &T)
Invalidate stored TCling state for declarations included in transaction ‘T’.
void UpdateClassInfoWithDecl(const clang::NamedDecl *ND)
Internal function. Inform a TClass about its new TagDecl or NamespaceDecl.
bool IsSameType(const void *QualTypePtr1, const void *QualTypePtr2) const
virtual void Initialize() final
Initialize the interpreter, once TROOT::fInterpreter is set.
int ClassInfo_GetMethodNArg(ClassInfo_t *info, const char *method, const char *proto, Bool_t objectIsConst=false, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const final
DeclId_t GetDataMember(ClassInfo_t *cl, const char *name) const final
Return pointer to cling Decl of global/static variable that is located at the address given by addr.
void FuncTempInfo_Name(FuncTempInfo_t *, TString &name) const final
Return the name of this function template.
std::unique_ptr< cling::MetaProcessor > fMetaProcessor
bool TypeInfo_IsValid(TypeInfo_t *tinfo) const final
bool RegisterPrebuiltModulePath(const std::string &FullPath, const std::string &ModuleMapName="module.modulemap") const final
std::string MethodInfo_TypeNormalizedName(MethodInfo_t *minfo) const final
const char * ClassInfo_Name(ClassInfo_t *info) const final
TClass * GenerateTClass(const char *classname, Bool_t emulation, Bool_t silent=kFALSE) final
Generate a TClass for the given class.
ULong64_t fTransactionCount
bool ClassInfo_HasDefaultConstructor(ClassInfo_t *info, Bool_t testio=kFALSE) const final
void EndOfLineAction() final
It calls a "fantom" method to synchronize user keyboard input and ROOT prompt line.
TypeInfo_t * TypeInfo_FactoryCopy(TypeInfo_t *) const final
void * TypeInfo_QualTypePtr(TypeInfo_t *tinfo) const
bool ClassInfo_HasMethod(ClassInfo_t *info, const char *name) const final
void ClassInfo_DeleteArray(ClassInfo_t *info, void *arena, bool dtorOnly) const final
std::map< size_t, std::vector< const char * > > fClassesHeadersMap
const char * DataMemberInfo_TypeTrueName(DataMemberInfo_t *dminfo) const final
virtual void ShutDown() final
void UpdateListOfTypes() final
No op: see TClingCallbacks (used to update the list of types)
Long_t TypedefInfo_Property(TypedefInfo_t *tinfo) const final
void RegisterRdictForLoadPCM(const std::string &pcmFileNameFullPath, llvm::StringRef *pcmContent)
Register Rdict data for future loading by LoadPCM;.
Longptr_t ProcessLineSynch(const char *line, EErrorCode *error=nullptr) final
Let cling process a command line synchronously, i.e we are waiting it will be finished.
TString GetMangledNameWithPrototype(TClass *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) final
Return the cling mangled name for a method of a class with a certain prototype, i....
static void UpdateAllCanvases()
Update all canvases at end the terminal input command.
Int_t LoadLibraryMap(const char *rootmapfile=nullptr) final
Load map between class and library.
Longptr_t BaseClassInfo_Tagnum(BaseClassInfo_t *bcinfo) const final
void LibraryUnloaded(const void *dyLibHandle, const char *canonicalName)
Collection abstract base class.
virtual Int_t GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual void Add(TObject *obj)=0
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
Bool_t Contains(const char *name) const
All ROOT classes may have RTTI (run time type identification) support added.
Bool_t IsPersistent() const
Basic data type descriptor (datatype information is obtained from CINT).
EMemberSelection
Kinds of members to include in lists.
TList * GetListOfKeys() const override
TDirectory::TContext keeps track and restore the current directory.
void GetObject(const char *namecycle, T *&ptr)
Get an object with proper type checking.
The TEnumConstant class implements the constants of the enum type.
The TEnum class implements the enum type.
const TSeqCollection * GetConstants() const
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
DeclId_t GetDeclId() const
const char * GetValue() const
The TEnv class reads config files, by default named .rootrc.
THashList * GetTable() const
Bool_t IgnoreDuplicates(Bool_t ignore)
If set to true, no warnings in case of duplicates are issued.
virtual void SetRcName(const char *name)
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
Read and parse the resource file for a certain level.
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
virtual TEnvRec * Lookup(const char *n) const
Loop over all resource records and return the one with name.
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Global functions class (global functions are obtained from CINT).
Global variables class (global variables are obtained from CINT).
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
TObject * Remove(TObject *obj) override
Remove object from the list.
THashTable implements a hash table to store TObject's.
This class defines an abstract interface to a generic command line interpreter.
virtual bool RegisterPrebuiltModulePath(const std::string &FullPath, const std::string &ModuleMapName="module.modulemap") const =0
virtual Bool_t HasPCMForLibrary(const char *libname) const =0
virtual Int_t AutoParse(const char *cls)=0
int(* AutoLoadCallBack_t)(const char *)
virtual const char * GetClassSharedLibs(const char *cls)=0
virtual Bool_t Declare(const char *code)=0
std::vector< std::pair< std::string, int > > FwdDeclArgsToKeepCollection_t
TDictionary::DeclId_t DeclId_t
virtual TObjArray * GetRootMapFiles() const =0
Book space in a file, create I/O buffers, to fill them, (un)compress them.
A collection of TDataMember objects designed for fast access given a DeclId_t and for keep track of T...
TObject * FindObject(const char *name) const override
Specialize FindObject to do search for the a data member just by name or create it if its not already...
TDictionary * Find(DeclId_t id) const
Return (after creating it if necessary) the TDataMember describing the data member corresponding to t...
TClass * GetClass() const
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
TEnum * Find(DeclId_t id) const
Return the TEnum corresponding to the Decl 'id' or NULL if it does not exist.
TEnum * Get(DeclId_t id, const char *name)
Return (after creating it if necessary) the TEnum describing the enum corresponding to the Decl 'id'.
TClass * GetClass() const
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
TFunctionTemplate * Get(DeclId_t id)
Return (after creating it if necessary) the TMethod or TFunction describing the function correspondin...
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
TFunction * Find(DeclId_t id) const
Return the TMethod or TFunction describing the function corresponding to the Decl 'id'.
void Add(TObject *obj) override
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
A TMemFile is like a normal TFile except that it reads and writes only from memory.
Abstract base class for accessing the data-members of a class.
const char * GetParent() const
virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr)
EObjectPointerState GetObjectValidity() const
virtual Bool_t IsTreatingNonAccessibleTypes()
void SetObjectValidity(EObjectPointerState val)
void InspectMember(const T &obj, const char *name, Bool_t isTransient)
Each ROOT method (see TMethod) has a linked list of its arguments.
const char * GetFullTypeName() const
Get full type description of method argument, e.g.: "class TDirectory*".
const char * GetDefault() const
Get default value of method argument.
Each ROOT class (see TClass) has a linked list of methods.
virtual TList * GetListOfMethodArgs()
Returns methodarg list and additionally updates fDataMember in TMethod by calling FindDataMember();.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
Int_t GetEntriesFast() const
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
void Clear(Option_t *option="") override
Remove all objects from the array.
virtual void Compress()
Remove empty slots from array.
Int_t GetEntries() const override
Return the number of objects in array (i.e.
TObject * At(Int_t idx) const override
TObject * Remove(TObject *obj) override
Remove object from array.
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
void Add(TObject *obj) override
Collectable string class.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
R__ALWAYS_INLINE Bool_t IsOnHeap() const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual const char * GetTitle() const
Returns title of object.
virtual TClass * IsA() const
@ kInvalidObject
if object ctor succeeded but object should not be used
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Persistent version of a TClass.
static const TString & GetIncludeDir()
Get the include directory in the installation. Static utility function.
static const char * GetMacroPath()
Get macro search path. Static utility function.
static const std::vector< std::string > & AddExtraInterpreterArgs(const std::vector< std::string > &args)
Provide command line arguments to the interpreter construction.
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
static const char **& GetExtraInterpreterArgs()
INTERNAL function! Used by rootcling to inject interpreter arguments through a C-interface layer.
static const TString & GetSharedLibDir()
Get the shared libraries directory in the installation. Static utility function.
Sequenceable collection abstract base class.
void Add(TObject *obj) override
Describes a persistent version of a class.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Prepend(const char *cs)
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual const char * Getenv(const char *env)
Get environment variable.
virtual const char * GetIncludePath()
Get the list of include path.
virtual TString SplitAclicMode(const char *filename, TString &mode, TString &args, TString &io) const
This method split a filename of the form:
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual int GetProcInfo(ProcInfo_t *info) const
Returns cpu and memory used by this process into the ProcInfo_t structure.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual const char * GetDynamicPath()
Return the dynamic path (used to find shared libraries).
virtual const char * FindDynamicLibrary(TString &lib, Bool_t quiet=kFALSE)
Find a dynamic library using the system search paths.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual int CompileMacro(const char *filename, Option_t *opt="", const char *library_name="", const char *build_dir="", UInt_t dirmode=0)
This method compiles and loads a shared library containing the code from the file "filename".
virtual const char * WorkingDirectory()
Return working directory.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual void Setenv(const char *name, const char *value)
Set environment variable.
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
virtual void StackTrace()
Print a stack trace.
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
virtual TVirtualMutex * Factory(Bool_t=kFALSE)=0
TVirtualPad is an abstract base class for the Pad and Canvas classes.
static void SetFactory(TVirtualStreamerInfo *factory)
static function: Set the StreamerInfo factory
@ kNeedObjectForVirtualBaseClass
const std::string & GetPathSeparator()
const char & GetEnvPathSeparator()
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
R__EXTERN TVirtualRWMutex * gCoreMutex
bool IsStdPairBase(std::string_view name)
bool IsStdArray(std::string_view name)
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
bool IsStdPair(std::string_view name)
std::string InsertStd(const char *tname)
std::string GetLong64_Name(const char *original)
Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.
char * DemangleTypeIdName(const std::type_info &ti, int &errorCode)
Demangle in a portable way the type id name.
const char * GetUnqualifiedName(const char *name)
Return the start of the unqualified name include in 'original'.
void Init(TClassEdit::TInterpreterLookupHelper *helper)
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
char * DemangleName(const char *mangled_name, int &errorCode)
int GetSplit(const char *type, std::vector< std::string > &output, int &nestedLoc, EModType mode=TClassEdit::kNone)
Stores in output (after emptying it) the split type.
EComplexType GetComplexType(const char *)
RAII used to store Parser, Sema, Preprocessor state for recursive parsing.
std::vector< std::string > fElements
void ShortType(std::string &answer, int mode)
Return the absolute type of typeDesc into the string answ.
std::unique_ptr< ROOT::TVirtualRWMutex::State > fState
State of gCoreMutex when the first interpreter-related function was invoked.
Int_t fRecurseCount
Interpreter-related functions will push the "entry" lock state to *this.
A read-only memory range which we do not control.