60#include "RConfigure.h"
61#include "compiledata.h"
62#include "TClingUtils.h"
77#include "clang/AST/ASTContext.h"
78#include "clang/AST/Decl.h"
79#include "clang/AST/DeclarationName.h"
80#include "clang/AST/GlobalDecl.h"
81#include "clang/AST/RecordLayout.h"
82#include "clang/AST/RecursiveASTVisitor.h"
83#include "clang/AST/Type.h"
84#include "clang/Basic/SourceLocation.h"
85#include "clang/Basic/Specifiers.h"
86#include "clang/Basic/TargetInfo.h"
87#include "clang/CodeGen/ModuleBuilder.h"
88#include "clang/Frontend/CompilerInstance.h"
89#include "clang/Frontend/FrontendDiagnostic.h"
90#include "clang/Lex/HeaderSearch.h"
91#include "clang/Lex/Preprocessor.h"
92#include "clang/Lex/PreprocessorOptions.h"
93#include "clang/Sema/Lookup.h"
94#include "clang/Sema/Sema.h"
95#include "clang/Parse/Parser.h"
97#include "cling/Interpreter/ClangInternalState.h"
98#include "cling/Interpreter/DynamicLibraryManager.h"
99#include "cling/Interpreter/Interpreter.h"
100#include "cling/Interpreter/LookupHelper.h"
101#include "cling/Interpreter/Value.h"
102#include "cling/Interpreter/Transaction.h"
103#include "cling/MetaProcessor/MetaProcessor.h"
104#include "cling/Utils/AST.h"
105#include "cling/Utils/ParserStateRAII.h"
106#include "cling/Utils/SourceNormalization.h"
107#include "cling/Interpreter/Exception.h"
109#include "llvm/IR/GlobalValue.h"
110#include "llvm/IR/Module.h"
112#include "llvm/Support/DynamicLibrary.h"
113#include "llvm/Support/raw_ostream.h"
114#include "llvm/Support/Path.h"
115#include "llvm/Support/Process.h"
116#include "llvm/Object/ObjectFile.h"
117#include "llvm/Support/FileSystem.h"
118#include "llvm/Object/SymbolicFile.h"
132#include <unordered_map>
139#define R__DLLEXPORT __attribute__ ((visibility ("default")))
147#include <mach-o/dyld.h>
148#include <mach-o/loader.h>
155#if defined(__CYGWIN__)
156#include <sys/cygwin.h>
157#define HMODULE void *
159 __declspec(dllimport)
void * __stdcall GetCurrentProcess();
160 __declspec(dllimport)
bool __stdcall EnumProcessModules(
void *,
void **,
unsigned long,
unsigned long *);
161 __declspec(dllimport)
unsigned long __stdcall GetModuleFileNameExW(
void *,
void *,
wchar_t *,
unsigned long);
168# define STDIN_FILENO 0
171# define STDOUT_FILENO 1
174# define STDERR_FILENO 2
183#undef GetModuleFileName
184#define RTLD_DEFAULT ((void *)::GetModuleHandle(NULL))
185#define dlsym(library, function_name) ::GetProcAddress((HMODULE)library, function_name)
186#define dlopen(library_name, flags) ::LoadLibraryA(library_name)
187#define dlclose(library) ::FreeLibrary((HMODULE)library)
188#define R__DLLEXPORT __declspec(dllexport)
196 class TCling_UnloadMarker {
198 ~TCling_UnloadMarker() {
204 static TCling_UnloadMarker gTClingUnloadMarker;
213 return D->getDeclContext();
216 return llvm::dyn_cast<clang::NamespaceDecl>(DC);
219 return llvm::dyn_cast<clang::RecordDecl>(DC);
222 return DC->dumpDeclContext();
231 return ((clang::Decl*)D)->dump();
234 if (clang::NamedDecl* ND = llvm::dyn_cast<clang::NamedDecl>(D)) {
237 llvm::raw_string_ostream OS(
name);
238 ND->getNameForDiagnostic(OS, D->getASTContext().getPrintingPolicy(),
241 printf(
"%s\n",
name.c_str());
249 return D->isInvalidDecl();
253 assert(info && info->
IsValid());
254 return info->
GetDecl()->isInvalidDecl();
258using namespace clang;
262 static const std::string gInterpreterClassDef = R
"ICF(
264#define ClassDef(name, id) \
265_ClassDefInterp_(name,id,virtual,) \
266static int DeclFileLine() { return __LINE__; }
268#define ClassDefNV(name, id) \
269_ClassDefInterp_(name,id,,) \
270static int DeclFileLine() { return __LINE__; }
271#undef ClassDefOverride
272#define ClassDefOverride(name, id) \
273_ClassDefInterp_(name,id,,override) \
274static int DeclFileLine() { return __LINE__; }
277 static const std::string gNonInterpreterClassDef = R
"ICF(
278#define __ROOTCLING__ 1
280#define ClassDef(name,id) \
281_ClassDefOutline_(name,id,virtual,) \
282static int DeclFileLine() { return __LINE__; }
284#define ClassDefNV(name, id)\
285_ClassDefOutline_(name,id,,)\
286static int DeclFileLine() { return __LINE__; }
287#undef ClassDefOverride
288#define ClassDefOverride(name, id)\
289_ClassDefOutline_(name,id,,override)\
290static int DeclFileLine() { return __LINE__; }
294 static const std::string gClassDefInterpMacro = R
"ICF(
297#define _ClassDefInterp_(name,id,virtual_keyword, overrd) \
300 static TClass *Class() { static TClass* sIsA = 0; if (!sIsA) sIsA = TClass::GetClass(#name); return sIsA; } \
301 static const char *Class_Name() { return #name; } \
302 virtual_keyword Bool_t CheckTObjectHashConsistency() const overrd { return true; } \
303 static Version_t Class_Version() { return id; } \
304 static TClass *Dictionary() { return 0; } \
305 virtual_keyword TClass *IsA() const overrd { return name::Class(); } \
306 virtual_keyword void ShowMembers(TMemberInspector&insp) const overrd { ::ROOT::Class_ShowMembers(name::Class(), this, insp); } \
307 virtual_keyword void Streamer(TBuffer&) overrd { ::Error("Streamer", "Cannot stream interpreted class."); } \
308 void StreamerNVirtual(TBuffer&ClassDef_StreamerNVirtual_b) { name::Streamer(ClassDef_StreamerNVirtual_b); } \
309 static const char *DeclFileName() { return __FILE__; } \
310 static int ImplFileLine() { return 0; } \
311 static const char *ImplFileName() { return __FILE__; }
342 return ((
TCling*)
gCling)->LibraryLoadingFailed(errmessage, libStem, permanent, resolved);
381 static vector<const NamedDecl*> updateList;
384 if (entered) topLevel =
kFALSE;
399 updateList.push_back(TD);
402 while (!updateList.empty()) {
404 updateList.pop_back();
411 const clang::Decl* D =
static_cast<const clang::Decl*
>(enumObj->
GetDeclId());
412 if(
const clang::EnumDecl* ED = dyn_cast<clang::EnumDecl>(D)) {
414 for (EnumDecl::enumerator_iterator EDI = ED->enumerator_begin(),
415 EDE = ED->enumerator_end(); EDI != EDE; ++EDI) {
417 std::string constbuf;
418 if (
const NamedDecl* END = llvm::dyn_cast<NamedDecl>(*EDI)) {
419 PrintingPolicy Policy((*EDI)->getASTContext().getPrintingPolicy());
420 llvm::raw_string_ostream stream(constbuf);
422 Policy.AnonymousTagLocations =
false;
423 (END)->getNameForDiagnostic(stream, Policy,
false);
425 const char* constantName = constbuf.c_str();
429 const llvm::APSInt valAPSInt = (*EDI)->getInitVal();
430 if (valAPSInt.isSigned()) {
431 value = valAPSInt.getSExtValue();
433 value = valAPSInt.getZExtValue();
440 DataMemberInfo_t* dmInfo = (DataMemberInfo_t*) tcDmInfo;
444 enumConstant =
new TEnumConstant(dmInfo, constantName, value, enumObj);
451 globals->
Add(enumConstant);
464 const clang::Decl* D =
static_cast<const clang::Decl*
>(VD);
466 if (
const EnumDecl* ED = llvm::dyn_cast<EnumDecl>(D)) {
468 PrintingPolicy Policy(ED->getASTContext().getPrintingPolicy());
469 llvm::raw_string_ostream stream(buf);
471 Policy.AnonymousTagLocations =
false;
472 ED->getNameForDiagnostic(stream, Policy,
false);
478 const char*
name = buf.c_str();
489 const clang::Decl* D =
static_cast<const clang::Decl*
>(DV);
491 if (!D->isCanonicalDecl() && !isa<clang::NamespaceDecl>(D)
492 && !dyn_cast<clang::RecordDecl>(D))
return;
494 if (isa<clang::FunctionDecl>(D->getDeclContext())
495 || isa<clang::TagDecl>(D->getDeclContext()))
499 if (
const clang::CXXRecordDecl* RD = dyn_cast<clang::CXXRecordDecl>(D)) {
500 if (RD->getDescribedClassTemplate())
502 }
else if (
const clang::FunctionDecl* FD = dyn_cast<clang::FunctionDecl>(D)) {
503 if (FD->getDescribedFunctionTemplate())
507 if (
const RecordDecl *TD = dyn_cast<RecordDecl>(D)) {
508 if (TD->isCanonicalDecl() || TD->isThisDeclarationADefinition())
511 else if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
513 if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
517 }
else if (
const NamespaceDecl* NSD = dyn_cast<NamespaceDecl>(D)) {
522 if (!isa<TranslationUnitDecl>(ND->getDeclContext()))
526 if (isa<EnumDecl>(ND))
531 if (!(isa<VarDecl>(ND)))
535 if (
gROOT->GetListOfGlobals()->FindObject(ND->getNameAsString().c_str()))
539 gROOT->GetListOfGlobals()->Add(
new TGlobal((DataMemberInfo_t *)
541 cast<ValueDecl>(ND), 0)));
571 const char* canonicalName) {
573 ((
TCling*)
gCling)->LibraryLoaded(dyLibHandle, canonicalName);
577 const char* canonicalName) {
579 ((
TCling*)
gCling)->LibraryUnloaded(dyLibHandle, canonicalName);
595 cling::DynamicLibraryManager::ExposeHiddenSharedLibrarySymbols(interpLibHandle);
596 return new TCling(
"C++",
"cling C++ Interpreter", argv);
618 return ((
TCling*)
gCling)->GetClassSharedLibs(className);
630 return ((
TCling*)
gCling)->IsAutoLoadNamespaceCandidate(nsDecl);
635 string file(fileName);
641 string &args,
string &io,
string &fname)
643 string file(fileName);
644 TString f, amode, arguments, aclicio;
646 mode = amode.
Data(); args = arguments.
Data();
647 io = aclicio.
Data(); fname =
f.Data();
652 std::vector<std::string> &sPaths,
653 cling::Interpreter &interpreter,
bool searchSystem);
662 char *__unDName(
char *demangled,
const char *mangled,
int out_len,
663 void * (* pAlloc )(
size_t),
void (* pFree )(
void *),
664 unsigned short int flags);
676 using namespace clang;
677 if (NamespaceDecl* nsd = llvm::dyn_cast<NamespaceDecl>(decl)){
681 if (ClassTemplateDecl* ctd = llvm::dyn_cast<ClassTemplateDecl>(decl)){
693 return ((
TCling*)
gCling)->LazyFunctionCreatorAutoload(mangled_name);
702 const std::vector<std::string> &headers,
703 const std::vector<std::string> &fwdDecls,
704 const std::vector<std::string> &unknown)
710 if (classes.empty()) {
714 const std::string& className = classes[0];
716 TString fileName =
"AutoDict_";
717 std::string::const_iterator sIt;
718 for (sIt = className.begin(); sIt != className.end(); ++sIt) {
719 if (*sIt ==
'<' || *sIt ==
'>' ||
720 *sIt ==
' ' || *sIt ==
'*' ||
721 *sIt ==
',' || *sIt ==
'&' ||
729 if (classes.size() > 1) {
731 std::vector<std::string>::const_iterator it = classes.begin();
732 while ((++it) != classes.end()) {
733 for (
UInt_t cursor = 0; cursor != it->length(); ++cursor) {
734 chk = chk * 3 + it->at(cursor);
747 static const std::set<std::string> sSTLTypes {
748 "vector",
"list",
"forward_list",
"deque",
"map",
"unordered_map",
"multimap",
749 "unordered_multimap",
"set",
"unordered_set",
"multiset",
"unordered_multiset",
750 "queue",
"priority_queue",
"stack",
"iterator"};
751 std::vector<std::string>::const_iterator it;
752 std::string fileContent(
"");
753 for (it = headers.begin(); it != headers.end(); ++it) {
754 fileContent +=
"#include \"" + *it +
"\"\n";
756 for (it = unknown.begin(); it != unknown.end(); ++it) {
762 while (dirbase.
Length() && dirbase !=
"."
763 && dirbase !=
"include" && dirbase !=
"inc"
764 && dirbase !=
"prec_stl") {
768 fileContent +=
TString(
"#include \"") + header +
"\"\n";
771 for (it = fwdDecls.begin(); it != fwdDecls.end(); ++it) {
772 fileContent +=
"class " + *it +
";\n";
774 fileContent +=
"#ifdef __CINT__ \n";
775 fileContent +=
"#pragma link C++ nestedclasses;\n";
776 fileContent +=
"#pragma link C++ nestedtypedefs;\n";
777 for (it = classes.begin(); it != classes.end(); ++it) {
779 size_t posTemplate =
n.find(
'<');
780 std::set<std::string>::const_iterator iSTLType = sSTLTypes.end();
781 if (posTemplate != std::string::npos) {
782 n.erase(posTemplate, std::string::npos);
783 if (
n.compare(0, 5,
"std::") == 0) {
786 iSTLType = sSTLTypes.find(
n);
788 fileContent +=
"#pragma link C++ class ";
789 fileContent += *it +
"+;\n" ;
790 fileContent +=
"#pragma link C++ class ";
791 if (iSTLType != sSTLTypes.end()) {
795 fileContent += *it +
"::*;\n" ;
800 fileContent += *it +
"::*+;\n" ;
803 fileContent +=
"#endif\n";
807 filePointer = fopen(fileName,
"w");
808 if (filePointer == NULL) {
814 fprintf(filePointer,
"%s", fileContent.c_str());
830 const std::vector<std::string> &headers,
831 const std::vector<std::string> &fwdDecls,
832 const std::vector<std::string> &unknown)
838 std::vector<std::string> classes;
839 classes.push_back(className);
867 void exceptionErrorHandler(
void * ,
868 const std::string& reason,
870 throw std::runtime_error(std::string(
">>> Interpreter compilation error:\n") + reason);
884 class clangDiagSuppr {
886 clangDiagSuppr(clang::DiagnosticsEngine& diag): fDiagEngine(diag){
887 fOldDiagValue = fDiagEngine.getIgnoreAllWarnings();
888 fDiagEngine.setIgnoreAllWarnings(
true);
892 fDiagEngine.setIgnoreAllWarnings(fOldDiagValue);
895 clang::DiagnosticsEngine& fDiagEngine;
917 unsigned long offset = 0;
918 if (strncmp(tname.c_str(),
"const ", 6) == 0) {
921 unsigned long end = tname.length();
922 while( end && (tname[end-1]==
'&' || tname[end-1]==
'*' || tname[end-1]==
']') ) {
923 if ( tname[end-1]==
']' ) {
925 while ( end && tname[end-1]!=
'[' ) --end;
929 std::string innerbuf;
931 if (end != tname.length()) {
932 innerbuf = tname.substr(offset,end-offset);
933 inner = innerbuf.c_str();
935 inner = tname.c_str()+offset;
939 if (
gROOT->GetListOfClasses()->FindObject(inner)
949 const char *newname =
type->GetFullTypeName();
951 newname =
"Long64_t";
953 newname =
"ULong64_t";
955 if (strcmp(inner,newname) == 0) {
958 if (offset) result =
"const ";
960 if ( end != tname.length() ) {
961 result += tname.substr(end,tname.length()-end);
963 if (result == tname) result.clear();
969 if (lastPos != inner)
973 const auto enName = lastPos;
974 const auto scopeNameSize = ((
Long64_t)lastPos - (
Long64_t)inner) /
sizeof(
decltype(*lastPos)) - 2;
975 char *scopeName =
new char[scopeNameSize + 1];
976 strncpy(scopeName, inner, scopeNameSize);
977 scopeName[scopeNameSize] =
'\0';
979 if (
auto scope =
static_cast<TClass *
>(
gROOT->GetListOfClasses()->FindObject(scopeName))) {
980 auto enumTable =
dynamic_cast<const THashList *
>(scope->GetListOfEnums(
false));
981 if (enumTable && enumTable->THashList::FindObject(enName))
return true;
985 auto listOfEnums = scope->GetListOfEnums();
987 auto enumTable =
dynamic_cast<const THashList *
>(listOfEnums);
988 if (enumTable && enumTable->THashList::FindObject(enName))
return true;
995 auto enumTable =
dynamic_cast<const THashList *
>(
gROOT->GetListOfEnums());
996 if (enumTable && enumTable->THashList::FindObject(inner))
return true;
1019 return fContent.c_str();
1027 bool notPresent = fLinesHashSet.emplace(fHashFunc(str)).second;
1043 const std::string& FullPath) {
1044 assert(llvm::sys::path::is_absolute(FullPath));
1045 FileManager& FM = PP.getFileManager();
1048 const DirectoryEntry *DE = FM.getDirectory(FullPath);
1050 HeaderSearch& HS = PP.getHeaderSearchInfo();
1051 const FileEntry *FE = HS.lookupModuleMapFile(DE,
false);
1055 if (!HS.loadModuleMapFile(FE,
false)) {
1058 HS.getHeaderSearchOpts().AddPrebuiltModulePath(FullPath);
1061 Error(
"TCling::LoadModule",
"Could not load modulemap in the current directory");
1069static bool LoadModule(
const std::string &ModuleName, cling::Interpreter &interp,
bool Complain =
true)
1078 clang::Preprocessor& PP = interp.getCI()->getPreprocessor();
1080 assert(!currentDir.empty());
1082 return interp.loadModule(ModuleName, Complain);
1088static void LoadModules(
const std::vector<std::string> &modules, cling::Interpreter &interp)
1090 for (
const auto &modName : modules)
1096 const static bool foundSymbol = dlsym(RTLD_DEFAULT,
"usedToIdentifyRootClingByDlSym");
1102 const HeaderSearchOptions &HSOpts = PP.getHeaderSearchInfo().getHeaderSearchOpts();
1104 std::string ModuleFileName;
1105 if (!HSOpts.PrebuiltModulePaths.empty())
1107 ModuleFileName = PP.getHeaderSearchInfo().getModuleFileName(M->Name,
"",
true);
1108 if (ModuleFileName.empty())
return "";
1110 std::string ModuleName = llvm::sys::path::filename(ModuleFileName);
1112 return std::string(llvm::sys::path::stem(ModuleName));
1129#ifdef R__USE_CXXMODULES
1133 llvm::install_fatal_error_handler(&exceptionErrorHandler);
1137 std::vector<std::string> clingArgsStorage;
1138 clingArgsStorage.push_back(
"cling4root");
1139 for (
const char*
const* arg = argv; *arg; ++arg)
1140 clingArgsStorage.push_back(*arg);
1143 if (!fromRootCling) {
1144 ROOT::TMetaUtils::SetPathsForRelocatability(clingArgsStorage);
1148 clingArgsStorage.push_back(
"-I" + interpInclude);
1151 clingArgsStorage.push_back(
"-I" + interpInclude +
"/cling");
1162 std::string pchFilename = interpInclude +
"/allDict.cxx.pch";
1167 clingArgsStorage.push_back(
"-include-pch");
1168 clingArgsStorage.push_back(pchFilename);
1171 clingArgsStorage.push_back(
"-Wno-undefined-inline");
1172 clingArgsStorage.push_back(
"-fsigned-char");
1176 llvm::Optional<std::string> EnvOpt = llvm::sys::Process::GetEnv(
"EXTRA_CLING_ARGS");
1177 if (EnvOpt.hasValue()) {
1178 StringRef Env(*EnvOpt);
1179 while (!Env.empty()) {
1181 std::tie(Arg, Env) = Env.split(
' ');
1182 clingArgsStorage.push_back(Arg.str());
1187 EnvOpt = llvm::sys::Process::GetEnv(
"ROOT_CLING_TIMING");
1188 if (EnvOpt.hasValue())
1189 clingArgsStorage.push_back(
"-ftime-report");
1195 clingArgsStorage.push_back(
"-modulemap_overlay=" + std::string(
TROOT::GetIncludeDir().Data()));
1197 std::vector<const char*> interpArgs;
1198 for (std::vector<std::string>::const_iterator iArg = clingArgsStorage.begin(),
1199 eArg = clingArgsStorage.end(); iArg != eArg; ++iArg)
1200 interpArgs.push_back(iArg->c_str());
1208 interpArgs.push_back(
"-fmodules");
1212 interpArgs.push_back(
"-Rmodule-build");
1217 interpArgs.push_back(
"-ffast-math");
1220#ifdef R__EXTERN_LLVMDIR
1221 TString llvmResourceDir = R__EXTERN_LLVMDIR;
1227 extraArgs && *extraArgs; ++extraArgs) {
1228 if (!strcmp(*extraArgs,
"-resource-dir")) {
1230 llvmResourceDir = *(++extraArgs);
1232 interpArgs.push_back(*extraArgs);
1237 interpArgs.push_back(arg.c_str());
1240 fInterpreter =
new cling::Interpreter(interpArgs.size(),
1244 if (!fromRootCling) {
1249 fInterpreter->getCI()->getPreprocessorOpts().DisablePCHValidation =
true;
1253 fInterpreter->getCI()->getLangOpts().SpellChecking =
false;
1259 static llvm::raw_fd_ostream fMPOuts (STDOUT_FILENO,
false);
1274 std::vector<std::string> CoreModules = {
"ROOT_Foundation_C",
"ROOT_Config",
1275 "ROOT_Foundation_Stage1_NoRTTI",
"Core",
"RIO"};
1278 static constexpr std::array<const char*, 3> ExcludeModules =
1279 { {
"Rtools",
"RSQLite",
"RInterface"} };
1284 if (!fromRootCling) {
1287 clang::ModuleMap &moduleMap = CI.getPreprocessor().getHeaderSearchInfo().getModuleMap();
1288 clang::Preprocessor &PP = CI.getPreprocessor();
1289 std::vector<std::string> ModulesPreloaded;
1291 for (
auto I = moduleMap.module_begin(),
E = moduleMap.module_end();
I !=
E; ++
I) {
1292 clang::Module *M =
I->second;
1296 if (!ModuleName.empty() &&
1297 std::find(CoreModules.begin(), CoreModules.end(), ModuleName) == CoreModules.end()
1298 && std::find(ExcludeModules.begin(), ExcludeModules.end(), ModuleName) == ExcludeModules.end()) {
1299 if (M->IsSystem && !M->IsMissingRequirement)
1301 else if (!M->IsSystem && !M->IsMissingRequirement)
1302 ModulesPreloaded.push_back(ModuleName);
1309 assert(
fInterpreter->getMacro(
"gROOT") &&
"Couldn't load gROOT macro?");
1317 fInterpreter->declare(
"#ifdef I\n #undef I\n #endif\n");
1321 fInterpreter->declare(
"#ifdef PI\n #undef PI\n #endif\n");
1322 fInterpreter->declare(
"#ifdef ERROR\n #undef ERROR\n #endif\n");
1328 if (fromRootCling) {
1330 "#include <string>\n"
1331 "using std::string;\n"
1332 "#include <cassert>\n");
1335 + gClassDefInterpMacro +
"\n"
1336 + gInterpreterClassDef +
"\n"
1338 "#define ClassImp(X);\n"
1339 "#include <string>\n"
1340 "using namespace std;\n"
1341 "#include <cassert>\n");
1372 if (!fromRootCling) {
1379 std::unique_ptr<TClingCallbacks>
1403#if defined(R__MUST_REVISIT)
1404#if R__MUST_REVISIT(6,2)
1405 Warning(
"~TCling",
"Interface not available yet.");
1406#ifdef R__COMPLETE_MEM_TERMINATION
1433#if defined(__CYGWIN__) && defined(__GNUC__)
1435#elif defined(G__WIN32)
1436 MEMORY_BASIC_INFORMATION mbi;
1437 if (!VirtualQuery (func, &mbi,
sizeof (mbi)))
1442 HMODULE hMod = (HMODULE) mbi.AllocationBase;
1443 char moduleName[MAX_PATH];
1445 if (!GetModuleFileNameA (hMod, moduleName,
sizeof (moduleName)))
1452 if (dladdr((
void*)func, &info) == 0) {
1456 if (strchr(info.dli_fname,
'/'))
1457 return info.dli_fname;
1461#
if defined(R__MACOSX)
1462 char buf[PATH_MAX] = { 0 };
1463 uint32_t bufsize =
sizeof(buf);
1464 if (_NSGetExecutablePath(buf, &bufsize) >= 0)
1466 return info.dli_fname;
1467# elif defined(R__UNIX)
1468 char buf[PATH_MAX] = { 0 };
1470 if (readlink(
"/proc/self/exe", buf,
sizeof(buf)) > 0)
1472 std::string pipeCmd = std::string(
"which \"") + info.dli_fname +
"\"";
1473 FILE* pipe = popen(pipeCmd.c_str(),
"r");
1475 return info.dli_fname;
1477 while (fgets(buf,
sizeof(buf), pipe)) {
1483# error "Unsupported platform."
1497 auto setFactory = []() {
1501 static bool doneFactory = setFactory();
1514 assert(!pcmFileNameFullPath.empty());
1515 assert(llvm::sys::path::is_absolute(pcmFileNameFullPath));
1516 if (!llvm::sys::fs::exists(pcmFileNameFullPath)) {
1521 TString pcmFileName = pcmFileNameFullPath;
1528 if (
gROOT->IsRootFile(pcmFileName)) {
1532 ::Info(
"TCling::LoadPCM",
"Loading ROOT PCM %s", pcmFileName.
Data());
1539 TFile *pcmFile =
new TFile(pcmFileName+
"?filetype=pcm",
"READ");
1547 (listOfKeys->GetSize() == 0) ||
1549 (listOfKeys->GetSize() == 1) &&
1550 !strcmp(((
TKey*)listOfKeys->At(0))->GetName(),
"EMPTY")
1561 ::Info(
"TCling::LoadPCM",
"reading protoclasses for %s \n",pcmFileName.
Data());
1563 pcmFile->
GetObject(
"__ProtoClasses", protoClasses);
1566 for (
auto obj : *protoClasses) {
1576 for (
auto proto : *protoClasses) {
1585 ::Error(
"TCling::LoadPCM",
"Inconsistent TClassTable for %s",
1597 protoClasses->Clear();
1598 delete protoClasses;
1602 pcmFile->
GetObject(
"__Typedefs", dataTypes);
1604 for (
auto typedf: *dataTypes)
1605 gROOT->GetListOfTypes()->Add(typedf);
1614 auto listOfGlobals =
gROOT->GetListOfGlobals();
1615 auto listOfEnums =
dynamic_cast<THashList*
>(
gROOT->GetListOfEnums());
1617 for (
auto selEnum: *enums){
1618 const char* enumScope = selEnum->
GetTitle();
1619 const char* enumName = selEnum->GetName();
1620 if (strcmp(enumScope,
"") == 0){
1623 if (!listOfEnums->THashList::FindObject(enumName)){
1624 ((
TEnum*) selEnum)->SetClass(
nullptr);
1625 listOfEnums->Add(selEnum);
1628 if (!listOfGlobals->FindObject(enumConstant)){
1629 listOfGlobals->Add(enumConstant);
1637 if (!nsTClassEntry){
1640 auto listOfEnums = nsTClassEntry->
fEnums.load();
1651 if (listOfEnums && !listOfEnums->THashList::FindObject(enumName)){
1652 ((
TEnum*) selEnum)->SetClass(nsTClassEntry);
1653 listOfEnums->Add(selEnum);
1666 ::Info(
"TCling::LoadPCM",
"Loading clang PCM %s", pcmFileName.
Data());
1675 using namespace clang;
1677 class ExtLexicalStorageAdder:
public RecursiveASTVisitor<ExtLexicalStorageAdder>{
1682 bool VisitRecordDecl(clang::RecordDecl* rcd){
1684 Info(
"ExtLexicalStorageAdder",
1685 "Adding external lexical storage to class %s",
1686 rcd->getNameAsString().c_str());
1687 auto reDeclPtr = rcd->getMostRecentDecl();
1689 reDeclPtr->setHasExternalLexicalStorage();
1690 }
while ((reDeclPtr = reDeclPtr->getPreviousDecl()));
1709 "libforward_listDict",
1717 "libunordered_setDict",
1718 "libunordered_multisetDict",
1719 "libunordered_mapDict",
1720 "libunordered_multimapDict",
1736 const char** headers,
1737 const char** includePaths,
1738 const char* payloadCode,
1739 const char* fwdDeclsCode,
1740 void (*triggerFunc)(),
1742 const char** classesHeaders,
1743 Bool_t lateRegistration ,
1750 if (fromRootCling)
return;
1759 bool isACLiC = strstr(modulename,
"_ACLiC_dict") !=
nullptr;
1760 if (hasHeaderParsingOnDemand && isACLiC) {
1762 Info(
"TCling::RegisterModule",
1763 "Header parsing on demand is active but this is an Aclic library. Disabling it for this library.");
1764 hasHeaderParsingOnDemand =
false;
1778 for (
const char** inclPath = includePaths; *inclPath; ++inclPath) {
1781 cling::Transaction*
T = 0;
1783 for (
auto& fwdDeclArgToSkipPair : fwdDeclsArgToSkip){
1784 const std::string& fwdDecl = fwdDeclArgToSkipPair.first;
1785 const int nArgsToSkip = fwdDeclArgToSkipPair.second;
1787 assert(cling::Interpreter::kSuccess == compRes &&
1788 "A fwd declaration could not be compiled");
1789 if (compRes!=cling::Interpreter::kSuccess){
1790 Warning(
"TCling::RegisterModule",
1791 "Problems in declaring string '%s' were encountered.",
1798 fNormalizedCtxt->AddTemplAndNargsToKeep(TD->getCanonicalDecl(), nArgsToSkip);
1806 TString code = gNonInterpreterClassDef;
1808 code += payloadCode;
1812 if (dyLibName.empty()) {
1813 ::Error(
"TCling::RegisterModule",
"Dictionary trigger function for %s not found", modulename);
1818 bool isSharedLib = cling::DynamicLibraryManager::isSharedLibrary(dyLibName);
1820 bool wasDlopened =
false;
1825 if (!lateRegistration) {
1832 void* dyLibHandle = dlopen(dyLibName.c_str(), RTLD_LAZY | RTLD_GLOBAL);
1835 char dyLibError[1000];
1836 FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
1837 dyLibError,
sizeof(dyLibError), NULL);
1839 const char* dyLibError = dlerror();
1844 ::Info(
"TCling::RegisterModule",
1845 "Cannot open shared library %s for dictionary %s:\n %s",
1846 dyLibName.c_str(), modulename, dyLibError);
1856 if (hasHeaderParsingOnDemand && fwdDeclsCode){
1859 std::string fwdDeclsCodeLessEnums;
1863 std::string fwdDeclsLine;
1864 std::istringstream fwdDeclsCodeStr(fwdDeclsCode);
1865 std::vector<std::string> scopes;
1866 while (std::getline(fwdDeclsCodeStr, fwdDeclsLine)) {
1867 const auto enumPos = fwdDeclsLine.find(
"enum __attribute__((annotate(\"");
1869 if (enumPos != std::string::npos) {
1876 auto nsPos = fwdDeclsLine.find(
"namespace");
1877 R__ASSERT(nsPos < enumPos &&
"Inconsistent enum and enclosing scope parsing!");
1878 while (nsPos < enumPos && nsPos != std::string::npos) {
1880 const auto nsNameStart = nsPos + 10;
1881 const auto nsNameEnd = fwdDeclsLine.find(
'{', nsNameStart);
1882 const auto nsName = fwdDeclsLine.substr(nsNameStart, nsNameEnd - nsNameStart);
1883 scopes.push_back(nsName);
1884 nsPos = fwdDeclsLine.find(
"namespace", nsNameEnd);
1887 clang::DeclContext* DC = 0;
1888 for (
auto &&aScope: scopes) {
1889 DC = cling::utils::Lookup::Namespace(&
fInterpreter->getSema(), aScope.c_str(), DC);
1895 if (scopes.empty() || DC) {
1897 size_t posEnumName = fwdDeclsLine.find(
"\"))) ", 32);
1898 R__ASSERT(posEnumName != std::string::npos &&
"Inconsistent enum fwd decl!");
1900 while (isspace(fwdDeclsLine[posEnumName]))
1902 size_t posEnumNameEnd = fwdDeclsLine.find(
" : ", posEnumName);
1903 R__ASSERT(posEnumNameEnd != std::string::npos &&
"Inconsistent enum fwd decl (end)!");
1904 while (isspace(fwdDeclsLine[posEnumNameEnd]))
1908 std::string enumName = fwdDeclsLine.substr(posEnumName,
1909 posEnumNameEnd - posEnumName + 1);
1911 if (clang::NamedDecl* enumDecl
1912 = cling::utils::Lookup::Named(&
fInterpreter->getSema(),
1913 enumName.c_str(), DC)) {
1916 R__ASSERT(llvm::dyn_cast<clang::EnumDecl>(enumDecl) &&
"not an enum decl!");
1923 fwdDeclsCodeLessEnums += fwdDeclsLine +
"\n";
1927 if (fwdDeclsCodeLessEnums.size() != 0){
1928 auto compRes =
fInterpreter->declare(fwdDeclsCodeLessEnums, &
T);
1929 assert(cling::Interpreter::kSuccess == compRes &&
1930 "The forward declarations could not be compiled");
1931 if (compRes!=cling::Interpreter::kSuccess){
1932 Warning(
"TCling::RegisterModule",
1933 "Problems in compiling forward declarations for module %s: '%s'",
1934 modulename, fwdDeclsCodeLessEnums.c_str()) ;
1942 ExtLexicalStorageAdder elsa;
1943 for (
auto dciIt =
T->decls_begin();dciIt!=
T->decls_end();dciIt++){
1944 cling::Transaction::DelayCallInfo& dci = *dciIt;
1945 for(
auto dit = dci.m_DGR.begin(); dit != dci.m_DGR.end(); ++dit) {
1946 clang::Decl* declPtr = *dit;
1947 elsa.TraverseDecl(declPtr);
1961 for (
const char** classesHeader = classesHeaders; *classesHeader; ++classesHeader) {
1962 temp=*classesHeader;
1964 size_t theTemplateHash = 0;
1965 bool addTemplate =
false;
1966 size_t posTemplate = temp.find(
'<');
1967 if (posTemplate != std::string::npos) {
1969 std::string templateName = temp.substr(0, posTemplate);
1975 for (
const char** classesHeader_inner = classesHeader; 0!=strcmp(*classesHeader_inner,
"@"); ++classesHeader_inner,++classesHeader){
1977 if (payloadCode == *classesHeader_inner ){
1979 if (addTemplate)
fPayloads.insert(theTemplateHash);
1982 Info(
"TCling::RegisterModule",
1983 "Adding a header for %s", temp.c_str());
1989 addTemplate =
false;
1996 llvm::SmallString<256> pcmFileNameFullPath(dyLibName);
1999 llvm::sys::fs::make_absolute(pcmFileNameFullPath);
2000 llvm::sys::path::remove_filename(pcmFileNameFullPath);
2001 llvm::sys::path::append(pcmFileNameFullPath,
2002 ROOT::TMetaUtils::GetModuleFileName(modulename));
2003 if (!
LoadPCM(pcmFileNameFullPath.str().str())) {
2004 ::Error(
"TCling::RegisterModule",
"cannot find dictionary module %s",
2005 ROOT::TMetaUtils::GetModuleFileName(modulename).c_str());
2011 bool ModuleWasSuccessfullyLoaded =
false;
2013 std::string ModuleName = modulename;
2014 if (llvm::StringRef(modulename).startswith(
"lib"))
2015 ModuleName = llvm::StringRef(modulename).substr(3).str();
2020 clang::Preprocessor &PP = TheSema.getPreprocessor();
2022 if (!dyLibName.empty())
2028 if (!ModuleWasSuccessfullyLoaded) {
2030 clang::HeaderSearch &headerSearch = PP.getHeaderSearchInfo();
2031 clang::ModuleMap &moduleMap = headerSearch.getModuleMap();
2032 if (moduleMap.findModule(ModuleName))
2033 Info(
"TCling::RegisterModule",
"Module %s in modulemap failed to load.", ModuleName.c_str());
2041 clangDiagSuppr diagSuppr(TheSema.getDiagnostics());
2043#if defined(R__MUST_REVISIT)
2044#if R__MUST_REVISIT(6,2)
2045 Warning(
"TCling::RegisterModule",
"Diagnostics suppression should be gone by now.");
2049 if (!ModuleWasSuccessfullyLoaded && !hasHeaderParsingOnDemand){
2052 const cling::Transaction* watermark =
fInterpreter->getLastTransaction();
2053 cling::Interpreter::CompilationResult compRes =
fInterpreter->parseForModule(code.
Data());
2059 assert(cling::Interpreter::kSuccess == compRes &&
2060 "Payload code of a dictionary could not be parsed correctly.");
2061 if (compRes!=cling::Interpreter::kSuccess) {
2062 Warning(
"TCling::RegisterModule",
2063 "Problems declaring payload for module %s.", modulename) ;
2072 if (!ModuleWasSuccessfullyLoaded && !hasHeaderParsingOnDemand) {
2096 if (!ModuleWasSuccessfullyLoaded && !hasHeaderParsingOnDemand) {
2099 "#undef __ROOTCLING__\n"
2100 + gInterpreterClassDef +
2105 assert(isSharedLib);
2108 dlclose(dyLibHandle);
2128 typedef std::vector<std::pair<TClass*,DictFuncPtr_t> >::iterator iterator;
2134 if ( i->first == oldcl ) {
2157 const char* input_line,
2158 cling::Interpreter::CompilationResult& compRes,
2162 return metaProcessor->process(input_line, compRes, result);
2164 catch (cling::InterpreterException&
ex)
2166 Error(
"HandleInterpreterException",
"%s.\n%s",
ex.what(),
"Execution of your code was aborted.");
2168 compRes = cling::Interpreter::kFailure;
2177 if (
auto ie =
dynamic_cast<const cling::InterpreterException*
>(&
e)) {
2203 gROOT->SetLineIsProcessing();
2207 gROOT->SetLineHasBeenProcessed();
2220 gROOT->SetLineIsProcessing();
2222 struct InterpreterFlagsRAII {
2224 bool fWasDynamicLookupEnabled;
2226 InterpreterFlagsRAII(cling::Interpreter* interp):
2228 fWasDynamicLookupEnabled(interp->isDynamicLookupEnabled())
2232 ~InterpreterFlagsRAII() {
2233 fInterpreter->enableDynamicLookup(fWasDynamicLookupEnabled);
2234 gROOT->SetLineHasBeenProcessed();
2243 cling::Interpreter::CompilationResult compRes = cling::Interpreter::kSuccess;
2244 if (!strncmp(sLine.
Data(),
".L", 2) || !strncmp(sLine.
Data(),
".x", 2) ||
2245 !strncmp(sLine.
Data(),
".X", 2)) {
2253 aclicMode, arguments, io);
2254 if (aclicMode.
Length()) {
2256 R__ASSERT(aclicMode[0]==
'+' &&
"ACLiC mode must start with a +");
2258 if (aclicMode[1]==
'+') {
2264 compRes = cling::Interpreter::kFailure;
2266 if (strncmp(sLine.
Data(),
".L", 2) != 0) {
2269 if (arguments.
Length()==0) {
2278 mod_line =
function + arguments + io;
2284 size_t unnamedMacroOpenCurly;
2287 std::string codeline;
2288 std::ifstream in(fname);
2290 std::getline(in, codeline);
2291 code += codeline +
"\n";
2293 unnamedMacroOpenCurly
2294 = cling::utils::isUnnamedMacro(code,
fInterpreter->getCI()->getLangOpts());
2298 if (unnamedMacroOpenCurly != std::string::npos) {
2300 unnamedMacroOpenCurly);
2310 if (0!=strncmp(sLine.
Data(),
".autodict ",10) && sLine !=
".autodict") {
2315 bool isInclusionDirective = sLine.
Contains(
"\n#include") || sLine.
BeginsWith(
"#include");
2316 if (isInclusionDirective) {
2324 if (result.isValid())
2333 case cling::Interpreter::kSuccess: *error =
kNoError;
break;
2334 case cling::Interpreter::kFailure: *error =
kRecoverable;
break;
2335 case cling::Interpreter::kMoreInputExpected: *error =
kProcessing;
break;
2338 if (compRes == cling::Interpreter::kSuccess
2340 && !result.isVoid())
2342 return result.simplisticCastAs<
long>();
2364 if (path[0] ==
'-' && path[1] ==
'I')
2388 static const TClassRef clRefString(
"std::string");
2389 if (clRefString == cl) {
2399 const char* cobj = (
const char*) obj;
2406 auto inspInspect = [&] (ptrdiff_t offset){
2412 switch(complexType) {
2419 inspInspect(
sizeof(
float));
2424 inspInspect(
sizeof(
double));
2429 inspInspect(
sizeof(
int));
2434 inspInspect(
sizeof(
long));
2439 static clang::PrintingPolicy
2441 if (printPol.Indentation) {
2443 printPol.Indentation = 0;
2444 printPol.SuppressInitializers =
true;
2447 const char* clname = cl->
GetName();
2450 const clang::ASTContext& astContext =
fInterpreter->getCI()->getASTContext();
2451 const clang::Decl *scopeDecl = 0;
2456 scopeDecl = clingCI->
GetDecl();
2457 recordType = clingCI->
GetType();
2459 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
2461 scopeDecl = lh.findScope(clname, cling::LookupHelper::NoDiagnostics,
2465 Error(
"InspectMembers",
"Cannot find Decl for class %s", clname);
2468 const clang::CXXRecordDecl* recordDecl
2469 = llvm::dyn_cast<const clang::CXXRecordDecl>(scopeDecl);
2471 Error(
"InspectMembers",
"Cannot find Decl for class %s is not a CXXRecordDecl.", clname);
2478 cling::Interpreter::PushTransactionRAII deserRAII(
fInterpreter);
2480 astContext.getASTRecordLayout(recordDecl);
2482 for (clang::RecordDecl::field_iterator iField = recordDecl->field_begin(),
2483 eField = recordDecl->field_end(); iField != eField; ++iField) {}
2486 const clang::ASTRecordLayout& recLayout
2487 = astContext.getASTRecordLayout(recordDecl);
2494 if (cl->
Size() != recLayout.getSize().getQuantity()) {
2495 Error(
"InspectMembers",
"TClass and cling disagree on the size of the class %s, respectively %d %lld\n",
2499 unsigned iNField = 0;
2502 for (clang::RecordDecl::field_iterator iField = recordDecl->field_begin(),
2503 eField = recordDecl->field_end(); iField != eField;
2504 ++iField, ++iNField) {
2507 clang::QualType memberQT = iField->getType();
2510 memberQT = ROOT::TMetaUtils::ReSubstTemplateArg(memberQT, recordType);
2512 memberQT = cling::utils::Transform::GetPartiallyDesugaredType(astContext, memberQT,
fNormalizedCtxt->GetConfig(),
false );
2513 if (memberQT.isNull()) {
2514 std::string memberName;
2515 llvm::raw_string_ostream stream(memberName);
2517 printPol.AnonymousTagLocations =
false;
2518 iField->getNameForDiagnostic(stream, printPol,
true );
2520 Error(
"InspectMembers",
2521 "Cannot retrieve QualType for member %s while inspecting class %s",
2522 memberName.c_str(), clname);
2525 const clang::Type* memType = memberQT.getTypePtr();
2527 std::string memberName;
2528 llvm::raw_string_ostream stream(memberName);
2530 printPol.AnonymousTagLocations =
false;
2531 iField->getNameForDiagnostic(stream, printPol,
true );
2533 Error(
"InspectMembers",
2534 "Cannot retrieve Type for member %s while inspecting class %s",
2535 memberName.c_str(), clname);
2540 Bool_t ispointer =
false;
2541 if (memNonPtrType->isPointerType()) {
2543 clang::QualType ptrQT
2544 = memNonPtrType->getAs<clang::PointerType>()->getPointeeType();
2547 ptrQT = ROOT::TMetaUtils::ReSubstTemplateArg(ptrQT, recordType);
2549 ptrQT = cling::utils::Transform::GetPartiallyDesugaredType(astContext, ptrQT,
fNormalizedCtxt->GetConfig(),
false );
2550 if (ptrQT.isNull()) {
2551 std::string memberName;
2552 llvm::raw_string_ostream stream(memberName);
2554 printPol.AnonymousTagLocations =
false;
2555 iField->getNameForDiagnostic(stream, printPol,
true );
2557 Error(
"InspectMembers",
2558 "Cannot retrieve pointee Type for member %s while inspecting class %s",
2559 memberName.c_str(), clname);
2562 memNonPtrType = ptrQT.getTypePtr();
2566 llvm::SmallString<8> arraySize;
2567 const clang::ArrayType* arrType = memNonPtrType->getAsArrayTypeUnsafe();
2568 unsigned arrLevel = 0;
2569 bool haveErrorDueToArray =
false;
2573 const clang::ConstantArrayType* constArrType =
2574 clang::dyn_cast<clang::ConstantArrayType>(arrType);
2576 constArrType->getSize().toStringUnsigned(arraySize);
2579 clang::QualType subArrQT = arrType->getElementType();
2580 if (subArrQT.isNull()) {
2581 std::string memberName;
2582 llvm::raw_string_ostream stream(memberName);
2584 printPol.AnonymousTagLocations =
false;
2585 iField->getNameForDiagnostic(stream, printPol,
true );
2587 Error(
"InspectMembers",
2588 "Cannot retrieve QualType for array level %d (i.e. element type of %s) for member %s while inspecting class %s",
2589 arrLevel, subArrQT.getAsString(printPol).c_str(),
2590 memberName.c_str(), clname);
2591 haveErrorDueToArray =
true;
2594 arrType = subArrQT.getTypePtr()->getAsArrayTypeUnsafe();
2596 if (haveErrorDueToArray) {
2601 std::string fieldName;
2602 if (memType->isPointerType()) {
2607 std::string ioname(iField->getName());
2608 ROOT::TMetaUtils::ExtractAttrPropertyFromName(**iField,
"ioname",ioname);
2609 fieldName += ioname;
2610 fieldName += arraySize;
2615 clang::CharUnits offset(astContext.toCharUnitsFromBits(recLayout.getFieldOffset(iNField)));
2616 ptrdiff_t fieldOffset = offset.getQuantity();
2626 auto iFiledQtype = iField->getType();
2627 if (
auto tagDecl = iFiledQtype->getAsTagDecl()){
2628 auto declAccess = tagDecl->getAccess();
2629 if (declAccess == AS_private || declAccess == AS_protected) {
2635 insp.
Inspect(
const_cast<TClass*
>(cl), insp.
GetParent(), fieldName.c_str(), cobj + fieldOffset, isTransient);
2638 const clang::CXXRecordDecl* fieldRecDecl = memNonPtrType->getAsCXXRecordDecl();
2639 if (fieldRecDecl && !fieldRecDecl->isAnonymousStructOrUnion()) {
2642 std::string sFieldRecName;
2643 if (!ROOT::TMetaUtils::ExtractAttrPropertyFromName(*fieldRecDecl,
"iotype",sFieldRecName)){
2645 clang::QualType(memNonPtrType,0),
2655 insp.
InspectMember(sFieldRecName.c_str(), cobj + fieldOffset,
2656 (fieldName +
'.').c_str(), transient);
2664 unsigned iNBase = 0;
2665 for (clang::CXXRecordDecl::base_class_const_iterator iBase
2666 = recordDecl->bases_begin(), eBase = recordDecl->bases_end();
2667 iBase != eBase; ++iBase, ++iNBase) {
2668 clang::QualType baseQT = iBase->getType();
2669 if (baseQT.isNull()) {
2670 Error(
"InspectMembers",
2671 "Cannot find QualType for base number %d while inspecting class %s",
2675 const clang::CXXRecordDecl* baseDecl
2676 = baseQT->getAsCXXRecordDecl();
2678 Error(
"InspectMembers",
2679 "Cannot find CXXRecordDecl for base number %d while inspecting class %s",
2684 std::string sBaseName;
2686 std::vector<TClass*> foundClasses;
2688 if (foundClasses.size()==1){
2689 baseCl=foundClasses[0];
2702 std::string qualNameForDiag;
2703 ROOT::TMetaUtils::GetQualifiedName(qualNameForDiag, *baseDecl);
2704 Error(
"InspectMembers",
2705 "Cannot find TClass for base class %s", qualNameForDiag.c_str() );
2710 if (iBase->isVirtual()) {
2713 Error(
"InspectMembers",
2714 "Base %s of class %s is virtual but no object provided",
2715 sBaseName.c_str(), clname);
2723 baseOffset = ci->
GetBaseOffset(baseCi,
const_cast<void*
>(obj),
2725 if (baseOffset == -1) {
2726 Error(
"InspectMembers",
2727 "Error calculating offset of virtual base %s of class %s",
2728 sBaseName.c_str(), clname);
2731 Error(
"InspectMembers",
2732 "Cannot calculate offset of virtual base %s of class %s",
2733 sBaseName.c_str(), clname);
2738 baseOffset = recLayout.getBaseClassOffset(baseDecl).getQuantity();
2785 bool oldDynLookup =
fInterpreter->isDynamicLookupEnabled();
2828 return fInterpreter->getDynamicLibraryManager()->isLibraryLoaded(tLibName.
Data());
2843 llvm::StringRef ModuleName(libname);
2844 ModuleName = llvm::sys::path::stem(ModuleName);
2845 ModuleName.consume_front(
"lib");
2847 clang::ModuleMap &moduleMap =
fInterpreter->getCI()->getPreprocessor().getHeaderSearchInfo().getModuleMap();
2848 clang::Module *M = moduleMap.findModule(ModuleName);
2849 return M && !M->IsMissingRequirement && M->getASTFile();
2867 std::string file_name = filename;
2868 size_t at = std::string::npos;
2869 while ((at = file_name.find(
"/./")) != std::string::npos)
2870 file_name.replace(at, 3,
"/");
2872 std::string filesStr =
"";
2873 llvm::raw_string_ostream filesOS(filesStr);
2874 clang::SourceManager &SM =
fInterpreter->getCI()->getSourceManager();
2875 cling::ClangInternalState::printIncludedFiles(filesOS, SM);
2878 llvm::SmallVector<llvm::StringRef, 100> files;
2879 llvm::StringRef(filesStr).split(files,
"\n");
2881 std::set<std::string> fileMap;
2883 for (llvm::SmallVector<llvm::StringRef, 100>::const_iterator
2884 iF = files.begin(), iE = files.end(); iF != iE; ++iF) {
2885 if ((*iF) == file_name.c_str())
return kTRUE;
2886 fileMap.insert(*iF);
2889 if (fileMap.empty())
return kFALSE;
2892 TString sFilename(file_name.c_str());
2894 && fileMap.count(sFilename.
Data())) {
2902 while (incPath.
Index(
" :") != -1) {
2906 sFilename = file_name.c_str();
2908 && fileMap.count(sFilename.
Data())) {
2917 const clang::DirectoryLookup *CurDir = 0;
2918 clang::Preprocessor &PP =
fInterpreter->getCI()->getPreprocessor();
2919 clang::HeaderSearch &HS = PP.getHeaderSearchInfo();
2920 const clang::FileEntry *FE = HS.LookupFile(file_name.c_str(),
2921 clang::SourceLocation(),
2924 clang::ArrayRef<std::pair<
const clang::FileEntry *,
2925 const clang::DirectoryEntry *>>(),
2935 if (FE && FE->isValid()) {
2937 clang::SourceManager &SM =
fInterpreter->getCI()->getSourceManager();
2939 clang::FileID FID = SM.translateFile(FE);
2940 if (!FID.isInvalid() && FID.getHashValue() == 0)
2943 clang::SrcMgr::SLocEntry SLocE = SM.getSLocEntry(FID);
2944 if (SLocE.isFile() && SLocE.getFile().getContentCache()->getRawBuffer() == 0)
2946 if (!FID.isInvalid())
2950 sFilename = FE->getName();
2952 && fileMap.count(sFilename.
Data())) {
2963#if defined(R__WIN32) || defined(__CYGWIN__)
2964 HMODULE hModules[1024];
2966 unsigned long cbModules;
2968 hProcess = (
void *)::GetCurrentProcess();
2969 ::EnumProcessModules(hProcess, hModules,
sizeof(hModules), &cbModules);
2971 for (i = 1; i < (cbModules /
sizeof(
void *)); i++) {
2972 static const int bufsize = 260;
2973 wchar_t winname[bufsize];
2974 char posixname[bufsize];
2975 ::GetModuleFileNameExW(hProcess, hModules[i], winname, bufsize);
2976#if defined(__CYGWIN__)
2977 cygwin_conv_path(CCP_WIN_W_TO_POSIX, winname, posixname, bufsize);
2979 std::wstring wpath = winname;
2980 std::replace(wpath.begin(), wpath.end(),
'\\',
'/');
2981 string path(wpath.begin(), wpath.end());
2982 strncpy(posixname, path.c_str(), bufsize);
2988#elif defined(R__MACOSX)
2992 while (
const mach_header* mh = _dyld_get_image_header(imageIndex)) {
2994 if (mh->filetype == MH_DYLIB) {
2995 if (
const char* imageName = _dyld_get_image_name(imageIndex)) {
3003#elif defined(R__LINUX)
3016 PointerNo4* procLinkMap = (PointerNo4*)dlopen(0, RTLD_LAZY | RTLD_GLOBAL);
3019 LinkMap* linkMap = (LinkMap*) ((PointerNo4*)procLinkMap->fPtr)->fPtr;
3023 dlclose(procLinkMap);
3027 while (iDyLib->fNext) {
3028 iDyLib = iDyLib->fNext;
3033 Error(
"TCling::UpdateListOfLoadedSharedLibraries",
3034 "Platform not supported!");
3045 if (!filename)
return;
3049 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
3050 if (!DLM->isLibraryLoaded(filename)) {
3051 DLM->loadLibrary(filename,
true );
3054#if defined(R__MACOSX)
3056 auto lenFilename = strlen(filename);
3057 if (!strncmp(filename,
"/usr/lib/system/", 16)
3058 || !strncmp(filename,
"/usr/lib/libc++", 15)
3059 || !strncmp(filename,
"/System/Library/Frameworks/", 27)
3060 || !strncmp(filename,
"/System/Library/PrivateFrameworks/", 34)
3061 || !strncmp(filename,
"/System/Library/CoreServices/", 29)
3062 || !strcmp(filename,
"cl_kernels")
3063 || strstr(filename,
"/usr/lib/libSystem")
3064 || strstr(filename,
"/usr/lib/libstdc++")
3065 || strstr(filename,
"/usr/lib/libicucore")
3066 || strstr(filename,
"/usr/lib/libbsm")
3067 || strstr(filename,
"/usr/lib/libobjc")
3068 || strstr(filename,
"/usr/lib/libresolv")
3069 || strstr(filename,
"/usr/lib/libauto")
3070 || strstr(filename,
"/usr/lib/libcups")
3071 || strstr(filename,
"/usr/lib/libDiagnosticMessagesClient")
3072 || strstr(filename,
"/usr/lib/liblangid")
3073 || strstr(filename,
"/usr/lib/libCRFSuite")
3074 || strstr(filename,
"/usr/lib/libpam")
3075 || strstr(filename,
"/usr/lib/libOpenScriptingUtil")
3076 || strstr(filename,
"/usr/lib/libextension")
3077 || strstr(filename,
"/usr/lib/libAudioToolboxUtility")
3081 || (lenFilename > 4 && !strcmp(filename + lenFilename - 4,
".tbd")))
3083#elif defined(__CYGWIN__)
3085 static const int bufsize = 260;
3086 char posixwindir[bufsize];
3087 char *windir = getenv(
"WINDIR");
3089 cygwin_conv_path(CCP_WIN_A_TO_POSIX, windir, posixwindir, bufsize);
3091 snprintf(posixwindir,
sizeof(posixwindir),
"/Windows/");
3092 if (strstr(filename, posixwindir) ||
3093 strstr(filename,
"/usr/bin/cyg"))
3095#elif defined(R__WIN32)
3096 if (strstr(filename,
"/Windows/"))
3098#elif defined (R__LINUX)
3099 if (strstr(filename,
"/ld-linux")
3100 || strstr(filename,
"linux-gnu/")
3101 || strstr(filename,
"/libstdc++.")
3102 || strstr(filename,
"/libgcc")
3103 || strstr(filename,
"/libc.")
3104 || strstr(filename,
"/libdl.")
3105 || strstr(filename,
"/libm."))
3123 Error(
"Load",
"Trying to load library (%s) from rootcling.",filename);
3129 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
3130 std::string canonLib = DLM->lookupLibrary(filename);
3131 cling::DynamicLibraryManager::LoadLibResult res
3132 = cling::DynamicLibraryManager::kLoadLibNotFound;
3133 if (!canonLib.empty()) {
3135 res = DLM->loadLibrary(filename, system);
3139 cling::Interpreter::CompilationResult compRes;
3141 if (compRes == cling::Interpreter::kSuccess)
3142 res = cling::DynamicLibraryManager::kLoadLibSuccess;
3146 if (res == cling::DynamicLibraryManager::kLoadLibSuccess) {
3150 case cling::DynamicLibraryManager::kLoadLibSuccess:
return 0;
3151 case cling::DynamicLibraryManager::kLoadLibAlreadyLoaded:
return 1;
3201 Warning(
"Calc",
"waiting for cling thread to free");
3204 gROOT->SetLineIsProcessing();
3212 cling::Interpreter::CompilationResult cr =
fInterpreter->evaluate(
line, valRef);
3213 if (cr != cling::Interpreter::kSuccess) {
3221 if (!valRef.isValid()) {
3230 if (valRef.isVoid()) {
3237 gROOT->SetLineHasBeenProcessed();
3240 return valRef.simplisticCastAs<
long>();
3247 void (*histaddFunc)(
const char*
line))
3252#if defined(R__MUST_REVISIT)
3253#if R__MUST_REVISIT(6,2)
3254 Warning(
"SetGetline",
"Cling should support the equivalent of SetGetlineFunc(getlineFunc, histaddFunc)");
3267 if ((std::distance(
T.decls_begin(),
T.decls_end()) != 1)
3268 ||
T.deserialized_decls_begin() !=
T.deserialized_decls_end()
3269 ||
T.macros_begin() !=
T.macros_end()
3270 || ((!
T.getFirstDecl().isNull()) && ((*
T.getFirstDecl().begin()) !=
T.getWrapperFD()))) {
3293 std::set<TObject*>::iterator iSpecial = ((std::set<TObject*>*)
fgSetOfSpecials)->find(obj);
3311#if defined(R__MUST_REVISIT)
3312#if R__MUST_REVISIT(6,2)
3314 Warning(
"Reset",
"Cling should support the equivalent of scratch_upto(&fDictPos)");
3324#if defined(R__MUST_REVISIT)
3325#if R__MUST_REVISIT(6,2)
3327 Warning(
"ResetAll",
"Cling should support the equivalent of complete reset (unload everything but the startup decls.");
3354#if defined(R__MUST_REVISIT)
3355#if R__MUST_REVISIT(6,2)
3357 Warning(
"ResetGlobalVar",
"Cling should support the equivalent of resetglobalvar(obj)");
3369#if defined(R__MUST_REVISIT)
3370#if R__MUST_REVISIT(6,2)
3372 Warning(
"RewindDictionary",
"Cling should provide a way to revert transaction similar to rewinddictionary()");
3383#if defined(R__MUST_REVISIT)
3384#if R__MUST_REVISIT(6,2)
3386 Warning(
"DeleteGlobal",
"Cling should provide the equivalent of deleteglobal(obj), see also DeleteVariable.");
3398#if defined(R__MUST_REVISIT)
3399#if R__MUST_REVISIT(6,2)
3400 Warning(
"DeleteVariable",
"should do more that just reseting the value to zero");
3405 llvm::StringRef srName(
name);
3406 const char* unscopedName =
name;
3407 llvm::StringRef::size_type posScope = srName.rfind(
"::");
3408 const clang::DeclContext* declCtx = 0;
3409 if (posScope != llvm::StringRef::npos) {
3410 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
3411 const clang::Decl* scopeDecl
3412 = lh.findScope(srName.substr(0, posScope),
3413 cling::LookupHelper::WithDiagnostics);
3415 Error(
"DeleteVariable",
"Cannot find enclosing scope for variable %s",
3419 declCtx = llvm::dyn_cast<clang::DeclContext>(scopeDecl);
3421 Error(
"DeleteVariable",
3422 "Enclosing scope for variable %s is not a declaration context",
3426 unscopedName += posScope + 2;
3429 cling::Interpreter::PushTransactionRAII RAII(
fInterpreter);
3430 clang::NamedDecl* nVarDecl
3431 = cling::utils::Lookup::Named(&
fInterpreter->getSema(), unscopedName, declCtx);
3433 Error(
"DeleteVariable",
"Unknown variable %s",
name);
3436 clang::VarDecl* varDecl = llvm::dyn_cast<clang::VarDecl>(nVarDecl);
3438 Error(
"DeleteVariable",
"Entity %s is not a variable",
name);
3442 clang::QualType qType = varDecl->getType();
3446 if (
type->isPointerType()) {
3447 int** ppInt = (
int**)
fInterpreter->getAddressOfGlobal(GlobalDecl(varDecl));
3449 if (ppInt) *ppInt = 0;
3459#if defined(R__MUST_REVISIT)
3460#if R__MUST_REVISIT(6,2)
3462 Warning(
"SaveContext",
"Cling should provide a way to record a state watermark similar to store_dictposition(&fDictPos)");
3472#if defined(R__MUST_REVISIT)
3473#if R__MUST_REVISIT(6,2)
3475 Warning(
"SaveGlobalsContext",
"Cling should provide a way to record a watermark for the list of global variable similar to store_dictposition(&fDictPosGlobals)");
3509struct AlternateTupleIntDoubleAsc
3515struct AlternateTupleIntDoubleDes
3523 std::tuple<int,double> value;
3524 AlternateTupleIntDoubleAsc asc;
3525 AlternateTupleIntDoubleDes des;
3527 size_t offset0 = ((
char*)&(std::get<0>(value))) - ((
char*)&value);
3528 size_t offset1 = ((
char*)&(std::get<1>(value))) - ((
char*)&value);
3530 size_t ascOffset0 = ((
char*)&(asc._0)) - ((
char*)&asc);
3531 size_t ascOffset1 = ((
char*)&(asc._1)) - ((
char*)&asc);
3533 size_t desOffset0 = ((
char*)&(des._0)) - ((
char*)&des);
3534 size_t desOffset1 = ((
char*)&(des._1)) - ((
char*)&des);
3536 if (offset0 == ascOffset0 && offset1 == ascOffset1) {
3538 }
else if (offset0 == desOffset0 && offset1 == desOffset1) {
3548 std::string alternateName =
"TEmulatedTuple";
3549 alternateName.append( classname + 5 );
3551 std::string guard_name;
3552 ROOT::TMetaUtils::GetCppName(guard_name,alternateName.c_str());
3553 std::ostringstream guard;
3554 guard <<
"ROOT_INTERNAL_TEmulated_";
3555 guard << guard_name;
3557 std::ostringstream alternateTuple;
3558 alternateTuple <<
"#ifndef " << guard.str() <<
"\n";
3559 alternateTuple <<
"#define " << guard.str() <<
"\n";
3560 alternateTuple <<
"namespace ROOT { namespace Internal {\n";
3561 alternateTuple <<
"template <class... Types> struct TEmulatedTuple;\n";
3562 alternateTuple <<
"template <> struct " << alternateName <<
" {\n";
3567 unsigned int nMember = 0;
3568 auto iter = tupleContent.
fElements.begin() + 1;
3569 auto theEnd = tupleContent.
fElements.end() - 1;
3570 while (iter != theEnd) {
3571 alternateTuple <<
" " << *iter <<
" _" << nMember <<
";\n";
3578 unsigned int nMember = tupleContent.
fElements.size() - 3;
3579 auto iter = tupleContent.
fElements.rbegin() + 1;
3580 auto theEnd = tupleContent.
fElements.rend() - 1;
3581 while (iter != theEnd) {
3582 alternateTuple <<
" " << *iter <<
" _" << nMember <<
";\n";
3589 Fatal(
"TCling::SetClassInfo::AlternateTuple",
3590 "Layout of std::tuple on this platform is unexpected.");
3595 alternateTuple <<
"};\n";
3596 alternateTuple <<
"}}\n";
3597 alternateTuple <<
"#endif\n";
3599 Error(
"Load",
"Could not declare %s",alternateName.c_str());
3602 alternateName =
"ROOT::Internal::" + alternateName;
3603 return alternateName;
3677 zombieCandidate =
kTRUE;
3684 zombieCandidate =
kTRUE;
3738 static const char *anonEnum =
"anonymous enum ";
3739 static const int cmplen = strlen(anonEnum);
3763 const char *classname =
name;
3774 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
3776 const clang::Decl *decl
3777 = lh.findScope(classname,
3778 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3779 : cling::LookupHelper::NoDiagnostics,
3783 decl = lh.findScope(buf,
3784 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3785 : cling::LookupHelper::NoDiagnostics,
3802 clang::ClassTemplateSpecializationDecl *tmpltDecl =
3803 llvm::dyn_cast_or_null<clang::ClassTemplateSpecializationDecl>
3804 (
type->getAsCXXRecordDecl());
3805 if (tmpltDecl && !tmpltDecl->getPointOfInstantiation().isValid()) {
3824 if (tci.
Property() & propertiesMask) {
3825 bool hasClassDefInline =
false;
3826 if (isClassOrNamespaceOnly) {
3832 if (hasDictionary.IsValid() && implLineFunc.IsValid()) {
3834 bool success =
false;
3835 std::tie(success, lineNumber) =
3836 ROOT::TMetaUtils::GetTrivialIntegralReturnValue(implLineFunc.GetMethodDecl(), *
fInterpreter);
3837 hasClassDefInline = success && (lineNumber == -1);
3846 if (hasClassDefInline)
3889 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
3890 const clang::Decl *decl
3891 = lh.findClassTemplate(
name,
3892 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3893 : cling::LookupHelper::NoDiagnostics);
3895 std::string strname =
"std::";
3897 decl = lh.findClassTemplate(strname,
3898 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3899 : cling::LookupHelper::NoDiagnostics);
3925 cl->
fBase = listOfBase;
3941 D =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
3944 if (
const clang::DeclContext* DC = dyn_cast<clang::DeclContext>(D)) {
3945 cling::Interpreter::PushTransactionRAII deserRAII(
fInterpreter);
3947 llvm::SmallVector< DeclContext *, 4> allDeclContexts;
3948 const_cast< clang::DeclContext *
>(DC)->collectAllContexts(allDeclContexts);
3949 for (llvm::SmallVector<DeclContext*, 4>::iterator declIter = allDeclContexts.begin(), declEnd = allDeclContexts.end();
3950 declIter != declEnd; ++declIter) {
3952 for (clang::DeclContext::decl_iterator DI = (*declIter)->decls_begin(),
3953 DE = (*declIter)->decls_end(); DI != DE; ++DI) {
3954 if (
const clang::EnumDecl* ED = dyn_cast<clang::EnumDecl>(*DI)) {
3957 PrintingPolicy Policy(ED->getASTContext().getPrintingPolicy());
3958 llvm::raw_string_ostream stream(buf);
3960 Policy.AnonymousTagLocations =
false;
3961 ED->getNameForDiagnostic(stream, Policy,
false);
3965 const char*
name = buf.c_str();
3989 D =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
3993 if (
const clang::DeclContext* DC = dyn_cast<clang::DeclContext>(D)) {
3994 cling::Interpreter::PushTransactionRAII deserRAII(
fInterpreter);
3996 llvm::SmallVector< DeclContext *, 4> allDeclContexts;
3997 const_cast< clang::DeclContext *
>(DC)->collectAllContexts(allDeclContexts);
3998 for (llvm::SmallVector<DeclContext*, 4>::iterator declIter = allDeclContexts.begin(),
3999 declEnd = allDeclContexts.end(); declIter != declEnd; ++declIter) {
4001 for (clang::DeclContext::decl_iterator DI = (*declIter)->decls_begin(),
4002 DE = (*declIter)->decls_end(); DI != DE; ++DI) {
4003 if (
const clang::FunctionTemplateDecl* FTD = dyn_cast<clang::FunctionTemplateDecl>(*DI)) {
4004 funcTempList->
Get(FTD);
4062 if (
m->fMethodArgs) {
4073 m->fMethodArgs = arglist;
4112 if (llvm::isa<clang::NamespaceDecl>(cli->
GetDecl())) {
4121 Error(
"GenerateTClass",
4122 "Cannot find %s::Class_Version()! Class version might be wrong.",
4127 newvers = ROOT::TMetaUtils::GetClassVersion(llvm::dyn_cast<clang::RecordDecl>(cli->
GetDecl()),
4129 if (newvers == -1) {
4137 newvers = callfunc.
ExecInt(0);
4139 Error(
"GenerateTClass",
4140 "Cannot invoke %s::Class_Version()! Class version might be wrong.",
4144 if (newvers != oldvers) {
4161static void GenerateTClass_GatherInnerIncludes(cling::Interpreter *interp,
TString &includes,
TClingClassInfo *info)
4165 const clang::ClassTemplateSpecializationDecl *templateCl
4166 = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(info->
GetDecl());
4168 for(
unsigned int i=0; i < templateCl->getTemplateArgs().size(); ++i) {
4169 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
4171 const clang::Type *uType = ROOT::TMetaUtils::GetUnderlyingType( arg.getAsType() );
4173 if (!uType->isFundamentalType() && !uType->isEnumeralType()) {
4175 const clang::CXXRecordDecl *argdecl = uType->getAsCXXRecordDecl();
4178 TClingClassInfo subinfo(interp,*(argdecl->getASTContext().getRecordType(argdecl).getTypePtr()));
4179 GenerateTClass_GatherInnerIncludes(interp, includes, &subinfo);
4182 llvm::raw_string_ostream OS(Result);
4183 arg.print(argdecl->getASTContext().getPrintingPolicy(),OS);
4184 Warning(
"TCling::GenerateTClass",
"Missing header file for %s",OS.str().c_str());
4199 if (!info || !info->
IsValid()) {
4200 Fatal(
"GenerateTClass",
"Requires a valid ClassInfo object");
4205 std::string classname;
4209 Info(
"GenerateTClass",
"Will (try to) generate the compiled TClass for %s.",classname.c_str());
4213 GenerateTClass_GatherInnerIncludes(
fInterpreter,includes,info);
4219 Error(
"GenerateTClass",
"Even though the dictionary generation for %s seemed successful we can't find the TClass bootstrap!",classname.c_str());
4225 cl =
new TClass(classinfo, version, 0, 0, -1, -1, silent);
4231 cl =
new TClass(classinfo, 1, 0, 0, -1, -1, silent);
4256 if (classes == 0 || classes[0] == 0) {
4257 Error(
"TCling::GenerateDictionary",
"Cannot generate dictionary without passing classes.");
4261 std::vector<std::string> listClasses;
4263 const char* current = classes, *prev = classes;
4267 if (*current ==
';') {
4268 listClasses.push_back(std::string(prev, current - prev));
4271 else if (*(current + 1) == 0) {
4272 listClasses.push_back(std::string(prev, current + 1 - prev));
4276 std::vector<std::string> listIncludes;
4280 const char* current = includes, *prev = includes;
4284 if (*current ==
';') {
4285 listIncludes.push_back(std::string(prev, current - prev));
4288 else if (*(current + 1) == 0) {
4289 listIncludes.push_back(std::string(prev, current + 1 - prev));
4295 std::vector<std::string>(), std::vector<std::string>());
4316 if (
const ValueDecl* decl = (
const ValueDecl*)
d){
4318 bool hasIoName = ROOT::TMetaUtils::ExtractAttrPropertyFromName(*decl,
"ioname",ioName);
4319 if (hasIoName && ioName !=
name)
return 0;
4331 using namespace clang;
4333 DeclarationName DName = &SemaR.Context.Idents.get(
name);
4335 LookupResult
R(SemaR, DName, SourceLocation(), Sema::LookupOrdinaryName,
4336 Sema::ForRedeclaration);
4339 cling::Interpreter::PushTransactionRAII RAII(
fInterpreter);
4340 cling::utils::Lookup::Named(&SemaR,
R);
4344 while (
F.hasNext()) {
4345 NamedDecl *D =
F.next();
4346 if (isa<VarDecl>(D) || isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) ||
4347 isa<IndirectFieldDecl>(D))
4353 if (
R.isSingleResult())
4354 return R.getFoundDecl();
4366 const clang::Decl* possibleEnum = 0;
4371 const clang::DeclContext* dc = 0;
4372 if (
const clang::Decl* D = cci->
GetDecl()) {
4373 if (!(dc = dyn_cast<clang::NamespaceDecl>(D))) {
4374 dc = dyn_cast<clang::RecordDecl>(D);
4380 cling::Interpreter::PushTransactionRAII RAII(
fInterpreter);
4381 possibleEnum = cling::utils::Lookup::Tag(&
fInterpreter->getSema(),
name, dc);
4383 Error(
"TCling::GetEnum",
"DeclContext not found for %s .\n",
name);
4389 cling::Interpreter::PushTransactionRAII RAII(
fInterpreter);
4392 if (possibleEnum && (possibleEnum != (clang::Decl*)-1)
4393 && isa<clang::EnumDecl>(possibleEnum)) {
4394 return possibleEnum;
4406 llvm::StringRef mangled_name = gv->getName();
4421 std::string scopename(demangled_name_c);
4422 free(demangled_name_c);
4428 std::string dataname;
4430 if (!strncmp(scopename.c_str(),
"typeinfo for ",
sizeof(
"typeinfo for ")-1)) {
4431 scopename.erase(0,
sizeof(
"typeinfo for ")-1);
4432 }
else if (!strncmp(scopename.c_str(),
"vtable for ",
sizeof(
"vtable for ")-1)) {
4433 scopename.erase(0,
sizeof(
"vtable for ")-1);
4436 std::string::size_type pos = scopename.rfind(
'(');
4437 if (pos != std::string::npos) {
4441 pos = scopename.rfind(
':');
4442 if (pos != std::string::npos) {
4443 if ((pos != 0) && (scopename[pos-1] ==
':')) {
4444 dataname = scopename.substr(pos+1);
4445 scopename.erase(pos-1);
4449 dataname = scopename;
4457 if (scopename.size()) {
4473 Error(
"GetDataMemberWithValue()",
"not implemented");
4483 Error(
"GetDataMemberAtAddr()",
"not implemented");
4493 const char* params,
Bool_t objectIsConst )
4505 func.
SetFunc(&gcl, method, params, &offset);
4511 return mangled_name;
4526 GetMethod(method,
proto, objectIsConst, 0 , mode).GetMangledName();
4538 const char* params,
Bool_t objectIsConst )
4550 func.
SetFunc(&gcl, method, params, &offset);
4579 std::vector<DeclId_t>& res)
const
4582 clang::ASTContext& Ctx =
S.Context;
4583 const clang::Decl* CtxDecl
4585 Ctx.getTranslationUnitDecl();
4586 auto RecDecl = llvm::dyn_cast<const clang::RecordDecl>(CtxDecl);
4587 const clang::DeclContext* DeclCtx = RecDecl;
4590 DeclCtx = dyn_cast<clang::NamespaceDecl>(CtxDecl);
4591 if (!DeclCtx)
return;
4593 clang::DeclarationName DName;
4598 if (RecDecl->getNameAsString() == funcname) {
4599 clang::QualType QT = Ctx.getTypeDeclType(RecDecl);
4600 DName = Ctx.DeclarationNames.getCXXConstructorName(Ctx.getCanonicalType(QT));
4601 }
else if (funcname[0] ==
'~' && RecDecl->getNameAsString() == funcname + 1) {
4602 clang::QualType QT = Ctx.getTypeDeclType(RecDecl);
4603 DName = Ctx.DeclarationNames.getCXXDestructorName(Ctx.getCanonicalType(QT));
4605 DName = &Ctx.Idents.get(funcname);
4608 DName = &Ctx.Idents.get(funcname);
4611 clang::LookupResult
R(
S, DName, clang::SourceLocation(),
4612 Sema::LookupOrdinaryName, clang::Sema::ForRedeclaration);
4613 S.LookupQualifiedName(
R,
const_cast<DeclContext*
>(DeclCtx));
4614 if (
R.empty())
return;
4616 res.reserve(res.size() + (
R.end() -
R.begin()));
4617 for (clang::LookupResult::iterator IR =
R.begin(), ER =
R.end();
4619 if (
const clang::FunctionDecl* FD
4620 = llvm::dyn_cast<const clang::FunctionDecl>(*IR)) {
4621 if (!FD->getDescribedFunctionTemplate()) {
4781 const char* params,
Bool_t objectIsConst,
int* error)
4794 void* address = (
void*)((
Long_t)addr + offset);
4801 const char* params,
int* error)
4803 Execute(obj,cl,method,params,
false,error);
4818 Error(
"Execute",
"No method was defined");
4827 if (argc > nparms) {
4828 Error(
"Execute",
"Too many parameters to call %s, got %d but expected at most %d.",method->
GetName(),argc,nparms);
4831 if (nparms != argc) {
4841 Int_t firstDefault = -1;
4842 for (
Int_t i = 0; i < nparms; i ++) {
4849 if (firstDefault >= 0) {
4850 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);
4852 Error(
"Execute",
"Too few arguments to call %s, got only %d but expected %d.",method->
GetName(),argc,nparms);
4858 const char* listpar =
"";
4863 for (
Int_t i = 0; i < argc; i ++) {
4872 chpar += (nxtpar->
String()).ReplaceAll(
"\"",
"\\\"");
4879 complete += nxtpar->
String();
4882 listpar = complete.
Data();
4900 const CXXMethodDecl * mdecl = dyn_cast<CXXMethodDecl>(minfo->
GetMethodDecl());
4902 void* address = (
void*)((
Long_t)addr + offset);
4909 const void* args[] ,
4914 Error(
"ExecuteWithArgsAndReturn",
"No method was defined");
4941 Warning(
"GetTopLevelMacroName",
"Must change return type!");
4988#if defined(R__MUST_REVISIT)
4989#if R__MUST_REVISIT(6,0)
4990 Warning(
"GetCurrentMacroName",
"Must change return type!");
5003 TTHREAD_TLS(
char*) t = 0;
5004 TTHREAD_TLS(
unsigned int) tlen = 0;
5006 unsigned int dlen = strlen(typeDesc);
5009 t =
new char[dlen + 1];
5012 const char*
s, *template_start;
5013 if (!strstr(typeDesc,
"(*)(")) {
5014 s = strchr(typeDesc,
' ');
5015 template_start = strchr(typeDesc,
'<');
5016 if (!strcmp(typeDesc,
"long long")) {
5017 strlcpy(t, typeDesc, dlen + 1);
5019 else if (!strncmp(typeDesc,
"unsigned ",
s + 1 - typeDesc)) {
5020 strlcpy(t, typeDesc, dlen + 1);
5026 else if (
s && (template_start == 0 || (
s < template_start))) {
5027 strlcpy(t,
s + 1, dlen + 1);
5030 strlcpy(t, typeDesc, dlen + 1);
5034 strlcpy(t, typeDesc, dlen + 1);
5037 while (
l > 0 && (t[
l - 1] ==
'*' || t[
l - 1] ==
'&')) {
5045 if (!rootmapfile || !*rootmapfile)
5048 llvm::StringRef moduleName = llvm::sys::path::filename(rootmapfile);
5049 moduleName.consume_front(
"lib");
5050 moduleName.consume_back(
".rootmap");
5052 Module *M = interp->getCI()->getPreprocessor().getHeaderSearchInfo().lookupModule(moduleName);
5054 return !(M && interp->getSema().isModuleVisible(M));
5066 const std::map<char, unsigned int> keyLenMap = {{
'c',6},{
'n',10},{
't',8},{
'h',7},{
'e',5},{
'v',4}};
5068 if (rootmapfile && *rootmapfile) {
5069 std::string rootmapfileNoBackslash(rootmapfile);
5071 std::replace(rootmapfileNoBackslash.begin(), rootmapfileNoBackslash.end(),
'\\',
'/');
5078 uniqueString->
Append(std::string(
"\n#line 1 \"Forward declarations from ") + rootmapfileNoBackslash +
"\"\n");
5080 std::ifstream
file(rootmapfileNoBackslash);
5081 std::string
line;
line.reserve(200);
5082 std::string lib_name;
line.reserve(100);
5083 bool newFormat=
false;
5084 while (getline(
file,
line,
'\n')) {
5086 (
line.compare(0, 8,
"Library.") == 0 ||
line.compare(0, 8,
"Declare.") == 0)) {
5095 while (getline(
file,
line,
'\n')) {
5096 if (
line[0] ==
'[')
break;
5097 if (!uniqueString) {
5098 Error(
"ReadRootmapFile",
"Cannot handle \"{ decls }\" sections in custom rootmap file %s",
5099 rootmapfileNoBackslash.c_str());
5105 const char firstChar=
line[0];
5106 if (firstChar ==
'[') {
5108 auto brpos =
line.find(
']');
5109 if (brpos == string::npos)
continue;
5110 lib_name =
line.substr(1, brpos-1);
5112 while( lib_name[nspaces] ==
' ' ) ++nspaces;
5113 if (nspaces) lib_name.replace(0, nspaces,
"");
5115 TString lib_nameTstr(lib_name.c_str());
5120 Info(
"ReadRootmapFile",
"new section for %s", lib_nameTstr.
Data());
5123 Info(
"ReadRootmapFile",
"section for %s (library does not exist)", lib_nameTstr.
Data());
5130 auto keyLenIt = keyLenMap.find(firstChar);
5131 if (keyLenIt == keyLenMap.end())
continue;
5132 unsigned int keyLen = keyLenIt->second;
5134 const char *keyname =
line.c_str()+keyLen;
5136 Info(
"ReadRootmapFile",
"class %s in %s", keyname, lib_name.c_str());
5139 if(lib_name != isThere->
GetValue()){
5140 if (firstChar ==
'n') {
5142 Info(
"ReadRootmapFile",
"namespace %s found in %s is already in %s",
5143 keyname, lib_name.c_str(), isThere->
GetValue());
5144 }
else if (firstChar ==
'h'){
5150 Warning(
"ReadRootmapFile",
"%s %s found in %s is already in %s",
line.substr(0, keyLen).c_str(),
5151 keyname, lib_name.c_str(), isThere->
GetValue());
5155 Info(
"ReadRootmapFile",
"Key %s was already defined for %s", keyname, lib_name.c_str());
5214 using namespace clang;
5216 class ExtVisibleStorageAdder:
public RecursiveASTVisitor<ExtVisibleStorageAdder>{
5222 ExtVisibleStorageAdder(std::unordered_set<const NamespaceDecl*>& nsSet): fNSSet(nsSet) {};
5223 bool VisitNamespaceDecl(NamespaceDecl* nsDecl) {
5228 nsDecl->setHasExternalVisibleStorage();
5229 fNSSet.insert(nsDecl);
5233 std::unordered_set<const NamespaceDecl*>& fNSSet;
5258 bool needsRootMap =
true;
5259 if (rootmapfile && *rootmapfile)
5282 for (
Int_t j = 0; j < i; j++) {
5293 Info(
"LoadLibraryMap",
"%s",
d.Data());
5298 if (
f.EndsWith(
".rootmap")) {
5304 Info(
"LoadLibraryMap",
" rootmap file: %s", p.
Data());
5326 if (
f.BeginsWith(
"rootmap")) {
5331 Warning(
"LoadLibraryMap",
"please rename %s to end with \".rootmap\"", p.
Data());
5344 if (rootmapfile && *rootmapfile) {
5355 else if (res == -3) {
5365 while ((rec = (
TEnvRec*) next())) {
5367 if (!strncmp(cls.
Data(),
"Library.", 8) && cls.
Length() > 8) {
5386 Info(
"LoadLibraryMap",
"class %s in %s", cls.
Data(), wlib);
5389 Info(
"LoadLibraryMap",
"class %s in %s (library does not exist)", cls.
Data(), lib);
5404 else if (!strncmp(cls.
Data(),
"Declare.", 8) && cls.
Length() > 8) {
5414 cling::Transaction*
T =
nullptr;
5416 assert(cling::Interpreter::kSuccess == compRes &&
"A declaration in a rootmap could not be compiled");
5418 if (compRes!=cling::Interpreter::kSuccess){
5420 "Problems in %s declaring '%s' were encountered.", rootmapfile, uniqueString.
Data()) ;
5425 for (
auto declIt =
T->decls_begin(); declIt < T->decls_end(); ++declIt) {
5426 if (declIt->m_DGR.isSingleDecl()) {
5427 if (Decl* D = declIt->m_DGR.getSingleDecl()) {
5428 if (NamespaceDecl* NSD = dyn_cast<NamespaceDecl>(D)) {
5429 evsAdder.TraverseDecl(NSD);
5464 for (
Int_t ilib = 0; ilib < nrSharedLibs; ilib++) {
5471 TString rootMapBaseStr = sharedLibBaseStr;
5472 if (sharedLibBaseStr.
EndsWith(
".dll")) {
5475 else if (sharedLibBaseStr.
EndsWith(
".DLL")) {
5478 else if (sharedLibBaseStr.
EndsWith(
".so")) {
5481 else if (sharedLibBaseStr.
EndsWith(
".sl")) {
5484 else if (sharedLibBaseStr.
EndsWith(
".dl")) {
5487 else if (sharedLibBaseStr.
EndsWith(
".a")) {
5491 Error(
"ReloadAllSharedLibraryMaps",
"Unknown library type %s", sharedLibBaseStr.
Data());
5495 rootMapBaseStr +=
".rootmap";
5498 Error(
"ReloadAllSharedLibraryMaps",
"Could not find rootmap %s in path", rootMapBaseStr.
Data());
5505 Error(
"ReloadAllSharedLibraryMaps",
"Error loading map %s", rootMap);
5540 if (!
fMapfile || !library || !*library) {
5548 size_t len = libname.
Length();
5553 while ((rec = (
TEnvRec *) next())) {
5564 if (!strncmp(cls.
Data(),
"Library.", 8) && cls.
Length() > 8) {
5573 if (!strncmp(lib, libname.
Data(), len)) {
5575 Error(
"UnloadLibraryMap",
"entry for <%s, %s> not found in library map table", cls.
Data(), lib);
5583 TString library_rootmap(library);
5584 if (!library_rootmap.
EndsWith(
".rootmap"))
5585 library_rootmap.
Append(
".rootmap");
5640 free(demangled_name);
5656 std::string demangled_name(demangled_name_c);
5657 free(demangled_name_c);
5670 result =
AutoLoad(demangled_name.c_str(), knowDictNotLoaded);
5695 Info(
"TCling::AutoLoad",
5696 "Trying to autoload for %s", cls);
5702 Info(
"TCling::AutoLoad",
5703 "Disabled due to gROOT or gInterpreter being invalid/not ready (the class name is %s)", cls);
5710 Info(
"TCling::AutoLoad",
5711 "Explicitly disabled (the class name is %s)", cls);
5730 if (
gROOT->LoadClass(cls, deplib) == 0) {
5732 Info(
"TCling::AutoLoad",
5733 "loaded dependent library %s for %s", deplib, cls);
5737 Error(
"TCling::AutoLoad",
5738 "failure loading dependent library %s for %s",
5743 if (lib && lib[0]) {
5744 if (
gROOT->LoadClass(cls, lib) == 0) {
5746 Info(
"TCling::AutoLoad",
5747 "loaded library %s for %s", lib, cls);
5752 Error(
"TCling::AutoLoad",
5753 "failure loading library %s for %s", lib, cls);
5767 cling::Interpreter *interpreter)
5769 std::string code = gNonInterpreterClassDef ;
5776 code += (
"#include \"");
5780 code += (
"#ifdef __ROOTCLING__\n"
5781 "#undef __ROOTCLING__\n"
5782 + gInterpreterClassDef +
5785 cling::Interpreter::CompilationResult cr;
5791 Sema &SemaR = interpreter->getSema();
5793 clangDiagSuppr diagSuppr(SemaR.getDiagnostics());
5795 #if defined(R__MUST_REVISIT)
5796 #if R__MUST_REVISIT(6,2)
5797 Warning(
"TCling::RegisterModule",
"Diagnostics suppression should be gone by now.");
5801 cr = interpreter->parseForModule(code);
5819 Int_t nHheadersParsed = 0;
5820 unsigned long offset = 0;
5821 if (strncmp(cls,
"const ", 6) == 0) {
5826 bool skipFirstEntry =
false;
5827 std::vector<std::string> autoparseKeys;
5828 if (strchr(cls,
'<')) {
5834 if (!autoparseKeys.empty() && !autoparseKeys[0].empty()) {
5839 TString templateName(autoparseKeys[0]);
5840 auto tokens = templateName.
Tokenize(
"::");
5841 clang::NamedDecl* previousScopeAsNamedDecl =
nullptr;
5842 clang::DeclContext* previousScopeAsContext =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
5844 previousScopeAsContext =
fInterpreter->getSema().getStdNamespace();
5845 auto nTokens = tokens->GetEntries();
5846 for (
Int_t tk = 0; tk < nTokens; ++tk) {
5847 auto scopeObj = tokens->UncheckedAt(tk);
5848 auto scopeName = ((
TObjString*) scopeObj)->String().Data();
5849 previousScopeAsNamedDecl = cling::utils::Lookup::Named(&
fInterpreter->getSema(), scopeName, previousScopeAsContext);
5851 if ((clang::NamedDecl*)-1 == previousScopeAsNamedDecl)
break;
5852 previousScopeAsContext = llvm::dyn_cast_or_null<clang::DeclContext>(previousScopeAsNamedDecl);
5853 if (!previousScopeAsContext)
break;
5857 if ((clang::NamedDecl*)-1 != previousScopeAsNamedDecl) {
5858 if (
auto templateDecl = llvm::dyn_cast_or_null<clang::ClassTemplateDecl>(previousScopeAsNamedDecl)) {
5859 if (
auto templatedDecl = templateDecl->getTemplatedDecl()) {
5860 skipFirstEntry = templatedDecl->hasDefinition();
5867 if (topLevel) autoparseKeys.emplace_back(cls);
5869 for (
const auto & apKeyStr : autoparseKeys) {
5870 if (skipFirstEntry) {
5871 skipFirstEntry=
false;
5874 if (apKeyStr.empty())
continue;
5875 const char *apKey = apKeyStr.c_str();
5879 Info(
"TCling::AutoParse",
5880 "Starting autoparse for %s\n", apKey);
5885 const cling::Transaction *
T =
fInterpreter->getCurrentTransaction();
5887 auto const &hNamesPtrs = iter->second;
5889 Info(
"TCling::AutoParse",
5890 "We can proceed for %s. We have %s headers.", apKey, std::to_string(hNamesPtrs.size()).c_str());
5892 for (
auto & hName : hNamesPtrs) {
5894 if (0 !=
fPayloads.count(normNameHash)) {
5895 float initRSSval=0.f, initVSIZEval=0.f;
5897 (
void) initVSIZEval;
5900 "Parsing full payload for %s", apKey);
5907 if (cRes != cling::Interpreter::kSuccess) {
5908 if (hName[0] ==
'\n')
5909 Error(
"AutoParse",
"Error parsing payload code for class %s with content:\n%s", apKey, hName);
5918 Info(
"Autoparse",
">>> RSS key %s - before %.3f MB - after %.3f MB - delta %.3f MB", apKey, initRSSval, endRSSval, endRSSval-initRSSval);
5919 Info(
"Autoparse",
">>> VSIZE key %s - before %.3f MB - after %.3f MB - delta %.3f MB", apKey, initVSIZEval, endVSIZEval, endVSIZEval-initVSIZEval);
5925 "Parsing single header %s", hName);
5928 if (cRes != cling::Interpreter::kSuccess) {
5929 Error(
"AutoParse",
"Error parsing headerfile %s for class %s.", hName, apKey);
5941 if (strchr(apKey,
'<')) {
5948 return nHheadersParsed;
5969 Info(
"TCling::AutoParse",
5970 "Trying to autoparse for %s", cls);
5990 if (nHheadersParsed != 0) {
6007 return nHheadersParsed > 0 ? 1 : 0;
6015 StringRef errMsg(errmessage);
6016 if (errMsg.contains(
"undefined symbol: ")) {
6018 std::string mangled_name = std::string(errMsg.split(
"undefined symbol: ").second);
6019 void* res = ((
TCling*)
gCling)->LazyFunctionCreatorAutoload(mangled_name);
6020 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
6021 if (res && DLM && (DLM->loadLibrary(libStem, permanent, resolved) == cling::DynamicLibraryManager::kLoadLibSuccess))
6037 H = (
H << 5) +
H +
C;
6042 for (
auto S :
file->sections()) {
6045 if (
name ==
".gnu.hash") {
6047 S.getContents(content);
6061 const int bits = 64;
6064 if (contents.size() < 16)
6067 const char* hashContent = contents.data();
6070 uint32_t maskWords = *
reinterpret_cast<const uint32_t *
>(hashContent + 8);
6071 uint32_t shift2 = *
reinterpret_cast<const uint32_t *
>(hashContent + 12);
6072 uint32_t hash2 = hash >> shift2;
6073 uint32_t
n = (hash / bits) % maskWords;
6075 const char *bloomfilter = hashContent + 16;
6076 const char *hash_pos = bloomfilter +
n*(bits/8);
6077 uint64_t word = *
reinterpret_cast<const uint64_t *
>(hash_pos);
6078 uint64_t bitmask = ( (1ULL << (hash % bits)) | (1ULL << (hash2 % bits)));
6079 return (bitmask & word) == bitmask;
6083static bool LookupNormalSymbols(llvm::object::ObjectFile *RealSoFile,
const std::string& mangled_name,
const std::string& LibName)
6085 uint32_t hashedMangle =
GNUHash(mangled_name);
6090 auto Symbols = RealSoFile->symbols();
6091 for (
auto S : Symbols) {
6092 uint32_t Flags =
S.getFlags();
6094 if (Flags & llvm::object::SymbolRef::SF_Undefined)
6106 llvm::Expected<StringRef> SymNameErr =
S.getName();
6108 Warning(
"LookupNormalSymbols",
"Failed to read symbol");
6112 if (SymNameErr.get() == mangled_name)
6120 cling::Interpreter *fInterpreter) {
6121 using namespace llvm::object;
6122 using namespace llvm::sys::path;
6123 using namespace llvm::sys::fs;
6127 static bool sFirstRun =
true;
6128 static bool sFirstSystemLibrary =
true;
6133 static std::vector< std::pair<uint32_t, std::string> > sLibraries;
6134 static std::vector<std::string> sPaths;
6137 static std::vector< std::pair<uint32_t, std::string> > sSysLibraries;
6138 static std::vector<std::string> sSysPaths;
6149 std::string name_in_so =
"_" + mangled_name;
6151 std::string name_in_so = mangled_name;
6156 for (std::pair<uint32_t, std::string> &
P : sLibraries) {
6157 llvm::SmallString<400> Vec(sPaths[
P.first]);
6158 llvm::sys::path::append(Vec, StringRef(
P.second));
6159 const std::string LibName = Vec.str();
6161 auto SoFile = ObjectFile::createObjectFile(LibName);
6166 if (
gSystem->
Load(LibName.c_str(),
"",
false) < 0)
6167 Error(
"LazyFunctionCreatorAutoloadForModule",
"Failed to load library %s", LibName.c_str());
6171 sLibraries.erase(std::remove(sLibraries.begin(), sLibraries.end(),
P), sLibraries.end());
6172 void* addr = llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(mangled_name.c_str());
6178 if (sFirstSystemLibrary) {
6180 sFirstSystemLibrary =
false;
6183 for (std::pair<uint32_t, std::string> &
P : sSysLibraries) {
6184 llvm::SmallString<400> Vec(sSysPaths[
P.first]);
6185 llvm::sys::path::append(Vec, StringRef(
P.second));
6186 const std::string LibName = Vec.str();
6188 auto SoFile = ObjectFile::createObjectFile(LibName);
6192 auto RealSoFile = SoFile.get().getBinary();
6195 if (
gSystem->
Load(LibName.c_str(),
"",
false) < 0)
6196 Error(
"LazyFunctionCreatorAutoloadForModule",
"Failed to load library %s", LibName.c_str());
6198 sSysLibraries.erase(std::remove(sSysLibraries.begin(), sSysLibraries.end(),
P), sSysLibraries.end());
6199 void* addr = llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(mangled_name.c_str());
6204 auto sections = RealSoFile->sections();
6205 for (
auto section : sections) {
6206 llvm::StringRef sectionName;
6207 section.getName(sectionName);
6210 if (sectionName ==
".dynstr") {
6211 llvm::StringRef dContents;
6212 section.getContents(dContents);
6214 if (dContents.contains(mangled_name)) {
6215 if (
gSystem->
Load(LibName.c_str(),
"",
false) < 0)
6216 Error(
"LazyFunctionCreatorAutoloadForModule",
"Failed to load library %s", LibName.c_str());
6219 sSysLibraries.erase(std::remove(sSysLibraries.begin(), sSysLibraries.end(),
P), sSysLibraries.end());
6220 void* addr = llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(mangled_name.c_str());
6243 mangled_name.c_str())) {
6254 std::string
name(demangled_name_c);
6255 free(demangled_name_c);
6263 std::string::size_type pos =
name.find(
"__thiscall ");
6264 if (pos != std::string::npos) {
6265 name.erase(0, pos +
sizeof(
"__thiscall ")-1);
6267 pos =
name.find(
"__cdecl ");
6268 if (pos != std::string::npos) {
6269 name.erase(0, pos +
sizeof(
"__cdecl ")-1);
6271 if (!strncmp(
name.c_str(),
"typeinfo for ",
sizeof(
"typeinfo for ")-1)) {
6272 name.erase(0,
sizeof(
"typeinfo for ")-1);
6273 }
else if (!strncmp(
name.c_str(),
"vtable for ",
sizeof(
"vtable for ")-1)) {
6274 name.erase(0,
sizeof(
"vtable for ")-1);
6275 }
else if (!strncmp(
name.c_str(),
"operator",
sizeof(
"operator")-1)
6276 && !isalnum(
name[
sizeof(
"operator")])) {
6278 name.erase(0,
sizeof(
"operator")-1);
6279 pos =
name.rfind(
'(');
6280 if (pos != std::string::npos) {
6281 name.erase(0, pos + 1);
6282 pos =
name.find(
",");
6283 if (pos != std::string::npos) {
6287 pos =
name.rfind(
" const");
6288 if (pos != std::string::npos) {
6289 name.erase(pos, strlen(
" const"));
6291 while (!
name.empty() && strchr(
"&*",
name.back()))
6311 while (libs.
Tokenize(lib, posLib)) {
6321 void* addr = llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(mangled_name.c_str());
6353 const NamedDecl *oldDef = llvm::dyn_cast_or_null<NamedDecl>(cci->
GetDecl());
6354 if (!oldDef || (def && def != oldDef)) {
6368 if (!alias && def !=
nullptr)
6391 const TagDecl *td = dyn_cast<TagDecl>(ND);
6392 const NamespaceDecl *
ns = dyn_cast<NamespaceDecl>(ND);
6393 const NamedDecl *canon =
nullptr;
6398 canon = tdDef = td->getDefinition();
6402 if (!tdDef->isCompleteDefinition() || llvm::isa<clang::FunctionDecl>(tdDef->getDeclContext())) {
6408 auto declName = tdDef->getNameAsString();
6419 clang::QualType
type(tdDef->getTypeForDecl(), 0);
6422 canon =
ns->getCanonicalDecl();
6423 name = ND->getQualifiedNameAsString();
6425 name = ND->getQualifiedNameAsString();
6474 std::set<TClass*> modifiedTClasses;
6479 bool isTUTransaction =
false;
6480 if (!
T.empty() &&
T.decls_begin() + 1 ==
T.decls_end() && !
T.hasNestedTransactions()) {
6481 clang::Decl* FirstDecl = *(
T.decls_begin()->m_DGR.begin());
6482 if (llvm::isa<clang::TranslationUnitDecl>(FirstDecl)) {
6485 isTUTransaction =
true;
6489 std::set<const void*> TransactionDeclSet;
6490 if (!isTUTransaction &&
T.decls_end() -
T.decls_begin()) {
6491 const clang::Decl* WrapperFD =
T.getWrapperFD();
6492 for (cling::Transaction::const_iterator
I =
T.decls_begin(),
E =
T.decls_end();
6494 if (
I->m_Call != cling::Transaction::kCCIHandleTopLevelDecl
6495 &&
I->m_Call != cling::Transaction::kCCIHandleTagDeclDefinition)
6498 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
6499 DE =
I->m_DGR.end(); DI != DE; ++DI) {
6500 if (*DI == WrapperFD)
6502 TransactionDeclSet.insert(*DI);
6503 ((
TCling*)
gCling)->HandleNewDecl(*DI,
false, modifiedTClasses);
6510 for (cling::Transaction::const_iterator
I =
T.deserialized_decls_begin(),
6511 E =
T.deserialized_decls_end();
I !=
E; ++
I) {
6512 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
6513 DE =
I->m_DGR.end(); DI != DE; ++DI)
6514 if (TransactionDeclSet.find(*DI) == TransactionDeclSet.end()) {
6530 std::vector<TClass*> modifiedTClassesDiff(modifiedTClasses.size());
6531 std::vector<TClass*>::iterator it;
6532 it = set_difference(modifiedTClasses.begin(), modifiedTClasses.end(),
6535 modifiedTClassesDiff.begin());
6536 modifiedTClassesDiff.resize(it - modifiedTClassesDiff.begin());
6539 ((
TCling*)
gCling)->GetModTClasses().insert(modifiedTClassesDiff.begin(),
6540 modifiedTClassesDiff.end());
6541 for (std::vector<TClass*>::const_iterator
I = modifiedTClassesDiff.begin(),
6542 E = modifiedTClassesDiff.end();
I !=
E; ++
I) {
6544 if (!
gROOT->GetListOfClasses()->FindObject(*
I)) {
6548 cling::Interpreter::PushTransactionRAII RAII(
fInterpreter);
6568 for (DeclContext::decl_iterator RI = DC->decls_begin(), RE = DC->decls_end(); RI != RE; ++RI) {
6569 if (isa<VarDecl>(*RI) || isa<FieldDecl>(*RI)) {
6570 const clang::ValueDecl* VD = dyn_cast<ValueDecl>(*RI);
6574 datamembers->
Unload(var);
6577 }
else if (
const FunctionDecl* FD = dyn_cast<FunctionDecl>(*RI)) {
6583 }
else if (
const EnumDecl* ED = dyn_cast<EnumDecl>(*RI)) {
6586 TIter iEnumConst(
e->GetConstants());
6591 if (enumConst && enumConst->IsValid()) {
6592 datamembers->
Unload(enumConst);
6593 enumConst->Update(0);
6599 }
else if (
const FunctionTemplateDecl* FTD = dyn_cast<FunctionTemplateDecl>(*RI)) {
6601 if (functiontemplate) {
6602 functiontemplates->
Unload(functiontemplate);
6603 functiontemplate->
Update(0);
6620 cling::Transaction::const_nested_iterator iNested =
T.nested_begin();
6621 for(cling::Transaction::const_iterator
I =
T.decls_begin(),
E =
T.decls_end();
6623 if (
I->m_Call == cling::Transaction::kCCIHandleVTable)
6626 if (
I->m_Call == cling::Transaction::kCCINone) {
6632 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
6633 DE =
I->m_DGR.end(); DI != DE; ++DI) {
6637 if ( (*DI)->isFromASTFile() )
6641 if (isa<VarDecl>(*DI) || isa<EnumConstantDecl>(*DI)) {
6652 if (
g &&
g->IsValid()) {
6659 }
else if (
const FunctionDecl* FD = dyn_cast<FunctionDecl>(*DI)) {
6666 }
else if (
const FunctionTemplateDecl* FTD = dyn_cast<FunctionTemplateDecl>(*DI)) {
6668 if (functiontemplate) {
6669 functiontemplates->
Unload(functiontemplate);
6670 functiontemplate->
Update(0);
6673 }
else if (
const EnumDecl* ED = dyn_cast<EnumDecl>(*DI)) {
6676 TIter iEnumConst(
e->GetConstants());
6682 globals->
Unload(enumConst);
6683 enumConst->Update(0);
6691 }
else if (
const clang::RecordDecl* RD = dyn_cast<RecordDecl>(*DI)) {
6692 std::vector<TClass*> vectTClass;
6694 if (RD->isCompleteDefinition()) {
6696 for (std::vector<TClass*>::iterator CI = vectTClass.begin(), CE = vectTClass.end();
6699 (*CI)->ResetClassInfo();
6704 }
else if (
const clang::NamespaceDecl* ND = dyn_cast<NamespaceDecl>(*DI)) {
6705 std::vector<TClass*> vectTClass;
6707 for (std::vector<TClass*>::iterator CI = vectTClass.begin(), CE = vectTClass.end();
6710 if (ND->isOriginalNamespace()) {
6711 (*CI)->ResetClassInfo();
6727 std::size_t normNameHash = triter->second;
6733 auto const &hNamesPtrs = iter->second;
6734 for (
auto &hName : hNamesPtrs) {
6736 Info(
"TransactionRollback",
6737 "Restoring ability to autoaparse: %s", hName);
6775 if (!cls || !*cls) {
6783 const char* libs = libs_record->
GetValue();
6784 return (*libs) ? libs : 0;
6791 c.ReplaceAll(
"::",
"@@");
6794 c.ReplaceAll(
" ",
"-");
6801 const char* libs = libs_record->
GetValue();
6802 return (*libs) ? libs : 0;
6817 if (!
fMapfile || !lib || !lib[0]) {
6827 size_t len = libname.
Length();
6828 while ((rec = (
TEnvRec*) next())) {
6829 const char* libs = rec->
GetValue();
6830 if (!strncmp(libs, libname.
Data(), len) && strlen(libs) >= len
6831 && (!libs[len] || libs[len] ==
' ' || libs[len] ==
'.')) {
6844#if defined(R__MUST_REVISIT)
6845#if R__MUST_REVISIT(6,2)
6846 Warning(
"IsErrorMessagesEnabled",
"Interface not available yet.");
6858#if defined(R__MUST_REVISIT)
6859#if R__MUST_REVISIT(6,2)
6860 Warning(
"SetErrorMessages",
"Interface not available yet.");
6876 llvm::SmallVector<std::string, 10> includePaths;
6878 fInterpreter->GetIncludePaths(includePaths,
false,
true);
6879 if (
const size_t nPaths = includePaths.size()) {
6880 assert(!(nPaths & 1) &&
"GetIncludePath, number of paths and options is not equal");
6882 for (
size_t i = 0; i < nPaths; i += 2) {
6887 if (includePaths[i] !=
"-I")
6921 assert(fout != 0 &&
"DisplayIncludePath, 'fout' parameter is null");
6923 llvm::SmallVector<std::string, 10> includePaths;
6925 fInterpreter->GetIncludePaths(includePaths,
false,
true);
6926 if (
const size_t nPaths = includePaths.size()) {
6927 assert(!(nPaths & 1) &&
"DisplayIncludePath, number of paths and options is not equal");
6929 std::string allIncludes(
"include path:");
6930 for (
size_t i = 0; i < nPaths; i += 2) {
6932 allIncludes += includePaths[i];
6934 if (includePaths[i] !=
"-I")
6936 allIncludes += includePaths[i + 1];
6939 fprintf(fout,
"%s\n", allIncludes.c_str());
6958#if defined(R__MUST_REVISIT)
6959#if R__MUST_REVISIT(6,2)
6960 Warning(
"GenericError",
"Interface not available yet.");
6988#if defined(R__MUST_REVISIT)
6989#if R__MUST_REVISIT(6,2)
6990 Warning(
"GetSecurityError",
"Interface not available yet.");
7001 cling::Interpreter::CompilationResult compRes;
7003 return compRes == cling::Interpreter::kFailure;
7022 TTHREAD_TLS_DECL(std::string,buffer);
7023 ROOT::TMetaUtils::GetCppName(buffer,
name);
7024 return buffer.c_str();
7090#if defined(R__MUST_REVISIT)
7091#if R__MUST_REVISIT(6,2)
7092 Warning(
"SetErrmsgcallback",
"Interface not available yet.");
7110 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
7111 std::string canonical = DLM->lookupLibrary(path);
7112 if (canonical.empty()) {
7116 cling::Interpreter::CompilationResult compRes;
7118 return compRes == cling::Interpreter::kFailure;
7122 return std::unique_ptr<TInterpreterValue>(
new TClingValue);
7129 std::vector<std::string>& completions)
7140 return compRes!=cling::Interpreter::kSuccess ? 0 : 1 ;
7147 using namespace cling;
7161 if (value.isValid() && value.needsManagedAllocation()) {
7182 auto iSpecObj = iSpecObjMap->second.find(
Name);
7183 if (iSpecObj != iSpecObjMap->second.end()) {
7185 return iSpecObj->second;
7192 ASTContext&
C = SemaR.getASTContext();
7193 Preprocessor &PP = SemaR.getPreprocessor();
7195 Preprocessor::CleanupAndRestoreCacheRAII cleanupRAII(PP);
7196 Parser::ParserCurTokRestoreRAII savedCurToken(
P);
7199 Token& Tok =
const_cast<Token&
>(
P.getCurToken());
7200 Tok.setKind(tok::semi);
7206 Sema::ContextAndScopeRAII pushedDCAndS(SemaR,
C.getTranslationUnitDecl(),
7212 Error(
"GetObjectAddress",
"Got a special object without LookupCtx!");
7226 clang::CXXRecordDecl* klass)
const
7228 using namespace clang;
7229 ASTContext& Ctx = klass->getASTContext();
7230 FriendDecl::FriendUnion friendUnion(
function);
7233 FriendDecl* friendDecl = FriendDecl::Create(Ctx, klass, sl, friendUnion, sl);
7234 klass->pushFriendDecl(friendDecl);
7248 if (func)
return ((
TClingCallFunc*)func)->GetDecl()->getCanonicalDecl();
7319 f->Exec(address, &val);
7327 f->ExecWithReturn(address, ret);
7333 const void* args[] ,
7338 f->ExecWithArgsAndReturn(address, args, nargs, ret);
7346 return f->ExecInt(address);
7354 return f->ExecInt64(address);
7362 return f->ExecDouble(address);
7385 return (MethodInfo_t*)
f->FactoryMethod();
7393 f->IgnoreExtraArgs(ignore);
7410 return f->IsValid();
7419 return f->IFacePtr();
7483 f->SetArgArray(paramArr, nparam);
7500 f->SetFunc(ci, method, params, offset);
7509 f->SetFunc(ci, method, params, objectIsConst, offset);
7527 f->SetFuncProto(ci, method,
proto, offset, mode);
7537 f->SetFuncProto(ci, method,
proto, objectIsConst, offset, mode);
7547 llvm::SmallVector<clang::QualType, 4> funcProto;
7548 for (std::vector<TypeInfo_t*>::const_iterator iter =
proto.begin(), end =
proto.end();
7549 iter != end; ++iter) {
7550 funcProto.push_back( ((
TClingTypeInfo*)(*iter))->GetQualType() );
7552 f->SetFuncProto(ci, method, funcProto, offset, mode);
7562 llvm::SmallVector<clang::QualType, 4> funcProto;
7563 for (std::vector<TypeInfo_t*>::const_iterator iter =
proto.begin(), end =
proto.end();
7564 iter != end; ++iter) {
7565 funcProto.push_back( ((
TClingTypeInfo*)(*iter))->GetQualType() );
7567 f->SetFuncProto(ci, method, funcProto, objectIsConst, offset, mode);
7573 std::string wrapper_name;
7574 std::string wrapper;
7575 f->get_wrapper_code(wrapper_name, wrapper);
7591 if (!declid)
return kFALSE;
7593 const clang::Decl *scope;
7595 else scope =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
7597 const clang::Decl *decl =
reinterpret_cast<const clang::Decl*
>(declid);
7598 const clang::DeclContext *ctxt = clang::Decl::castToDeclContext(scope);
7599 if (!decl || !ctxt)
return kFALSE;
7600 if (decl->getDeclContext()->Equals(ctxt))
7602 else if (decl->getDeclContext()->isTransparentContext() &&
7603 decl->getDeclContext()->getParent()->Equals(ctxt))
7716 TClinginfo->
Init(tagnum);
7789 return TClinginfo->
Next();
7837 return TClinginfo->
Size();
7845 return TClinginfo->
Tagnum();
7861 TTHREAD_TLS_DECL(std::string,
output);
7871 return TClinginfo->
Name();
7879 return TClinginfo->
Title();
7916 ClassInfo_t* base)
const
7929 return TClinginfo->
Next();
7937 return TClinginfo->
Next(onlyDirect);
7945 return TClinginfo->
Offset(address, isDerivedObject);
7958 return TClinginfo->
GetBaseOffset(TClinginfoBase, address, isDerivedObject);
7974 return (ClassInfo_t *)TClinginfo->
GetBase();
7982 return TClinginfo->
Tagnum();
7990 TTHREAD_TLS_DECL(std::string,
output);
8000 return TClinginfo->
Name();
8045 const clang::Decl* decl =
reinterpret_cast<const clang::Decl*
>(declid);
8046 const clang::ValueDecl* vd = llvm::dyn_cast_or_null<clang::ValueDecl>(decl);
8079 return TClinginfo->
Next();
8087 return TClinginfo->
Offset();
8135 return TClinginfo->
Name();
8143 return TClinginfo->
Title();
8150 TTHREAD_TLS_DECL(std::string,result);
8154 return result.c_str();
8161 Decl* decl =
static_cast<Decl*
>(
const_cast<void*
>(declId));
8162 ASTContext &
C = decl->getASTContext();
8163 SourceRange commentRange;
8164 decl->addAttr(
new (
C) AnnotateAttr( commentRange,
C, attribute, 0 ) );
8175 cling::Interpreter &interp,
8176 const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt)
8178 const clang::TypeDecl* td = llvm::dyn_cast<clang::TypeDecl>(decl->getDeclContext());
8181 clang::QualType qualType(td->getTypeForDecl(),0);
8183 unsigned int level = 0;
8184 for(
size_t cursor =
name.length()-1; cursor != 0; --cursor) {
8185 if (
name[cursor] ==
'>') ++level;
8186 else if (
name[cursor] ==
'<' && level) --level;
8187 else if (level == 0 &&
name[cursor] ==
':') {
8188 name.erase(0,cursor+1);
8199 if (llvm::isa<clang::CXXConstructorDecl>(decl))
8203 }
else if (llvm::isa<clang::CXXDestructorDecl>(decl))
8208 llvm::raw_string_ostream stream(
output);
8209 auto printPolicy = decl->getASTContext().getPrintingPolicy();
8211 printPolicy.AnonymousTagLocations =
false;
8212 decl->getNameForDiagnostic(stream, printPolicy,
false);
8242 return (FuncTempInfo_t*)
const_cast<void*
>(declid);
8253 return (FuncTempInfo_t*)ft_info;
8273 if (!ft_info)
return 0;
8274 const clang::FunctionTemplateDecl *ft = (
const clang::FunctionTemplateDecl*)ft_info;
8275 return ft->getTemplateParameters()->size();
8284 if (!ft_info)
return 0;
8285 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
8286 return ft->getTemplateParameters()->getMinRequiredArguments();
8294 if (!ft_info)
return 0;
8299 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
8301 switch (ft->getAccess()) {
8302 case clang::AS_public:
8305 case clang::AS_protected:
8308 case clang::AS_private:
8311 case clang::AS_none:
8312 if (ft->getDeclContext()->isNamespace())
8320 const clang::FunctionDecl *fd = ft->getTemplatedDecl();
8321 if (
const clang::CXXMethodDecl *md =
8322 llvm::dyn_cast<clang::CXXMethodDecl>(fd)) {
8323 if (md->getTypeQualifiers() & clang::Qualifiers::Const) {
8326 if (md->isVirtual()) {
8332 if (
const clang::CXXConstructorDecl *cd =
8333 llvm::dyn_cast<clang::CXXConstructorDecl>(md)) {
8334 if (cd->isExplicit()) {
8338 else if (
const clang::CXXConversionDecl *cd =
8339 llvm::dyn_cast<clang::CXXConversionDecl>(md)) {
8340 if (cd->isExplicit()) {
8354 if (!ft_info)
return 0;
8359 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
8360 const clang::FunctionDecl *fd = ft->getTemplatedDecl();
8362 if (fd->isOverloadedOperator()) {
8365 else if (llvm::isa<clang::CXXConversionDecl>(fd)) {
8367 }
else if (llvm::isa<clang::CXXConstructorDecl>(fd)) {
8369 }
else if (llvm::isa<clang::CXXDestructorDecl>(fd)) {
8382 if (!ft_info)
return;
8383 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
8395 if (!ft_info)
return;
8396 const clang::FunctionTemplateDecl *ft = (
const clang::FunctionTemplateDecl*)ft_info;
8400 if (
const RedeclarableTemplateDecl *AnnotFD
8401 = ROOT::TMetaUtils::GetAnnotatedRedeclarable((
const RedeclarableTemplateDecl*)ft)) {
8402 if (AnnotateAttr *
A = AnnotFD->getAttr<AnnotateAttr>()) {
8403 output =
A->getAnnotation().str();
8407 if (!ft->isFromASTFile()) {
8411 output = ROOT::TMetaUtils::GetComment(*ft).str();
8457 const clang::Decl* decl =
reinterpret_cast<const clang::Decl*
>(declid);
8459 const clang::FunctionDecl* fd = llvm::dyn_cast_or_null<clang::FunctionDecl>(decl);
8491 return info->
NArg();
8507 return info->
Next();
8531 return (TypeInfo_t*)info->
Type();
8539 TTHREAD_TLS_DECL(
TString, mangled_name);
8541 return mangled_name;
8557 return info->
Name();
8584 return info->
Title();
8592 return MethodInfo_MethodCallReturnType(func->fInfo);
8594 return EReturnType::kOther;
8603 if (info && info->
IsValid()) {
8605 clang::QualType QT( typeinfo->
GetQualType().getCanonicalType() );
8606 if (QT->isEnumeralType()) {
8607 return EReturnType::kLong;
8608 }
else if (QT->isPointerType()) {
8610 QT = llvm::cast<clang::PointerType>(QT)->getPointeeType();
8611 if ( QT->isCharType() ) {
8612 return EReturnType::kString;
8614 return EReturnType::kOther;
8616 }
else if ( QT->isFloatingType() ) {
8617 int sz = typeinfo->
Size();
8618 if (sz == 4 || sz == 8) {
8620 return EReturnType::kDouble;
8622 return EReturnType::kOther;
8624 }
else if ( QT->isIntegerType() ) {
8625 int sz = typeinfo->
Size();
8634 return EReturnType::kLong;
8636 return EReturnType::kOther;
8639 return EReturnType::kOther;
8642 return EReturnType::kOther;
8678 return (MethodArgInfo_t*)
8695 return info->
Next();
8719 return info->
Name();
8795 return TClinginfo->
Name();
8819 return TClinginfo->
Size();
8869 const char*
name)
const
8889 return TClinginfo->
Next();
8905 return TClinginfo->
Size();
8921 return TClinginfo->
Name();
8929 return TClinginfo->
Title();
8938 Error(
"SnapshotMutexState",
"fRecurseCount != 0 even though initial mutex state is unset!");
8954 Error(
"ForgetMutexState",
"mutex state's recurse count already 0!");
8971 std::unique_ptr<TVirtualRWMutex::StateDelta> uniqueP{typedDelta};
8988 return uniqueP.release();
#define R(a, b, c, d, e, f, g, h, i)
unsigned long long ULong64_t
TClass *(* DictFuncPtr_t)()
R__EXTERN TApplication * gApplication
R__EXTERN TClassTable * gClassTable
static void indent(ostringstream &buf, int indent_level)
std::string AlternateTuple(const char *classname)
static bool requiresRootMap(const char *rootmapfile, cling::Interpreter *interp)
void TCling__RestoreInterpreterMutex(void *delta)
Re-apply the lock count delta that TCling__ResetInterpreterMutex() caused.
void TCling__FindLoadedLibraries(std::vector< std::pair< uint32_t, std::string > > &sLibraries, std::vector< std::string > &sPaths, cling::Interpreter &interpreter, bool searchSystem)
void * llvmLazyFunctionCreator(const std::string &mangled_name)
Autoload a library provided the mangled name of a missing symbol.
void TCling__TransactionRollback(const cling::Transaction &T)
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)
R__DLLEXPORT clang::DeclContext * TCling__DEBUG__getDeclContext(clang::Decl *D)
static std::string GetModuleNameAsString(clang::Module *M, const clang::Preprocessor &PP)
ETupleOrdering
Check in what order the member of a tuple are layout.
static bool LookupNormalSymbols(llvm::object::ObjectFile *RealSoFile, const std::string &mangled_name, const std::string &LibName)
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)
R__DLLEXPORT void TCling__DEBUG__printName(clang::Decl *D)
R__DLLEXPORT void TCling__DEBUG__decl_dump(void *D)
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.
R__DLLEXPORT clang::NamespaceDecl * TCling__DEBUG__DCtoNamespace(clang::DeclContext *DC)
void TCling__UnlockCompilationDuringUserCodeExecution(void *)
Unlock the interpreter.
const char * TCling__GetClassSharedLibs(const char *className)
static uint32_t GNUHash(StringRef S)
R__DLLEXPORT clang::RecordDecl * TCling__DEBUG__DCtoRecordDecl(clang::DeclContext *DC)
static bool R__InitStreamerInfoFactory()
Helper to initialize TVirtualStreamerInfo's factor early.
int TCling__AutoParseCallback(const char *className)
static void ConstructorName(std::string &name, const clang::NamedDecl *decl, cling::Interpreter &interp, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt)
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 RegisterPrebuiltModulePath(clang::Preprocessor &PP, const std::string &FullPath)
R__DLLEXPORT bool TCling__TEST_isInvalidDecl(clang::Decl *D)
static bool LoadModule(const std::string &ModuleName, cling::Interpreter &interp, bool Complain=true)
R__DLLEXPORT void DestroyInterpreter(TInterpreter *interp)
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()
R__DLLEXPORT TInterpreter * CreateInterpreter(void *interpLibHandle, const char *argv[])
R__DLLEXPORT void TCling__DEBUG__dump(clang::DeclContext *DC)
static void TCling__UpdateClassInfo(const NamedDecl *TD)
Update TClingClassInfo for a class (e.g. upon seeing a definition).
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.
static std::string FindLibraryName(void(*func)())
Wrapper around dladdr (and friends)
int TCling__AutoLoadCallback(const char *className)
static bool IsFromRootCling()
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 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 bool LookupBloomFilter(llvm::object::ObjectFile *soFile, uint32_t hash)
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 void * LazyFunctionCreatorAutoloadForModule(const std::string &mangled_name, cling::Interpreter *fInterpreter)
static StringRef GetGnuHashSection(llvm::object::ObjectFile *file)
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 TCling__SplitAclicMode(const char *fileName, string &mode, string &args, string &io, string &fname)
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
R__EXTERN Int_t gErrorIgnoreLevel
void Warning(const char *location, const char *msgfmt,...)
void Fatal(const char *location, const char *msgfmt,...)
R__EXTERN TVirtualMutex * gInterpreterMutex
#define R__LOCKGUARD_CLING(mutex)
R__EXTERN TInterpreter * gCling
char * Form(const char *fmt,...)
typedef void((*Func_t)())
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 Long_t ExecuteFile(const char *file, Int_t *error=0, 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 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 list containing the TEnums of 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 *)
TList * GetListOfEnums(Bool_t load=kTRUE)
Return a list containing the TEnums of a class.
TList * GetListOfMethods(Bool_t load=kTRUE)
Return list containing the TMethods of a class.
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().
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
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
Long_t Property() const
Set TObject::fBits and fStreamerType to cache information about the class.
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
void ResetCaches()
To clean out all caches.
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.
long ExecInt(void *address)
void SetArgs(const char *args)
void SetFunc(const TClingClassInfo *info, const char *method, const char *arglist, long *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
void SetAutoloadingEnabled(bool val=true)
bool IsAutoloadingEnabled()
void SetAutoParsingSuspended(bool val=true)
Emulation of the CINT ClassInfo class.
bool HasDefaultConstructor() const
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
TClingMethodInfo GetMethodWithArgs(const char *fname, const char *arglist, long *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch, EInheritanceMode imode=kWithInheritance) const
const char * TmpltName() const
const clang::Type * GetType() const
ptrdiff_t GetBaseOffset(TClingClassInfo *toBase, void *address, bool isDerivedObject)
bool IsScopedEnum() 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 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
bool IsValidMethod(const char *method, const char *proto, Bool_t objectIsConst, long *offset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) 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
const char * Name() override
int MaxIndex(int dim) const
llvm::StringRef ValidArrayIndex() const
long TypeProperty() const
virtual const char * Name()
virtual bool IsValid() const
virtual const clang::Decl * GetDecl() const
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.
const char * Name() override
std::string GetMangledName() const
const char * TypeName() const
void * InterfaceMethod(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
const char * GetPrototype()
const clang::FunctionDecl * GetMethodDecl() const
long ExtraProperty() 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
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 * Name() override
Get the name of the current typedef.
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.
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.
virtual const char * MethodArgInfo_DefaultValue(MethodArgInfo_t *marginfo) const
virtual std::string CallFunc_GetWrapperCode(CallFunc_t *func) const
virtual void FuncTempInfo_Name(FuncTempInfo_t *, TString &name) const
Return the name of this function template.
virtual void FuncTempInfo_Title(FuncTempInfo_t *, TString &name) const
Return the comments associates with this function template.
virtual int TypedefInfo_Next(TypedefInfo_t *tinfo) const
virtual bool DiagnoseIfInterpreterException(const std::exception &e) const
virtual bool ClassInfo_IsValid(ClassInfo_t *info) const
virtual bool ClassInfo_IsScopedEnum(ClassInfo_t *info) const
Long_t Calc(const char *line, EErrorCode *error=0)
Directly execute an executable statement (e.g.
Bool_t HasPCMForLibrary(const char *libname) const
Return true if ROOT has cxxmodules pcm for a given library name.
virtual MethodInfo_t * MethodInfo_FactoryCopy(MethodInfo_t *minfo) const
bool LoadPCM(const std::string &pcmFileNameFullPath)
Tries to load a PCM; returns true on success.
virtual const char * TypeInfo_Name(TypeInfo_t *) const
DeclId_t GetFunction(ClassInfo_t *cl, const char *funcname)
Return pointer to cling interface function for a method of a class with a certain name.
bool LibraryLoadingFailed(const std::string &, const std::string &, bool, bool)
virtual bool ClassInfo_HasMethod(ClassInfo_t *info, const char *name) const
std::vector< void * > fRegisterModuleDyLibs
virtual MethodInfo_t * CallFunc_FactoryMethod(CallFunc_t *func) const
virtual bool MethodInfo_IsValid(MethodInfo_t *minfo) const
virtual const char * DataMemberInfo_TypeTrueName(DataMemberInfo_t *dminfo) const
void CreateListOfDataMembers(TClass *cl) const
Create list of pointers to data members for TClass cl.
void UnRegisterTClassUpdate(const TClass *oldcl)
If the dictionary is loaded, we can remove the class from the list (otherwise the class might be load...
void HandleNewDecl(const void *DV, bool isDeserialized, std::set< TClass * > &modifiedClasses)
virtual const char * MethodInfo_TypeName(MethodInfo_t *minfo) const
virtual Long_t TypedefInfo_Property(TypedefInfo_t *tinfo) const
virtual void MethodArgInfo_Delete(MethodArgInfo_t *marginfo) const
Bool_t IsAutoLoadNamespaceCandidate(const char *name)
virtual void LoadFunctionTemplates(TClass *cl) const
Create list of pointers to function templates for TClass cl.
virtual CallFunc_t * CallFunc_Factory() const
virtual TypedefInfo_t * TypedefInfo_FactoryCopy(TypedefInfo_t *tinfo) const
std::vector< const char * > fCurExecutingMacros
void UpdateListsOnCommitted(const cling::Transaction &T)
virtual void SetAllocunlockfunc(void(*)()) const
[Place holder for Mutex Unlock] Provide the interpreter with a way to release a lock used to protect ...
virtual Long_t ClassInfo_Tagnum(ClassInfo_t *info) const
void UpdateListOfTypes()
No op: see TClingCallbacks (used to update the list of types)
virtual DeclId_t GetDataMemberAtAddr(const void *addr) const
Return pointer to cling DeclId for a data member with a given name.
virtual int DataMemberInfo_ArrayDim(DataMemberInfo_t *dminfo) const
virtual bool ClassInfo_IsBase(ClassInfo_t *info, const char *name) const
virtual int BaseClassInfo_Next(BaseClassInfo_t *bcinfo) const
virtual void GenericError(const char *error) const
Let the interpreter issue a generic error, and set its error state.
virtual std::string MethodArgInfo_TypeNormalizedName(MethodArgInfo_t *marginfo) const
virtual const char * ClassInfo_TmpltName(ClassInfo_t *info) const
virtual TEnum * CreateEnum(void *VD, TClass *cl) const
virtual EReturnType MethodCallReturnType(TFunction *func) const
virtual int UnloadFile(const char *path) const
virtual int Evaluate(const char *, TInterpreterValue &)
Get the interpreter value corresponding to the statement.
TObject * GetObjectAddress(const char *Name, void *&LookupCtx)
If the interpreter encounters Name, check whether that is an object ROOT could retrieve.
virtual Long_t TypeInfo_Property(TypeInfo_t *tinfo) const
DeclId_t GetFunctionWithPrototype(ClassInfo_t *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Return pointer to cling interface function for a method of a class with a certain prototype,...
void EndOfLineAction()
It calls a "fantom" method to synchronize user keyboard input and ROOT prompt line.
DeclId_t GetFunctionWithValues(ClassInfo_t *cl, const char *method, const char *params, Bool_t objectIsConst=kFALSE)
Return pointer to cling DeclId for a method of a class with a certain prototype, i....
void UpdateListOfLoadedSharedLibraries()
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)
Inject the module named "modulename" into cling; load all headers.
virtual const char * DataMemberInfo_ValidArrayIndex(DataMemberInfo_t *dminfo) const
void InitRootmapFile(const char *name)
Create a resource table and read the (possibly) three resource files, i.e $ROOTSYS/etc/system<name> (...
void CreateListOfMethodArgs(TFunction *m) const
Create list of pointers to method arguments for TMethod m.
virtual void TypedefInfo_Init(TypedefInfo_t *tinfo, const char *name) const
virtual Long_t MethodInfo_ExtraProperty(MethodInfo_t *minfo) const
virtual ~TCling()
Destroy the interpreter interface.
void AddFriendToClass(clang::FunctionDecl *, clang::CXXRecordDecl *) const
Inject function as a friend into klass.
std::vector< MutexStateAndRecurseCount > fInitialMutex
Bool_t fCxxModulesEnabled
void RefreshClassInfo(TClass *cl, const clang::NamedDecl *def, bool alias)
Internal function. Actually do the update of the ClassInfo when seeing.
void ExecuteWithArgsAndReturn(TMethod *method, void *address, const void *args[]=0, int nargs=0, void *ret=0) const
virtual void FuncTempInfo_Delete(FuncTempInfo_t *) const
Delete the FuncTempInfo_t.
Bool_t SetSuspendAutoParsing(Bool_t value)
Suspend the Autoparsing of headers.
virtual DataMemberInfo_t * DataMemberInfo_FactoryCopy(DataMemberInfo_t *dminfo) const
virtual CallFuncIFacePtr_t CallFunc_IFacePtr(CallFunc_t *func) const
virtual void CallFunc_ExecWithReturn(CallFunc_t *func, void *address, void *ret) const
virtual MethodArgInfo_t * MethodArgInfo_Factory() const
virtual void DataMemberInfo_Delete(DataMemberInfo_t *dminfo) const
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.
virtual int LoadFile(const char *path) const
Load a source file or library called path into the interpreter.
void CodeComplete(const std::string &, size_t &, std::vector< std::string > &)
The call to Cling's tab complition.
virtual int SetClassAutoloading(int) const
Enable/Disable the Autoloading of libraries.
virtual Long_t FuncTempInfo_Property(FuncTempInfo_t *) const
Return the property of the function template.
virtual TypeInfo_t * MethodInfo_Type(MethodInfo_t *minfo) const
virtual const char * MethodArgInfo_TypeName(MethodArgInfo_t *marginfo) const
Bool_t HandleNewTransaction(const cling::Transaction &T)
Helper function to increase the internal Cling count of transactions that change the AST.
virtual bool DataMemberInfo_IsValid(DataMemberInfo_t *dminfo) const
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...
Bool_t IsLoaded(const char *filename) const
Return true if the file has already been loaded by cint.
const char * GetSharedLibs()
Return the list of shared libraries loaded into the process.
virtual const char * GetTopLevelMacroName() const
Return the file name of the current un-included interpreted file.
std::map< SpecialObjectLookupCtx_t, SpecialObjectMap_t > fSpecialObjectMaps
virtual DeclId_t GetDataMemberWithValue(const void *ptrvalue) const
NOT IMPLEMENTED.
virtual bool MethodArgInfo_IsValid(MethodArgInfo_t *marginfo) const
Int_t ReloadAllSharedLibraryMaps()
Reload the library map entries coming from all the loaded shared libraries, after first unloading the...
virtual void SetErrmsgcallback(void *p) const
Set a callback to receive error messages.
virtual std::string ToString(const char *type, void *obj)
virtual const char * MethodInfo_Title(MethodInfo_t *minfo) const
virtual Long_t ClassInfo_GetBaseOffset(ClassInfo_t *fromDerived, ClassInfo_t *toBase, void *address, bool isDerivedObject) const
virtual int DataMemberInfo_TypeSize(DataMemberInfo_t *dminfo) const
virtual ClassInfo_t * ClassInfo_Factory(Bool_t all=kTRUE) const
virtual const char * MethodInfo_GetMangledName(MethodInfo_t *minfo) const
virtual bool CallFunc_IsValid(CallFunc_t *func) const
virtual const char * BaseClassInfo_TmpltName(BaseClassInfo_t *bcinfo) const
virtual void SetAlloclockfunc(void(*)()) const
[Place holder for Mutex Lock] Provide the interpreter with a way to acquire a lock used to protect cr...
virtual void MethodInfo_CreateSignature(MethodInfo_t *minfo, TString &signature) const
void SnapshotMutexState(ROOT::TVirtualRWMutex *mtx)
virtual Bool_t ClassInfo_Contains(ClassInfo_t *info, DeclId_t declid) const
Return true if the entity pointed to by 'declid' is declared in the context described by 'info'.
std::set< size_t > fPayloads
virtual const char * ClassInfo_Name(ClassInfo_t *info) const
Int_t UnloadLibraryMap(const char *library)
Unload library map entries coming from the specified library.
virtual ClassInfo_t * BaseClassInfo_ClassInfo(BaseClassInfo_t *) const
TObjArray * fRootmapFiles
virtual void CallFunc_Delete(CallFunc_t *func) const
virtual Long_t ClassInfo_ClassProperty(ClassInfo_t *info) const
virtual bool ClassInfo_IsLoaded(ClassInfo_t *info) const
std::vector< std::pair< TClass *, DictFuncPtr_t > > fClassesToUpdate
virtual int ClassInfo_GetMethodNArg(ClassInfo_t *info, const char *method, const char *proto, Bool_t objectIsConst=false, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
Int_t DeleteGlobal(void *obj)
Delete obj from Cling symbol table so it cannot be accessed anymore.
virtual const char * GetCurrentMacroName() const
Return the file name of the currently interpreted file, included or not.
virtual void TypeInfo_Delete(TypeInfo_t *tinfo) const
virtual Bool_t LoadText(const char *text) const
Load the declarations from text into the interpreter.
void GetInterpreterTypeName(const char *name, std::string &output, Bool_t full=kFALSE)
The 'name' is known to the interpreter, this function returns the internal version of this name (usua...
void * RewindInterpreterMutex()
Reset the interpreter lock to the state it had before interpreter-related calls happened.
virtual Long_t BaseClassInfo_Offset(BaseClassInfo_t *toBaseClassInfo, void *address, bool isDerivedObject) const
virtual int GetSecurityError() const
Interface to cling function.
virtual UInt_t FuncTempInfo_TemplateMinReqArgs(FuncTempInfo_t *) const
Return the number of required template arguments of the function template described by ft_info.
void ResetGlobals()
Reset in Cling the list of global variables to the state saved by the last call to TCling::SaveGlobal...
virtual const char * ClassInfo_Title(ClassInfo_t *info) const
virtual Long_t BaseClassInfo_Property(BaseClassInfo_t *bcinfo) const
virtual FuncTempInfo_t * FuncTempInfo_Factory(DeclId_t declid) const
Construct a FuncTempInfo_t.
void * GetInterfaceMethod(TClass *cl, const char *method, const char *params, Bool_t objectIsConst=kFALSE)
Return pointer to cling interface function for a method of a class with parameters params (params is ...
virtual void ClassInfo_Destruct(ClassInfo_t *info, void *arena) const
virtual const char * BaseClassInfo_FullName(BaseClassInfo_t *bcinfo) const
virtual bool ClassInfo_IsEnum(const char *name) const
Long_t ProcessLine(const char *line, EErrorCode *error=0)
virtual void GetFunctionName(const clang::FunctionDecl *decl, std::string &name) const
virtual void TypedefInfo_Delete(TypedefInfo_t *tinfo) const
void SetGetline(const char *(*getlineFunc)(const char *prompt), void(*histaddFunc)(const char *line))
Set a getline function to call when input is needed.
void UnloadClassMembers(TClass *cl, const clang::DeclContext *DC)
Helper function to go through the members of a class or namespace and unload them.
void RewindDictionary()
Rewind Cling dictionary to the point where it was before executing the current macro.
virtual const char * MapCppName(const char *) const
Interface to cling function.
static void UpdateClassInfoWork(const char *name)
virtual Long_t FuncTempInfo_ExtraProperty(FuncTempInfo_t *) const
Return the property not already defined in Property See TDictionary's EFunctionProperty.
void PrintIntro()
No-op; see TRint instead.
virtual CallFunc_t * CallFunc_FactoryCopy(CallFunc_t *func) const
virtual const char * DataMemberInfo_Name(DataMemberInfo_t *dminfo) const
Bool_t Declare(const char *code)
Declare code to the interpreter, without any of the interpreter actions that could trigger a re-inter...
Int_t DeleteVariable(const char *name)
Undeclare obj called name.
virtual int ClassInfo_Next(ClassInfo_t *info) const
static void * fgSetOfSpecials
void AddIncludePath(const char *path)
Add the given path to the list of directories in which the interpreter looks for include files.
virtual void CallFunc_SetArgArray(CallFunc_t *func, Long_t *paramArr, Int_t nparam) const
virtual const char * MethodInfo_Name(MethodInfo_t *minfo) const
void ClearFileBusy()
Reset the interpreter internal state in case a previous action was not correctly terminated.
virtual const char * MethodArgInfo_Name(MethodArgInfo_t *marginfo) const
virtual Long_t ClassInfo_Property(ClassInfo_t *info) const
ROOT::TMetaUtils::TNormalizedCtxt * fNormalizedCtxt
virtual int MethodInfo_Next(MethodInfo_t *minfo) const
const char * TypeName(const char *typeDesc)
Return the absolute type of typeDesc.
void SaveContext()
Save the current Cling state.
std::set< TClass * > & GetModTClasses()
virtual bool TypeInfo_IsValid(TypeInfo_t *tinfo) const
Int_t AutoLoad(const char *classname, Bool_t knowDictNotLoaded=kFALSE)
Load library containing the specified class.
TClingCallbacks * fClingCallbacks
TString GetMangledNameWithPrototype(TClass *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Return the cling mangled name for a method of a class with a certain prototype, i....
void RegisterTClassUpdate(TClass *oldcl, DictFuncPtr_t dict)
Register classes that already existed prior to their dictionary loading and that already had a ClassI...
virtual Long_t DataMemberInfo_Property(DataMemberInfo_t *dminfo) const
void UpdateListOfGlobalFunctions()
No op: see TClingCallbacks (used to update the list of global functions)
virtual const char * MethodInfo_GetPrototype(MethodInfo_t *minfo) const
virtual bool ClassInfo_IsValidMethod(ClassInfo_t *info, const char *method, const char *proto, Long_t *offset, ROOT::EFunctionMatchMode=ROOT::kConversionMatch) const
virtual void * ClassInfo_New(ClassInfo_t *info) const
virtual void TypeInfo_Init(TypeInfo_t *tinfo, const char *funcname) const
Bool_t SetErrorMessages(Bool_t enable=kTRUE)
If error messages are disabled, the interpreter should suppress its failures and warning messages fro...
virtual const char * DataMemberInfo_Title(DataMemberInfo_t *dminfo) const
void TransactionRollback(const cling::Transaction &T)
virtual EDataType ClassInfo_GetUnderlyingType(ClassInfo_t *info) const
virtual void CallFunc_Init(CallFunc_t *func) const
virtual UInt_t FuncTempInfo_TemplateNargs(FuncTempInfo_t *) const
Return the maximum number of template arguments of the function template described by ft_info.
TString GetMangledName(TClass *cl, const char *method, const char *params, Bool_t objectIsConst=kFALSE)
Return the cling mangled name for a method of a class with parameters params (params is a string of a...
virtual void SetTempLevel(int val) const
Create / close a scope for temporaries.
virtual DeclId_t GetDataMember(ClassInfo_t *cl, const char *name) const
Return pointer to cling Decl of global/static variable that is located at the address given by addr.
void RegisterTemporary(const TInterpreterValue &value)
virtual void LoadEnums(TListOfEnums &cl) const
Create list of pointers to enums for TClass cl.
virtual void CallFunc_SetArg(CallFunc_t *func, Long_t param) const
virtual Long_t GetExecByteCode() const
This routines used to return the address of the internal wrapper function (of the interpreter) that w...
virtual void * MethodInfo_InterfaceMethod(MethodInfo_t *minfo) const
Int_t UnloadAllSharedLibraryMaps()
Unload the library map entries coming from all the loaded shared libraries.
virtual void CallFunc_IgnoreExtraArgs(CallFunc_t *func, bool ignore) const
std::vector< cling::Value > * fTemporaries
virtual Long_t MethodInfo_Property(MethodInfo_t *minfo) const
virtual std::unique_ptr< TInterpreterValue > MakeInterpreterValue() const
virtual Long_t DataMemberInfo_Offset(DataMemberInfo_t *dminfo) const
void LibraryLoaded(const void *dyLibHandle, const char *canonicalName)
virtual TypedefInfo_t * TypedefInfo_Factory() const
void UpdateListOfGlobals()
No op: see TClingCallbacks (used to update the list of globals)
void ClearStack()
Delete existing temporary values.
std::map< const cling::Transaction *, size_t > fTransactionHeadersMap
virtual int SetClassAutoparsing(int)
Enable/Disable the Autoparsing of headers.
Bool_t fHeaderParsingOnDemand
Int_t RescanLibraryMap()
Scan again along the dynamic path for library maps.
cling::Interpreter * fInterpreter
virtual int DataMemberInfo_Next(DataMemberInfo_t *dminfo) const
void Reset()
Pressing Ctrl+C should forward here.
Int_t Load(const char *filenam, Bool_t system=kFALSE)
Load a library file in cling's memory.
void InspectMembers(TMemberInspector &, const void *obj, const TClass *cl, Bool_t isTransient)
Visit all members over members, recursing over base classes.
std::hash< std::string > fStringHashFunction
const char * GetIncludePath()
Refresh the list of include paths known to the interpreter and return it with -I prepended.
virtual void ClassInfo_DeleteArray(ClassInfo_t *info, void *arena, bool dtorOnly) const
Long_t ExecuteMacro(const char *filename, EErrorCode *error=0)
Execute a cling macro.
virtual DeclId_t GetEnum(TClass *cl, const char *name) const
Return pointer to cling Decl of global/static variable that is located at the address given by addr.
void GetFunctionOverloads(ClassInfo_t *cl, const char *funcname, std::vector< DeclId_t > &res) const
Insert overloads of name in cl to res.
virtual void CallFunc_Exec(CallFunc_t *func, void *address) const
const char * GetSharedLibDeps(const char *lib)
Get the list a libraries on which the specified lib depends.
virtual int DisplayIncludePath(FILE *fout) const
Interface to cling function.
void RegisterLoadedSharedLibrary(const char *name)
Register a new shared library name with the interpreter; add it to fSharedLibs.
virtual void UpdateEnumConstants(TEnum *enumObj, TClass *cl) const
void SaveGlobalsContext()
Save the current Cling state of global objects.
std::unordered_set< const clang::NamespaceDecl * > fNSFromRootmaps
virtual Long_t MethodArgInfo_Property(MethodArgInfo_t *marginfo) const
virtual const char * GetSTLIncludePath() const
Return the directory containing CINT's stl cintdlls.
Int_t LoadLibraryMap(const char *rootmapfile=0)
Load map between class and library.
virtual std::string MethodInfo_TypeNormalizedName(MethodInfo_t *minfo) const
void Execute(const char *function, const char *params, int *error=0)
Execute a global function with arguments params.
virtual const char * ClassInfo_FullName(ClassInfo_t *info) const
TClass * GenerateTClass(const char *classname, Bool_t emulation, Bool_t silent=kFALSE)
Generate a TClass for the given class.
virtual int TypeInfo_Size(TypeInfo_t *tinfo) const
virtual int MethodArgInfo_Next(MethodArgInfo_t *marginfo) const
ROOT::TMetaUtils::TClingLookupHelper * fLookupHelper
virtual bool ClassInfo_HasDefaultConstructor(ClassInfo_t *info) const
virtual const char * TypedefInfo_TrueName(TypedefInfo_t *tinfo) const
Bool_t fIsAutoParsingSuspended
TClass * GetClass(const std::type_info &typeinfo, Bool_t load) const
Demangle the name (from the typeinfo) and then request the class via the usual name based interface (...
DeclId_t GetDeclId(const llvm::GlobalValue *gv) const
Return pointer to cling DeclId for a global value.
Long_t ProcessLineAsynch(const char *line, EErrorCode *error=0)
Let cling process a command line asynch.
virtual std::vector< std::string > GetUsingNamespaces(ClassInfo_t *cl) const
Get the scopes representing using declarations of namespace.
Int_t SetClassSharedLibs(const char *cls, const char *libs)
Register the autoloading information for a class.
virtual void ClassInfo_Init(ClassInfo_t *info, const char *funcname) const
virtual TypeInfo_t * TypeInfo_FactoryCopy(TypeInfo_t *) const
Bool_t CheckClassTemplate(const char *name)
Return true if there is a class template by the given name ...
void * fPrevLoadedDynLibInfo
void UpdateListOfDataMembers(TClass *cl) const
Update the list of pointers to data members for TClass cl This is now a nop.
virtual void SetDeclAttr(DeclId_t, const char *)
virtual Long_t DataMemberInfo_TypeProperty(DataMemberInfo_t *dminfo) const
virtual const char * DataMemberInfo_TypeName(DataMemberInfo_t *dminfo) const
virtual void CallFunc_SetArgs(CallFunc_t *func, const char *param) const
virtual const char * BaseClassInfo_Name(BaseClassInfo_t *bcinfo) const
virtual void MethodInfo_Delete(MethodInfo_t *minfo) const
Interface to cling function.
virtual const char * TypeInfo_TrueName(TypeInfo_t *tinfo) const
std::set< const char * > fParsedPayloadsAddresses
ECheckClassInfo CheckClassInfo(const char *name, Bool_t autoload, Bool_t isClassOrNamespaceOnly=kFALSE)
Checks if an entity with the specified name is defined in Cling.
void EnableAutoLoading()
Enable the automatic loading of shared libraries when a class is used that is stored in a not yet loa...
static void UpdateClassInfo(char *name, Long_t tagnum)
No op: see TClingCallbacks.
virtual void BaseClassInfo_Delete(BaseClassInfo_t *bcinfo) const
void ResetGlobalVar(void *obj)
Reset the Cling 'user' global objects/variables state to the state saved by the last call to TCling::...
Bool_t IsLibraryLoaded(const char *libname) const
virtual void Initialize()
Initialize the interpreter, once TROOT::fInterpreter is set.
virtual void * FindSym(const char *entry) const
Interface to cling function.
virtual Long_t CallFunc_ExecInt(CallFunc_t *func, void *address) const
virtual int DataMemberInfo_MaxIndex(DataMemberInfo_t *dminfo, Int_t dim) const
void SetClassInfo(TClass *cl, Bool_t reload=kFALSE)
Set pointer to the TClingClassInfo in TClass.
Long_t ProcessLineSynch(const char *line, EErrorCode *error=0)
Let cling process a command line synchronously, i.e we are waiting it will be finished.
virtual int TypeInfo_RefType(TypeInfo_t *) const
void LoadMacro(const char *filename, EErrorCode *error=0)
Load a macro file in cling's memory.
std::set< size_t > fLookedUpClasses
virtual void CallFunc_ResetArg(CallFunc_t *func) const
virtual Long64_t CallFunc_ExecInt64(CallFunc_t *func, void *address) const
virtual Long_t BaseClassInfo_Tagnum(BaseClassInfo_t *bcinfo) const
void ResetAll()
Reset the Cling state to its initial state.
virtual void ClassInfo_Delete(ClassInfo_t *info) const
virtual DataMemberInfo_t * DataMemberInfo_Factory(ClassInfo_t *clinfo=0) const
virtual Double_t CallFunc_ExecDouble(CallFunc_t *func, void *address) const
UInt_t AutoParseImplRecurse(const char *cls, bool topLevel)
Helper routine for TCling::AutoParse implementing the actual call to the parser and looping over temp...
virtual const char * TypedefInfo_Title(TypedefInfo_t *tinfo) const
void CreateListOfBaseClasses(TClass *cl) const
Create list of pointers to base class(es) for TClass cl.
void RecursiveRemove(TObject *obj)
Delete object from cling symbol table so it can not be used anymore.
virtual MethodArgInfo_t * MethodArgInfo_FactoryCopy(MethodArgInfo_t *marginfo) const
void UpdateListsOnUnloaded(const cling::Transaction &T)
void UpdateClassInfoWithDecl(const clang::NamedDecl *ND)
Internal function. Inform a TClass about its new TagDecl or NamespaceDecl.
virtual const char * ClassInfo_FileName(ClassInfo_t *info) const
virtual void CallFunc_ExecWithArgsAndReturn(CallFunc_t *func, void *address, const void *args[]=0, int nargs=0, void *ret=0) const
DeclId_t GetFunctionTemplate(ClassInfo_t *cl, const char *funcname)
Return pointer to cling interface function for a method of a class with a certain name.
virtual int MethodInfo_NArg(MethodInfo_t *minfo) const
virtual FuncTempInfo_t * FuncTempInfo_FactoryCopy(FuncTempInfo_t *) const
Construct a FuncTempInfo_t.
virtual int TypedefInfo_Size(TypedefInfo_t *tinfo) const
virtual const char * TypedefInfo_Name(TypedefInfo_t *tinfo) const
virtual void CallFunc_SetFuncProto(CallFunc_t *func, ClassInfo_t *info, const char *method, const char *proto, Long_t *Offset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
Interface to cling function.
virtual int DisplayClass(FILE *fout, const char *name, int base, int start) const
const char * GetClassSharedLibs(const char *cls)
Get the list of shared libraries containing the code for class cls.
Bool_t IsErrorMessagesEnabled() const
If error messages are disabled, the interpreter should suppress its failures and warning messages fro...
ULong64_t fTransactionCount
virtual Bool_t FuncTempInfo_IsValid(FuncTempInfo_t *) const
Check validity of a FuncTempInfo_t.
virtual BaseClassInfo_t * BaseClassInfo_Factory(ClassInfo_t *info) const
virtual bool TypedefInfo_IsValid(TypedefInfo_t *tinfo) const
virtual MethodInfo_t * MethodInfo_Factory() const
Int_t AutoParse(const char *cls)
Parse the headers relative to the class Returns 1 in case of success, 0 in case of failure.
virtual EReturnType MethodInfo_MethodCallReturnType(MethodInfo_t *minfo) const
void * GetInterfaceMethodWithPrototype(TClass *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Return pointer to cling interface function for a method of a class with a certain prototype,...
virtual TypeInfo_t * TypeInfo_Factory() const
std::map< size_t, std::vector< const char * > > fClassesHeadersMap
virtual int MethodInfo_NDefaultArg(MethodInfo_t *minfo) const
Int_t GenerateDictionary(const char *classes, const char *includes="", const char *options=0)
Generate the dictionary for the C++ classes listed in the first argument (in a semi-colon separated l...
virtual void CallFunc_SetFunc(CallFunc_t *func, ClassInfo_t *info, const char *method, const char *params, Long_t *Offset) const
void CreateListOfMethods(TClass *cl) const
Create list of pointers to methods for TClass cl.
void UpdateListOfMethods(TClass *cl) const
Update the list of pointers to method for TClass cl This is now a nop.
cling::MetaProcessor * fMetaProcessor
virtual int ClassInfo_Size(ClassInfo_t *info) const
static void UpdateAllCanvases()
Update all canvases at end the terminal input command.
void LibraryUnloaded(const void *dyLibHandle, const char *canonicalName)
Collection abstract base class.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
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
All ROOT classes may have RTTI (run time type identification) support added.
virtual bool Update(DataMemberInfo_t *info)
Update the TFunction to reflect the new info.
Bool_t IsPersistent() const
Bool_t IsValid()
Return true if this data member object is pointing to a currently loaded data member.
Basic data type descriptor (datatype information is obtained from CINT).
virtual TList * GetListOfKeys() const
void GetObject(const char *namecycle, T *&ptr)
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
const char * GetName() const
Returns name of object.
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 TEnvRec * Lookup(const char *n) const
Loop over all resource records and return the one with name.
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=0)
Set the value of a resource or create a new resource.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Dictionary for function template This class describes one single function template.
virtual bool Update(FuncTempInfo_t *info)
Update the TFunctionTemplate to reflect the new info.
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 * FindObject(const char *name) const
Find object using its name.
TObject * Remove(TObject *obj)
Remove object from the list.
THashTable implements a hash table to store TObject's.
virtual const void * GetValAddr() const =0
This class defines an abstract interface to a generic command line interpreter.
virtual Int_t AutoParse(const char *cls)=0
int(* AutoLoadCallBack_t)(const char *)
virtual Bool_t IsLoaded(const char *filename) const =0
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
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...
TDictionary::DeclId_t DeclId_t
TDictionary * Find(DeclId_t id) const
Return (after creating it if necessary) the TDataMember describing the data member corresponding to t...
TClass * GetClass() const
void Unload()
Mark 'all func' as being unloaded.
virtual TObject * FindObject(const char *name) const
Specialize FindObject to do search for the a data member just by name or create it if its not already...
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.
TDictionary::DeclId_t DeclId_t
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
void Unload()
Mark 'all func' as being unloaded.
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
virtual TObject * FindObject(const char *name) const
Specialize FindObject to do search for the a function just by name or create it if its not already in...
TFunctionTemplate * Get(DeclId_t id)
Return (after creating it if necessary) the TMethod or TFunction describing the function correspondin...
void Unload()
Mark 'all func' as being unloaded.
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
virtual TObject * FindObject(const TObject *obj) const
Find object using its hash value (returned by its Hash() member).
TFunction * Find(DeclId_t id) const
Return the TMethod or TFunction describing the function corresponding to the Decl 'id'.
TDictionary::DeclId_t DeclId_t
void Unload()
Mark 'all func' as being unloaded.
virtual void Add(TObject *obj)
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
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.
virtual const char * GetName() const
Returns name of object.
Int_t GetEntriesFast() const
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
virtual void Compress()
Remove empty slots from array.
Int_t GetEntries() const
Return the number of objects in array (i.e.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
virtual TObject * Remove(TObject *obj)
Remove object from array.
TObject * At(Int_t idx) const
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.
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.
@ 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.
virtual ~TROOT()
Clean up and free resources used by ROOT (files, network sockets, shared memory segments,...
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.
Describe Streamer information for one class version.
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 const char * DirName(const char *pathname)
Return the directory name in pathname.
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 const char * HomeDirectory(const char *userName=0)
Return the user's home directory.
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 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
Type
enumeration specifying the integration types.
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
R__EXTERN TROOT * gROOTLocal
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
RVec< T > Filter(const RVec< T > &v, F &&f)
Create a new collection with the elements passing the filter expressed by the predicate.
Namespace for new ROOT classes and functions.
R__EXTERN TVirtualRWMutex * gCoreMutex
V GetOffset(E val1, E val2, V iso)
RooArgSet S(const RooAbsArg &v1)
bool IsStdArray(std::string_view name)
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
std::string InsertStd(const char *tname)
bool SplitFunction(std::string_view decl, FunctionSplitInfo &result)
Split a function declaration into its different parts.
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.
void GetNormalizedName(std::string &norm_name, std::string_view name)
Return the normalized name.
EComplexType GetComplexType(const char *)
static constexpr double s
static constexpr double ns
static constexpr double L
constexpr Double_t E()
Base of natural log:
RAII used to store Parser, Sema, Preprocessor state for recursive parsing.
State as returned by GetStateDelta() that can be passed to Restore()
Result of splitting a function declaration into fReturnType fScopeName::fFunctionName<fFunctionTempla...
std::string fScopeName
Name of the scope qualification of the function, possibly empty.
std::vector< std::string > fElements
void ShortType(std::string &answer, int mode)
Return the absolute type of typeDesc into the string answ.
static void output(int code)