59 #include "RConfigure.h" 60 #include "compiledata.h" 75 #include "clang/AST/ASTContext.h" 76 #include "clang/AST/Decl.h" 77 #include "clang/AST/DeclarationName.h" 78 #include "clang/AST/GlobalDecl.h" 79 #include "clang/AST/RecordLayout.h" 80 #include "clang/AST/RecursiveASTVisitor.h" 81 #include "clang/AST/Type.h" 82 #include "clang/Basic/SourceLocation.h" 83 #include "clang/Basic/Specifiers.h" 84 #include "clang/Basic/TargetInfo.h" 85 #include "clang/CodeGen/ModuleBuilder.h" 86 #include "clang/Frontend/CompilerInstance.h" 87 #include "clang/Frontend/FrontendDiagnostic.h" 88 #include "clang/Lex/HeaderSearch.h" 89 #include "clang/Lex/Preprocessor.h" 90 #include "clang/Sema/Lookup.h" 91 #include "clang/Sema/Sema.h" 92 #include "clang/Parse/Parser.h" 94 #include "cling/Interpreter/ClangInternalState.h" 95 #include "cling/Interpreter/DynamicLibraryManager.h" 96 #include "cling/Interpreter/Interpreter.h" 97 #include "cling/Interpreter/LookupHelper.h" 98 #include "cling/Interpreter/Value.h" 99 #include "cling/Interpreter/Transaction.h" 100 #include "cling/MetaProcessor/MetaProcessor.h" 101 #include "cling/Utils/AST.h" 103 #include "llvm/IR/GlobalValue.h" 104 #include "llvm/IR/Module.h" 106 #include "llvm/Support/DynamicLibrary.h" 107 #include "llvm/Support/raw_ostream.h" 108 #include "llvm/Support/Path.h" 121 #include <unordered_map> 134 #include <mach-o/dyld.h> 141 #if defined(__CYGWIN__) 142 #include <sys/cygwin.h> 143 #define HMODULE void * 145 __declspec(dllimport)
void * __stdcall GetCurrentProcess();
146 __declspec(dllimport)
bool __stdcall EnumProcessModules(
void *,
void **,
unsigned long,
unsigned long *);
147 __declspec(dllimport)
unsigned long __stdcall GetModuleFileNameExW(
void *,
void *,
wchar_t *,
unsigned long);
152 #if defined(_MSC_VER) 154 # define STDIN_FILENO 0 156 #ifndef STDOUT_FILENO 157 # define STDOUT_FILENO 1 159 #ifndef STDERR_FILENO 160 # define STDERR_FILENO 2 169 #undef GetModuleFileName 170 #define RTLD_DEFAULT ((void *)::GetModuleHandle(NULL)) 171 #define dlsym(library, function_name) ::GetProcAddress((HMODULE)library, function_name) 172 #define dlopen(library_name, flags) ::LoadLibrary(library_name) 173 #define dlclose(library) ::FreeLibrary((HMODULE)library) 174 #define R__DLLEXPORT __declspec(dllexport) 182 class TCling_UnloadMarker {
184 ~TCling_UnloadMarker() {
190 static TCling_UnloadMarker gTClingUnloadMarker;
199 return D->getDeclContext();
202 return llvm::dyn_cast<clang::NamespaceDecl>(DC);
205 return llvm::dyn_cast<clang::RecordDecl>(DC);
208 return DC->dumpDeclContext();
217 return ((clang::Decl*)D)->dump();
220 if (clang::NamedDecl* ND = llvm::dyn_cast<clang::NamedDecl>(D)) {
223 llvm::raw_string_ostream OS(name);
224 ND->getNameForDiagnostic(OS, D->getASTContext().getPrintingPolicy(),
227 printf(
"%s\n", name.c_str());
235 return D->isInvalidDecl();
240 return info->
GetDecl()->isInvalidDecl();
244 using namespace clang;
245 using namespace ROOT;
248 static const std::string gInterpreterClassDef = R
"ICF( 250 #define ClassDef(name, id) \ 251 _ClassDefInterp_(name,id,virtual,) \ 252 static int DeclFileLine() { return __LINE__; } 254 #define ClassDefNV(name, id) \ 255 _ClassDefInterp_(name,id,,) \ 256 static int DeclFileLine() { return __LINE__; } 257 #undef ClassDefOverride 258 #define ClassDefOverride(name, id) \ 259 _ClassDefInterp_(name,id,,override) \ 260 static int DeclFileLine() { return __LINE__; } 263 static const std::string gNonInterpreterClassDef = R
"ICF( 264 #define __ROOTCLING__ 1 266 #define ClassDef(name,id) \ 267 _ClassDef_(name,id,virtual,) \ 268 static int DeclFileLine() { return __LINE__; } 270 #define ClassDefNV(name, id)\ 271 _ClassDef_(name,id,,)\ 272 static int DeclFileLine() { return __LINE__; } 273 #undef ClassDefOverride 274 #define ClassDefOverride(name, id)\ 275 _ClassDef_(name,id,,override)\ 276 static int DeclFileLine() { return __LINE__; } 280 static const std::string gClassDefInterpMacro = R
"ICF( 285 #define _ClassDefInterp_(name,id,virtual_keyword, overrd) \ 288 static TClass *Class() { static TClass* sIsA = 0; if (!sIsA) sIsA = TClass::GetClass(#name); return sIsA; } \ 289 static const char *Class_Name() { return #name; } \ 290 static Version_t Class_Version() { return id; } \ 291 static TClass *Dictionary() { return 0; } \ 292 virtual_keyword TClass *IsA() const overrd { return name::Class(); } \ 293 virtual_keyword void ShowMembers(TMemberInspector&insp) const overrd { ::ROOT::Class_ShowMembers(name::Class(), this, insp); } \ 294 virtual_keyword void Streamer(TBuffer&) overrd { ::Error("Streamer", "Cannot stream interpreted class."); } \ 295 void StreamerNVirtual(TBuffer&ClassDef_StreamerNVirtual_b) { name::Streamer(ClassDef_StreamerNVirtual_b); } \ 296 static const char *DeclFileName() { return __FILE__; } \ 297 static int ImplFileLine() { return 0; } \ 298 static const char *ImplFileName() { return __FILE__; } 309 class EnumVisitor :
public RecursiveASTVisitor<EnumVisitor> {
311 llvm::SmallVector<EnumDecl*,128> &fClassEnums;
313 EnumVisitor(llvm::SmallVector<EnumDecl*,128> &enums) : fClassEnums(enums)
316 bool TraverseStmt(Stmt*) {
321 bool shouldVisitTemplateInstantiations()
const {
return true; }
323 bool TraverseClassTemplateDecl(ClassTemplateDecl*) {
328 bool TraverseClassTemplatePartialSpecializationDecl(ClassTemplatePartialSpecializationDecl*) {
333 bool VisitEnumDecl(EnumDecl *TEnumD) {
334 if (!TEnumD->getDeclContext()->isDependentContext())
335 fClassEnums.push_back(TEnumD);
346 static vector<const NamedDecl*> updateList;
349 if (entered) topLevel =
kFALSE;
364 updateList.push_back(TD);
367 while (!updateList.empty()) {
369 updateList.pop_back();
376 const clang::Decl* D =
static_cast<const clang::Decl*
>(enumObj->
GetDeclId());
377 if(
const clang::EnumDecl* ED = dyn_cast<clang::EnumDecl>(D)) {
379 for (EnumDecl::enumerator_iterator EDI = ED->enumerator_begin(),
380 EDE = ED->enumerator_end(); EDI != EDE; ++EDI) {
382 std::string constbuf;
383 if (
const NamedDecl* END = llvm::dyn_cast<NamedDecl>(*EDI)) {
384 PrintingPolicy Policy((*EDI)->getASTContext().getPrintingPolicy());
385 llvm::raw_string_ostream stream(constbuf);
386 (END)->getNameForDiagnostic(stream, Policy,
false);
388 const char* constantName = constbuf.c_str();
392 const llvm::APSInt valAPSInt = (*EDI)->getInitVal();
393 if (valAPSInt.isSigned()) {
394 value = valAPSInt.getSExtValue();
396 value = valAPSInt.getZExtValue();
403 DataMemberInfo_t* dmInfo = (DataMemberInfo_t*) tcDmInfo;
407 enumConstant =
new TEnumConstant(dmInfo, constantName, value, enumObj);
414 globals->
Add(enumConstant);
427 const clang::Decl* D =
static_cast<const clang::Decl*
>(VD);
429 if (
const EnumDecl* ED = llvm::dyn_cast<EnumDecl>(D)) {
431 PrintingPolicy Policy(ED->getASTContext().getPrintingPolicy());
432 llvm::raw_string_ostream stream(buf);
433 ED->getNameForDiagnostic(stream, Policy,
false);
439 const char*
name = buf.c_str();
441 enumType =
new TEnum(name, VD, cl);
443 enumType =
new TEnum(name, VD, cl);
445 UpdateEnumConstants(enumType, cl);
454 const clang::Decl* D =
static_cast<const clang::Decl*
>(DV);
456 if (!D->isCanonicalDecl() && !isa<clang::NamespaceDecl>(D)
457 && !dyn_cast<clang::RecordDecl>(D))
return;
459 if (isa<clang::FunctionDecl>(D->getDeclContext())
460 || isa<clang::TagDecl>(D->getDeclContext()))
464 if (
const clang::CXXRecordDecl* RD = dyn_cast<clang::CXXRecordDecl>(D)) {
465 if (RD->getDescribedClassTemplate())
467 }
else if (
const clang::FunctionDecl* FD = dyn_cast<clang::FunctionDecl>(D)) {
468 if (FD->getDescribedFunctionTemplate())
472 if (
const RecordDecl *TD = dyn_cast<RecordDecl>(D)) {
473 if (TD->isCanonicalDecl() || TD->isThisDeclarationADefinition())
476 else if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
478 if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
482 }
else if (
const NamespaceDecl* NSD = dyn_cast<NamespaceDecl>(D)) {
490 if (
const NamespaceDecl* NCtx = dyn_cast<NamespaceDecl>(ND->getDeclContext())) {
491 if (NCtx->getIdentifier()) {
494 std::string NCtxName;
495 PrintingPolicy Policy(NCtx->getASTContext().getPrintingPolicy());
496 llvm::raw_string_ostream stream(NCtxName);
497 NCtx->getNameForDiagnostic(stream, Policy,
true);
501 modifiedTClasses.insert(cl);
508 if (!isa<TranslationUnitDecl>(ND->getDeclContext()))
512 if (isa<EnumDecl>(ND))
517 if (!(isa<VarDecl>(ND)))
521 if (
gROOT->GetListOfGlobals()->FindObject(ND->getNameAsString().c_str()))
525 gROOT->GetListOfGlobals()->Add(
new TGlobal((DataMemberInfo_t *)
527 cast<ValueDecl>(ND), 0)));
554 const char* canonicalName) {
556 ((
TCling*)
gCling)->LibraryLoaded(dyLibHandle, canonicalName);
560 const char* canonicalName) {
562 ((
TCling*)
gCling)->LibraryUnloaded(dyLibHandle, canonicalName);
568 return ((
TCling*)
gCling)->GetObjectAddress(Name, LookupCtx);
577 cling::DynamicLibraryManager::ExposeHiddenSharedLibrarySymbols(interpLibHandle);
578 return new TCling(
"C++",
"cling C++ Interpreter");
600 return ((
TCling*)
gCling)->GetClassSharedLibs(className);
612 return ((
TCling*)
gCling)->IsAutoLoadNamespaceCandidate(nsDecl);
617 string file(fileName);
623 string &args,
string &io,
string &fname)
625 string file(fileName);
626 TString f, amode, arguments, aclicio;
628 mode = amode.
Data(); args = arguments.Data();
629 io = aclicio.
Data(); fname = f.
Data();
639 char *__unDName(
char *demangled,
const char *mangled,
int out_len,
640 void * (* pAlloc )(
size_t),
void (* pFree )(
void *),
641 unsigned short int flags);
653 using namespace clang;
654 if (NamespaceDecl* nsd = llvm::dyn_cast<NamespaceDecl>(decl)){
658 if (ClassTemplateDecl* ctd = llvm::dyn_cast<ClassTemplateDecl>(decl)){
670 return ((
TCling*)
gCling)->LazyFunctionCreatorAutoload(mangled_name);
679 const std::vector<std::string> &headers,
680 const std::vector<std::string> &fwdDecls,
681 const std::vector<std::string> &unknown)
687 if (classes.empty()) {
691 const std::string& className = classes[0];
693 TString fileName =
"AutoDict_";
694 std::string::const_iterator sIt;
695 for (sIt = className.begin(); sIt != className.end(); sIt++) {
696 if (*sIt ==
'<' || *sIt ==
'>' ||
697 *sIt ==
' ' || *sIt ==
'*' ||
698 *sIt ==
',' || *sIt ==
'&' ||
706 if (classes.size() > 1) {
708 std::vector<std::string>::const_iterator it = classes.begin();
709 while ((++it) != classes.end()) {
710 for (
UInt_t cursor = 0; cursor != it->length(); ++cursor) {
711 chk = chk * 3 + it->at(cursor);
724 static const std::set<std::string> sSTLTypes {
"vector",
"list",
"unordered_list",
"deque",
"map",
"multimap",
"set",
"unordered_set",
"multiset",
"queue",
"priority_queue",
"stack",
"iterator"};
725 std::vector<std::string>::const_iterator it;
726 std::string fileContent(
"");
727 for (it = headers.begin(); it != headers.end(); ++it) {
728 fileContent +=
"#include \"" + *it +
"\"\n";
730 for (it = unknown.begin(); it != unknown.end(); ++it) {
736 while (dirbase.Length() && dirbase !=
"." 737 && dirbase !=
"include" && dirbase !=
"inc" 738 && dirbase !=
"prec_stl") {
742 fileContent +=
TString(
"#include \"") + header +
"\"\n";
745 for (it = fwdDecls.begin(); it != fwdDecls.end(); ++it) {
746 fileContent +=
"class " + *it +
";\n";
748 fileContent +=
"#ifdef __CINT__ \n";
749 fileContent +=
"#pragma link C++ nestedclasses;\n";
750 fileContent +=
"#pragma link C++ nestedtypedefs;\n";
751 for (it = classes.begin(); it != classes.end(); ++it) {
753 size_t posTemplate = n.find(
'<');
754 std::set<std::string>::const_iterator iSTLType = sSTLTypes.end();
755 if (posTemplate != std::string::npos) {
756 n.erase(posTemplate, std::string::npos);
757 if (n.compare(0, 5,
"std::") == 0) {
760 iSTLType = sSTLTypes.find(n);
762 fileContent +=
"#pragma link C++ class ";
763 fileContent += *it +
"+;\n" ;
764 fileContent +=
"#pragma link C++ class ";
765 if (iSTLType != sSTLTypes.end()) {
769 fileContent += *it +
"::*;\n" ;
774 fileContent += *it +
"::*+;\n" ;
776 std::string oprLink(
"#pragma link C++ operators ");
780 if (iSTLType != sSTLTypes.end()) {
782 fileContent +=
"#ifdef G__VECTOR_HAS_CLASS_ITERATOR\n";
784 fileContent += oprLink +
"::iterator;\n";
785 fileContent += oprLink +
"::const_iterator;\n";
786 fileContent += oprLink +
"::reverse_iterator;\n";
788 fileContent +=
"#endif\n";
792 fileContent +=
"#endif\n";
796 filePointer = fopen(fileName,
"w");
797 if (filePointer ==
NULL) {
803 fprintf(filePointer,
"%s", fileContent.c_str());
819 const std::vector<std::string> &headers,
820 const std::vector<std::string> &fwdDecls,
821 const std::vector<std::string> &unknown)
827 std::vector<std::string> classes;
828 classes.push_back(className);
856 void exceptionErrorHandler(
void * ,
857 const std::string& reason,
859 throw std::runtime_error(std::string(
">>> Interpreter compilation error:\n") + reason);
873 class clangDiagSuppr {
875 clangDiagSuppr(clang::DiagnosticsEngine& diag): fDiagEngine(diag){
876 fOldDiagValue = fDiagEngine.getIgnoreAllWarnings();
877 fDiagEngine.setIgnoreAllWarnings(
true);
881 fDiagEngine.setIgnoreAllWarnings(fOldDiagValue);
884 clang::DiagnosticsEngine& fDiagEngine;
906 unsigned long offset = 0;
907 if (strncmp(tname.c_str(),
"const ", 6) == 0) {
910 unsigned long end = tname.length();
911 while( end && (tname[end-1]==
'&' || tname[end-1]==
'*' || tname[end-1]==
']') ) {
912 if ( tname[end-1]==
']' ) {
914 while ( end && tname[end-1]!=
'[' ) --end;
918 std::string innerbuf;
920 if (end != tname.length()) {
921 innerbuf = tname.substr(offset,end-offset);
922 inner = innerbuf.c_str();
924 inner = tname.c_str()+offset;
928 if (
gROOT->GetListOfClasses()->FindObject(inner)
940 newname =
"Long64_t";
942 newname =
"ULong64_t";
944 if (strcmp(inner,newname) == 0) {
947 if (offset) result =
"const ";
949 if ( end != tname.length() ) {
950 result += tname.substr(end,tname.length()-end);
952 if (result == tname) result.clear();
958 if (lastPos != inner)
962 const auto enName = lastPos;
963 const auto scopeNameSize = ((
Long64_t)lastPos - (
Long64_t)inner) /
sizeof(decltype(*lastPos)) - 2;
965 char *scopeName =
new char[scopeNameSize + 1];
967 char scopeName[scopeNameSize + 1];
969 strncpy(scopeName, inner, scopeNameSize);
970 scopeName[scopeNameSize] =
'\0';
972 if (
auto scope = static_cast<TClass *>(
gROOT->GetListOfClasses()->FindObject(scopeName))) {
973 auto enumTable =
dynamic_cast<const THashList *
>(scope->GetListOfEnums(
false));
974 if (enumTable && enumTable->THashList::FindObject(enName))
return true;
978 auto listOfEnums = scope->GetListOfEnums();
980 auto enumTable =
dynamic_cast<const THashList *
>(listOfEnums);
981 if (enumTable && enumTable->THashList::FindObject(enName))
return true;
990 auto enumTable =
dynamic_cast<const THashList *
>(
gROOT->GetListOfEnums());
991 if (enumTable && enumTable->THashList::FindObject(inner))
return true;
1007 fContent.reserve(size);
1014 return fContent.c_str();
1022 bool notPresent = fLinesHashSet.emplace(fHashFunc(str)).second;
1033 :
TInterpreter(name, title), fGlobalsListSerial(-1), fInterpreter(0),
1034 fMetaProcessor(0), fNormalizedCtxt(0), fPrevLoadedDynLibInfo(0),
1035 fClingCallbacks(0), fAutoLoadCallBack(0),
1036 fTransactionCount(0), fHeaderParsingOnDemand(true), fIsAutoParsingSuspended(
kFALSE)
1039 bool fromRootCling = dlsym(RTLD_DEFAULT,
"usedToIdentifyRootClingByDlSym");
1041 llvm::install_fatal_error_handler(&exceptionErrorHandler);
1045 std::vector<std::string> clingArgsStorage;
1046 clingArgsStorage.push_back(
"cling4root");
1048 std::string interpInclude;
1050 if (!fromRootCling) {
1054 clingArgsStorage.push_back(
"-I" + interpInclude);
1056 std::string pchFilename = interpInclude +
"/allDict.cxx.pch";
1060 clingArgsStorage.push_back(
"-include-pch");
1061 clingArgsStorage.push_back(pchFilename);
1066 std::string include;
1068 clingArgsStorage.push_back(
"-I" + include);
1069 clingArgsStorage.push_back(
"-Wno-undefined-inline");
1070 clingArgsStorage.push_back(
"-fsigned-char");
1073 std::vector<const char*> interpArgs;
1074 for (std::vector<std::string>::const_iterator iArg = clingArgsStorage.begin(),
1075 eArg = clingArgsStorage.end(); iArg != eArg; ++iArg)
1076 interpArgs.push_back(iArg->c_str());
1078 #ifdef R__EXTERN_LLVMDIR 1079 TString llvmResourceDir = R__EXTERN_LLVMDIR;
1085 extraArgs && *extraArgs; ++extraArgs) {
1086 if (!strcmp(*extraArgs,
"-resource-dir")) {
1088 llvmResourceDir = *(++extraArgs);
1090 interpArgs.push_back(*extraArgs);
1094 fInterpreter =
new cling::Interpreter(interpArgs.size(),
1098 if (!fromRootCling) {
1115 fInterpreter->getCI()->getPreprocessorOpts().DisablePCHValidation =
true;
1119 fInterpreter->getCI()->getLangOpts().SpellChecking =
false;
1125 static llvm::raw_fd_ostream fMPOuts (STDOUT_FILENO,
false);
1131 if (fromRootCling) {
1133 "#include <string>\n" 1134 "using std::string;");
1137 + gClassDefInterpMacro +
"\n" 1138 + gInterpreterClassDef +
"\n" 1139 +
"#undef ClassImp\n" 1140 "#define ClassImp(X)\n" 1141 "#include <string>\n" 1142 "using namespace std;");
1170 std::unique_ptr<TClingCallbacks>
1176 if (!fromRootCling) {
1196 #if defined(R__MUST_REVISIT) 1197 #if R__MUST_REVISIT(6,2) 1198 Warning(
"~TCling",
"Interface not available yet.");
1199 #ifdef R__COMPLETE_MEM_TERMINATION 1220 #if defined(__CYGWIN__) && defined(__GNUC__) 1222 #elif defined(G__WIN32) 1223 MEMORY_BASIC_INFORMATION mbi;
1224 if (!VirtualQuery (
func, &mbi,
sizeof (mbi)))
1229 HMODULE hMod = (HMODULE) mbi.AllocationBase;
1230 TTHREAD_TLS_ARRAY(
char, MAX_PATH, moduleName);
1232 if (!GetModuleFileNameA (hMod, moduleName,
sizeof (moduleName)))
1239 if (dladdr((
void*)
func,&info)==0) {
1244 return info.dli_fname;
1256 auto setFactory = []() {
1260 static bool doneFactory = setFactory();
1269 const char** headers,
1270 void (*triggerFunc)())
const {
1278 searchPath = llvm::sys::path::parent_path(libraryName);
1298 if (
gROOT->IsRootFile(pcmFileName)) {
1302 ::Info(
"TCling::LoadPCM",
"Loading ROOT PCM %s", pcmFileName.
Data());
1309 TFile *pcmFile =
new TFile(pcmFileName+
"?filetype=pcm",
"READ");
1317 (listOfKeys->GetSize() == 0) ||
1319 (listOfKeys->GetSize() == 1) &&
1320 !strcmp(((
TKey*)listOfKeys->At(0))->
GetName(),
"EMPTY")
1331 ::Info(
"TCling::LoadPCM",
"reading protoclasses for %s \n",pcmFileName.
Data());
1333 pcmFile->
GetObject(
"__ProtoClasses", protoClasses);
1336 for (
auto obj : *protoClasses) {
1346 for (
auto proto : *protoClasses) {
1348 = (
TClass*)
gROOT->GetListOfClasses()->FindObject(proto->GetName())) {
1355 ::Error(
"TCling::LoadPCM",
"Inconsistent TClassTable for %s",
1367 protoClasses->Clear();
1368 delete protoClasses;
1372 pcmFile->
GetObject(
"__Typedefs", dataTypes);
1374 for (
auto typedf: *dataTypes)
1375 gROOT->GetListOfTypes()->Add(typedf);
1384 auto listOfGlobals =
gROOT->GetListOfGlobals();
1385 auto listOfEnums =
dynamic_cast<THashList*
>(
gROOT->GetListOfEnums());
1387 for (
auto selEnum: *enums){
1388 const char* enumScope = selEnum->
GetTitle();
1389 const char* enumName = selEnum->GetName();
1390 if (strcmp(enumScope,
"") == 0){
1393 if (!listOfEnums->THashList::FindObject(enumName)){
1394 ((
TEnum*) selEnum)->SetClass(
nullptr);
1395 listOfEnums->Add(selEnum);
1397 for (
auto enumConstant: *static_cast<TEnum*>(selEnum)->GetConstants()){
1398 if (!listOfGlobals->FindObject(enumConstant)){
1399 listOfGlobals->Add(enumConstant);
1407 if (!nsTClassEntry){
1410 auto listOfEnums = nsTClassEntry->
fEnums.load();
1421 if (listOfEnums && !listOfEnums->THashList::FindObject(enumName)){
1422 ((
TEnum*) selEnum)->SetClass(nsTClassEntry);
1423 listOfEnums->Add(selEnum);
1436 ::Info(
"TCling::LoadPCM",
"Loading clang PCM %s", pcmFileName.
Data());
1450 using namespace clang;
1452 class ExtLexicalStorageAdder:
public RecursiveASTVisitor<ExtLexicalStorageAdder>{
1457 bool VisitRecordDecl(clang::RecordDecl* rcd){
1459 Info(
"ExtLexicalStorageAdder",
1460 "Adding external lexical storage to class %s",
1461 rcd->getNameAsString().c_str());
1462 auto reDeclPtr = rcd->getMostRecentDecl();
1464 reDeclPtr->setHasExternalLexicalStorage();
1465 }
while ((reDeclPtr = reDeclPtr->getPreviousDecl()));
1485 const char** headers,
1486 const char** includePaths,
1487 const char* payloadCode,
1488 const char* fwdDeclsCode,
1489 void (*triggerFunc)(),
1491 const char** classesHeaders)
1494 static const bool fromRootCling = dlsym(RTLD_DEFAULT,
"usedToIdentifyRootClingByDlSym");
1498 if (fromRootCling)
return;
1502 bool isACLiC =
false;
1503 if (hasHeaderParsingOnDemand &&
1504 strstr(modulename,
"_ACLiC_dict") !=
nullptr){
1506 Info(
"TCling::RegisterModule",
1507 "Header parsing on demand is active but this is an Aclic library. Disabling it for this library.");
1508 hasHeaderParsingOnDemand =
false;
1525 for (
const char** inclPath = includePaths; *inclPath; ++inclPath) {
1528 cling::Transaction* T = 0;
1530 for (
auto& fwdDeclArgToSkipPair : fwdDeclsArgToSkip){
1531 const std::string& fwdDecl = fwdDeclArgToSkipPair.first;
1532 const int nArgsToSkip = fwdDeclArgToSkipPair.second;
1534 assert(cling::Interpreter::kSuccess == compRes &&
1535 "A fwd declaration could not be compiled");
1536 if (compRes!=cling::Interpreter::kSuccess){
1537 Warning(
"TCling::RegisterModule",
1538 "Problems in declaring string '%s' were encountered.",
1553 TString code = gNonInterpreterClassDef;
1554 code += payloadCode;
1563 void* dyLibHandle = dlopen(dyLibName, RTLD_LAZY | RTLD_GLOBAL);
1566 char dyLibError[1000];
1567 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(),
1568 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), dyLibError,
1569 sizeof(dyLibError),
NULL);
1572 const char* dyLibError = dlerror();
1576 ::Info(
"TCling::RegisterModule",
1577 "Cannot open shared library %s for dictionary %s:\n %s",
1578 dyLibName, modulename, dyLibError);
1587 if (hasHeaderParsingOnDemand && fwdDeclsCode){
1590 std::string fwdDeclsCodeLessEnums;
1594 std::string fwdDeclsLine;
1595 std::istringstream fwdDeclsCodeStr(fwdDeclsCode);
1596 std::vector<std::string> scope;
1597 while (std::getline(fwdDeclsCodeStr, fwdDeclsLine)) {
1598 if (fwdDeclsLine.find(
"namespace ") == 0
1599 || fwdDeclsLine.find(
"inline namespace ") == 0) {
1601 scope.push_back(fwdDeclsLine.substr(10,
1602 fwdDeclsLine.length() - 10 - 2));
1603 }
else if (fwdDeclsLine ==
"}") {
1605 }
else if (fwdDeclsLine.find(
"enum __attribute__((annotate(\"") == 0) {
1606 clang::DeclContext* DC = 0;
1607 for (
auto &&aScope: scope) {
1614 if (scope.empty() || DC) {
1616 size_t posEnumName = fwdDeclsLine.find(
"\"))) ", 32);
1617 R__ASSERT(posEnumName != std::string::npos &&
"Inconsistent enum fwd decl!");
1619 while (isspace(fwdDeclsLine[posEnumName]))
1621 size_t posEnumNameEnd = fwdDeclsLine.find(
" : ", posEnumName);
1622 R__ASSERT(posEnumNameEnd != std::string::npos &&
"Inconsistent enum fwd decl (end)!");
1623 while (isspace(fwdDeclsLine[posEnumNameEnd]))
1627 std::string enumName = fwdDeclsLine.substr(posEnumName,
1628 posEnumNameEnd - posEnumName + 1);
1630 if (clang::NamedDecl* enumDecl
1631 = cling::utils::Lookup::Named(&
fInterpreter->getSema(),
1632 enumName.c_str(), DC)) {
1635 R__ASSERT(llvm::dyn_cast<clang::EnumDecl>(enumDecl) &&
"not an enum decl!");
1641 fwdDeclsCodeLessEnums += fwdDeclsLine +
"\n";
1645 if (fwdDeclsCodeLessEnums.size() != 0){
1646 auto compRes =
fInterpreter->declare(fwdDeclsCodeLessEnums, &T);
1647 assert(cling::Interpreter::kSuccess == compRes &&
1648 "The forward declarations could not be compiled");
1649 if (compRes!=cling::Interpreter::kSuccess){
1650 Warning(
"TCling::RegisterModule",
1651 "Problems in compiling forward declarations for module %s: '%s'",
1652 modulename, fwdDeclsCodeLessEnums.c_str()) ;
1660 ExtLexicalStorageAdder elsa;
1661 for (
auto dciIt = T->decls_begin();dciIt!=T->decls_end();dciIt++){
1662 cling::Transaction::DelayCallInfo& dci = *dciIt;
1663 for(
auto dit = dci.m_DGR.begin(); dit != dci.m_DGR.end(); ++dit) {
1664 clang::Decl* declPtr = *dit;
1665 elsa.TraverseDecl(declPtr);
1679 for (
const char** classesHeader = classesHeaders; *classesHeader; ++classesHeader) {
1680 temp=*classesHeader;
1682 size_t theTemplateHash = 0;
1683 bool addTemplate =
false;
1684 size_t posTemplate = temp.find(
'<');
1685 if (posTemplate != std::string::npos) {
1687 std::string templateName = temp.substr(0, posTemplate);
1693 for (
const char** classesHeader_inner = classesHeader; 0!=strcmp(*classesHeader_inner,
"@"); ++classesHeader_inner,++classesHeader){
1695 if (payloadCode == *classesHeader_inner ){
1697 if (addTemplate)
fPayloads.insert(theTemplateHash);
1700 Info(
"TCling::RegisterModule",
1701 "Adding a header for %s", temp.c_str());
1707 addTemplate =
false;
1714 if (strcmp(modulename,
"libCore")!=0 && strcmp(modulename,
"libRint")!=0
1715 && strcmp(modulename,
"libThread")!=0 && strcmp(modulename,
"libRIO")!=0
1716 && strcmp(modulename,
"libcomplexDict")!=0 && strcmp(modulename,
"libdequeDict")!=0
1717 && strcmp(modulename,
"liblistDict")!=0 && strcmp(modulename,
"libforward_listDict")!=0
1718 && strcmp(modulename,
"libvectorDict")!=0
1719 && strcmp(modulename,
"libmapDict")!=0 && strcmp(modulename,
"libmultimap2Dict")!=0
1720 && strcmp(modulename,
"libmap2Dict")!=0 && strcmp(modulename,
"libmultimapDict")!=0
1721 && strcmp(modulename,
"libsetDict")!=0 && strcmp(modulename,
"libmultisetDict")!=0
1722 && strcmp(modulename,
"libunordered_setDict")!=0 && strcmp(modulename,
"libunordered_multisetDict")!=0
1723 && strcmp(modulename,
"libunordered_mapDict")!=0 && strcmp(modulename,
"libunordered_multimapDict")!=0
1724 && strcmp(modulename,
"libvalarrayDict")!=0
1725 && strcmp(modulename,
"G__GenVector32")!=0 && strcmp(modulename,
"G__Smatrix32")!=0
1729 if (!
LoadPCM(pcmFileName, headers, triggerFunc)) {
1730 ::Error(
"TCling::RegisterModule",
"cannot find dictionary module %s",
1735 bool oldValue =
false;
1743 clangDiagSuppr diagSuppr(
fInterpreter->getSema().getDiagnostics());
1745 #if defined(R__MUST_REVISIT) 1746 #if R__MUST_REVISIT(6,2) 1747 Warning(
"TCling::RegisterModule",
"Diagnostics suppression should be gone by now.");
1751 if (!hasHeaderParsingOnDemand){
1752 const cling::Transaction* watermark =
fInterpreter->getLastTransaction();
1753 cling::Interpreter::CompilationResult compRes =
fInterpreter->parseForModule(code.
Data());
1759 assert(cling::Interpreter::kSuccess == compRes &&
1760 "Payload code of a dictionary could not be parsed correctly.");
1761 if (compRes!=cling::Interpreter::kSuccess) {
1762 Warning(
"TCling::RegisterModule",
1763 "Problems declaring payload for module %s.", modulename) ;
1772 if (!hasHeaderParsingOnDemand) {
1799 if (!hasHeaderParsingOnDemand) {
1802 "#undef __ROOTCLING__\n" 1803 + gInterpreterClassDef +
1810 dlclose(dyLibHandle);
1832 typedef std::vector<std::pair<TClass*,DictFuncPtr_t> >::iterator iterator;
1838 if ( i->first == oldcl ) {
1861 if (strstr(line,fantomline)) {
1876 gROOT->SetLineIsProcessing();
1880 gROOT->SetLineHasBeenProcessed();
1893 gROOT->SetLineIsProcessing();
1895 struct InterpreterFlagsRAII_t {
1897 bool fWasDynamicLookupEnabled;
1899 InterpreterFlagsRAII_t(cling::Interpreter* interp):
1901 fWasDynamicLookupEnabled(interp->isDynamicLookupEnabled())
1903 fInterpreter->enableDynamicLookup(
true);
1905 ~InterpreterFlagsRAII_t() {
1906 fInterpreter->enableDynamicLookup(fWasDynamicLookupEnabled);
1915 cling::Interpreter::CompilationResult compRes = cling::Interpreter::kSuccess;
1916 if (!strncmp(sLine.
Data(),
".L", 2) || !strncmp(sLine.
Data(),
".x", 2) ||
1917 !strncmp(sLine.
Data(),
".X", 2)) {
1925 aclicMode, arguments, io);
1926 if (aclicMode.
Length()) {
1928 R__ASSERT(aclicMode[0]==
'+' &&
"ACLiC mode must start with a +");
1930 if (aclicMode[1]==
'+') {
1936 compRes = cling::Interpreter::kFailure;
1938 if (strncmp(sLine.
Data(),
".L", 2) != 0) {
1941 if (arguments.Length()==0) {
1950 mod_line =
function + arguments + io;
1951 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
1957 bool unnamedMacro =
false;
1960 std::ifstream in(fname);
1961 static const char whitespace[] =
" \t\r\n";
1963 std::getline(in, line);
1964 std::string::size_type posNonWS = line.find_first_not_of(whitespace);
1965 if (posNonWS == std::string::npos)
continue;
1966 if (line[posNonWS] ==
'/' && line[posNonWS + 1] ==
'/')
1969 unnamedMacro = (line[posNonWS] ==
'{');
1975 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
1988 if (0!=strncmp(sLine.
Data(),
".autodict ",10) && sLine !=
".autodict") {
1991 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
1994 bool isInclusionDirective = sLine.
Contains(
"\n#include") || sLine.
BeginsWith(
"#include");
1995 if (isInclusionDirective) {
2003 if (result.isValid())
2012 case cling::Interpreter::kSuccess: *error =
kNoError;
break;
2013 case cling::Interpreter::kFailure: *error =
kRecoverable;
break;
2014 case cling::Interpreter::kMoreInputExpected: *error =
kProcessing;
break;
2017 if (compRes == cling::Interpreter::kSuccess
2019 && !result.isVoid())
2021 gROOT->SetLineHasBeenProcessed();
2022 return result.simplisticCastAs<
long>();
2024 gROOT->SetLineHasBeenProcessed();
2064 static const TClassRef clRefString(
"std::string");
2065 if (clRefString == cl) {
2070 const char* cobj = (
const char*) obj;
2077 auto inspInspect = [&] (ptrdiff_t offset){
2078 insp.
Inspect(const_cast<TClass*>(cl), insp.
GetParent(),
"_real", cobj, isTransient);
2079 insp.
Inspect(const_cast<TClass*>(cl), insp.
GetParent(),
"_imag", cobj + offset, isTransient);
2083 switch(complexType) {
2090 inspInspect(
sizeof(
float));
2095 inspInspect(
sizeof(
double));
2100 inspInspect(
sizeof(
int));
2105 inspInspect(
sizeof(
long));
2110 static clang::PrintingPolicy
2112 if (printPol.Indentation) {
2114 printPol.Indentation = 0;
2115 printPol.SuppressInitializers =
true;
2118 const char* clname = cl->
GetName();
2121 const clang::ASTContext& astContext =
fInterpreter->getCI()->getASTContext();
2122 const clang::Decl *scopeDecl = 0;
2127 scopeDecl = clingCI->
GetDecl();
2128 recordType = clingCI->
GetType();
2130 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
2132 scopeDecl = lh.findScope(clname, cling::LookupHelper::NoDiagnostics,
2136 Error(
"InspectMembers",
"Cannot find Decl for class %s", clname);
2139 const clang::CXXRecordDecl* recordDecl
2140 = llvm::dyn_cast<
const clang::CXXRecordDecl>(scopeDecl);
2142 Error(
"InspectMembers",
"Cannot find Decl for class %s is not a CXXRecordDecl.", clname);
2149 cling::Interpreter::PushTransactionRAII deserRAII(
fInterpreter);
2151 astContext.getASTRecordLayout(recordDecl);
2153 for (clang::RecordDecl::field_iterator iField = recordDecl->field_begin(),
2154 eField = recordDecl->field_end(); iField != eField; ++iField) {}
2157 const clang::ASTRecordLayout& recLayout
2158 = astContext.getASTRecordLayout(recordDecl);
2165 if (cl->
Size() != recLayout.getSize().getQuantity()) {
2166 Error(
"InspectMembers",
"TClass and cling disagree on the size of the class %s, respectively %d %lld\n",
2170 unsigned iNField = 0;
2173 for (clang::RecordDecl::field_iterator iField = recordDecl->field_begin(),
2174 eField = recordDecl->field_end(); iField != eField;
2175 ++iField, ++iNField) {
2178 clang::QualType memberQT = iField->getType();
2183 memberQT = cling::utils::Transform::GetPartiallyDesugaredType(astContext, memberQT,
fNormalizedCtxt->
GetConfig(),
false );
2184 if (memberQT.isNull()) {
2185 std::string memberName;
2186 llvm::raw_string_ostream stream(memberName);
2187 iField->getNameForDiagnostic(stream, printPol,
true );
2189 Error(
"InspectMembers",
2190 "Cannot retrieve QualType for member %s while inspecting class %s",
2191 memberName.c_str(), clname);
2194 const clang::Type* memType = memberQT.getTypePtr();
2196 std::string memberName;
2197 llvm::raw_string_ostream stream(memberName);
2198 iField->getNameForDiagnostic(stream, printPol,
true );
2200 Error(
"InspectMembers",
2201 "Cannot retrieve Type for member %s while inspecting class %s",
2202 memberName.c_str(), clname);
2207 Bool_t ispointer =
false;
2208 if (memNonPtrType->isPointerType()) {
2210 clang::QualType ptrQT
2211 = memNonPtrType->getAs<clang::PointerType>()->getPointeeType();
2216 ptrQT = cling::utils::Transform::GetPartiallyDesugaredType(astContext, ptrQT,
fNormalizedCtxt->
GetConfig(),
false );
2217 if (ptrQT.isNull()) {
2218 std::string memberName;
2219 llvm::raw_string_ostream stream(memberName);
2220 iField->getNameForDiagnostic(stream, printPol,
true );
2222 Error(
"InspectMembers",
2223 "Cannot retrieve pointee Type for member %s while inspecting class %s",
2224 memberName.c_str(), clname);
2227 memNonPtrType = ptrQT.getTypePtr();
2231 llvm::SmallString<8> arraySize;
2232 const clang::ArrayType* arrType = memNonPtrType->getAsArrayTypeUnsafe();
2233 unsigned arrLevel = 0;
2234 bool haveErrorDueToArray =
false;
2238 const clang::ConstantArrayType* constArrType =
2239 clang::dyn_cast<clang::ConstantArrayType>(arrType);
2241 constArrType->getSize().toStringUnsigned(arraySize);
2244 clang::QualType subArrQT = arrType->getElementType();
2245 if (subArrQT.isNull()) {
2246 std::string memberName;
2247 llvm::raw_string_ostream stream(memberName);
2248 iField->getNameForDiagnostic(stream, printPol,
true );
2250 Error(
"InspectMembers",
2251 "Cannot retrieve QualType for array level %d (i.e. element type of %s) for member %s while inspecting class %s",
2252 arrLevel, subArrQT.getAsString(printPol).c_str(),
2253 memberName.c_str(), clname);
2254 haveErrorDueToArray =
true;
2257 arrType = subArrQT.getTypePtr()->getAsArrayTypeUnsafe();
2259 if (haveErrorDueToArray) {
2264 std::string fieldName;
2265 if (memType->isPointerType()) {
2270 std::string
ioname(iField->getName());
2273 fieldName += arraySize;
2278 clang::CharUnits offset(astContext.toCharUnitsFromBits(recLayout.getFieldOffset(iNField)));
2279 ptrdiff_t fieldOffset = offset.getQuantity();
2289 auto iFiledQtype = iField->getType();
2290 if (
auto tagDecl = iFiledQtype->getAsTagDecl()){
2291 auto declAccess = tagDecl->getAccess();
2292 if (declAccess == AS_private || declAccess == AS_protected) {
2298 insp.
Inspect(const_cast<TClass*>(cl), insp.
GetParent(), fieldName.c_str(), cobj + fieldOffset, isTransient);
2301 const clang::CXXRecordDecl* fieldRecDecl = memNonPtrType->getAsCXXRecordDecl();
2305 std::string sFieldRecName;
2306 if (!ROOT::TMetaUtils::ExtractAttrPropertyFromName(*fieldRecDecl,
"iotype",sFieldRecName)){
2308 clang::QualType(memNonPtrType,0),
2318 insp.
InspectMember(sFieldRecName.c_str(), cobj + fieldOffset,
2319 (fieldName +
'.').c_str(),
transient);
2327 unsigned iNBase = 0;
2328 for (clang::CXXRecordDecl::base_class_const_iterator iBase
2329 = recordDecl->bases_begin(), eBase = recordDecl->bases_end();
2330 iBase != eBase; ++iBase, ++iNBase) {
2331 clang::QualType baseQT = iBase->getType();
2332 if (baseQT.isNull()) {
2333 Error(
"InspectMembers",
2334 "Cannot find QualType for base number %d while inspecting class %s",
2338 const clang::CXXRecordDecl* baseDecl
2339 = baseQT->getAsCXXRecordDecl();
2341 Error(
"InspectMembers",
2342 "Cannot find CXXRecordDecl for base number %d while inspecting class %s",
2347 std::string sBaseName;
2349 std::vector<TClass*> foundClasses;
2351 if (foundClasses.size()==1){
2352 baseCl=foundClasses[0];
2365 std::string qualNameForDiag;
2367 Error(
"InspectMembers",
2368 "Cannot find TClass for base class %s", qualNameForDiag.c_str() );
2373 if (iBase->isVirtual()) {
2376 Error(
"InspectMembers",
2377 "Base %s of class %s is virtual but no object provided",
2378 sBaseName.c_str(), clname);
2386 baseOffset = ci->
GetBaseOffset(baseCi, const_cast<void*>(obj),
2388 if (baseOffset == -1) {
2389 Error(
"InspectMembers",
2390 "Error calculating offset of virtual base %s of class %s",
2391 sBaseName.c_str(), clname);
2394 Error(
"InspectMembers",
2395 "Cannot calculate offset of virtual base %s of class %s",
2396 sBaseName.c_str(), clname);
2401 baseOffset = recLayout.getBaseClassOffset(baseDecl).getQuantity();
2448 bool oldDynLookup =
fInterpreter->isDynamicLookupEnabled();
2500 size_t at = std::string::npos;
2501 while ((at = file_name.find(
"/./")) != std::string::npos)
2502 file_name.replace(at, 3,
"/");
2504 std::string filesStr =
"";
2505 llvm::raw_string_ostream filesOS(filesStr);
2506 clang::SourceManager &SM =
fInterpreter->getCI()->getSourceManager();
2507 cling::ClangInternalState::printIncludedFiles(filesOS, SM);
2510 llvm::SmallVector<llvm::StringRef, 100> files;
2511 llvm::StringRef(filesStr).split(files,
"\n");
2513 std::set<std::string> fileMap;
2515 for (llvm::SmallVector<llvm::StringRef, 100>::const_iterator
2516 iF = files.begin(), iE = files.end(); iF != iE; ++iF) {
2517 if ((*iF) == file_name.c_str())
return kTRUE;
2518 fileMap.insert(*iF);
2521 if (fileMap.empty())
return kFALSE;
2524 TString sFilename(file_name.c_str());
2526 && fileMap.count(sFilename.Data())) {
2534 while (incPath.
Index(
" :") != -1) {
2538 sFilename = file_name.c_str();
2540 && fileMap.count(sFilename.Data())) {
2545 sFilename = file_name.c_str();
2547 cling::DynamicLibraryManager* dyLibManager
2550 if (dyLibManager->isLibraryLoaded(found)) {
2555 const clang::DirectoryLookup *CurDir = 0;
2556 clang::Preprocessor &PP =
fInterpreter->getCI()->getPreprocessor();
2557 clang::HeaderSearch &HS = PP.getHeaderSearchInfo();
2558 const clang::FileEntry *FE = HS.LookupFile(file_name.c_str(),
2559 clang::SourceLocation(),
2562 clang::ArrayRef<std::pair<
const clang::FileEntry *,
2563 const clang::DirectoryEntry *>>(),
2570 if (FE && FE->isValid()) {
2572 clang::SourceManager &SM =
fInterpreter->getCI()->getSourceManager();
2574 clang::FileID FID = SM.translateFile(FE);
2575 if (!FID.isInvalid() && FID.getHashValue() == 0)
2578 clang::SrcMgr::SLocEntry SLocE = SM.getSLocEntry(FID);
2579 if (SLocE.isFile() && SLocE.getFile().getContentCache()->getRawBuffer() == 0)
2581 if (!FID.isInvalid())
2585 sFilename = FE->getName();
2587 && fileMap.count(sFilename.Data())) {
2598 #if defined(R__WIN32) || defined(__CYGWIN__) 2599 HMODULE hModules[1024];
2601 unsigned long cbModules;
2603 hProcess = (
void *)::GetCurrentProcess();
2604 ::EnumProcessModules(hProcess, hModules,
sizeof(hModules), &cbModules);
2606 for (i = 1; i < (cbModules /
sizeof(
void *)); i++) {
2607 static const int bufsize = 260;
2608 wchar_t winname[bufsize];
2609 char posixname[bufsize];
2610 ::GetModuleFileNameExW(hProcess, hModules[i], winname, bufsize);
2611 #if defined(__CYGWIN__) 2612 cygwin_conv_path(CCP_WIN_W_TO_POSIX, winname, posixname, bufsize);
2614 std::wstring wpath = winname;
2615 std::replace(wpath.begin(), wpath.end(),
'\\',
'/');
2616 string path(wpath.begin(), wpath.end());
2617 strncpy(posixname, path.c_str(), bufsize);
2623 #elif defined(R__MACOSX) 2626 const char* imageName = 0;
2627 while ((imageName = _dyld_get_image_name(imageIndex))) {
2634 #elif defined(R__LINUX) 2635 struct PointerNo4_t {
2647 PointerNo4_t* procLinkMap = (PointerNo4_t*)dlopen(0, RTLD_LAZY | RTLD_GLOBAL);
2650 LinkMap_t* linkMap = (LinkMap_t*) ((PointerNo4_t*)procLinkMap->fPtr)->fPtr;
2656 while (iDyLib->fNext) {
2657 iDyLib = iDyLib->fNext;
2662 Error(
"TCling::UpdateListOfLoadedSharedLibraries",
2663 "Platform not supported!");
2674 if (!filename)
return;
2678 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
2679 if (!DLM->isLibraryLoaded(filename)) {
2680 DLM->loadLibrary(filename,
true );
2683 #if defined(R__MACOSX) 2685 if (!strncmp(filename,
"/usr/lib/system/", 16)
2686 || !strncmp(filename,
"/usr/lib/libc++", 15)
2687 || !strncmp(filename,
"/System/Library/Frameworks/", 27)
2688 || !strncmp(filename,
"/System/Library/PrivateFrameworks/", 34)
2689 || !strncmp(filename,
"/System/Library/CoreServices/", 29)
2690 || !strcmp(filename,
"cl_kernels")
2691 || strstr(filename,
"/usr/lib/libSystem")
2692 || strstr(filename,
"/usr/lib/libstdc++")
2693 || strstr(filename,
"/usr/lib/libicucore")
2694 || strstr(filename,
"/usr/lib/libbsm")
2695 || strstr(filename,
"/usr/lib/libobjc")
2696 || strstr(filename,
"/usr/lib/libresolv")
2697 || strstr(filename,
"/usr/lib/libauto")
2698 || strstr(filename,
"/usr/lib/libcups")
2699 || strstr(filename,
"/usr/lib/libDiagnosticMessagesClient")
2700 || strstr(filename,
"/usr/lib/liblangid")
2701 || strstr(filename,
"/usr/lib/libCRFSuite")
2702 || strstr(filename,
"/usr/lib/libpam")
2703 || strstr(filename,
"/usr/lib/libOpenScriptingUtil")
2704 || strstr(filename,
"/usr/lib/libextension"))
2706 #elif defined(__CYGWIN__) 2708 static const int bufsize = 260;
2709 char posixwindir[bufsize];
2710 char *windir = getenv(
"WINDIR");
2712 cygwin_conv_path(CCP_WIN_A_TO_POSIX, windir, posixwindir, bufsize);
2714 snprintf(posixwindir,
sizeof(posixwindir),
"/Windows/");
2715 if (strstr(filename, posixwindir) ||
2716 strstr(filename,
"/usr/bin/cyg"))
2718 #elif defined(R__WIN32) 2719 if (strstr(filename,
"/Windows/"))
2721 #elif defined (R__LINUX) 2722 if (strstr(filename,
"/ld-linux")
2723 || strstr(filename,
"linux-gnu/")
2724 || strstr(filename,
"/libstdc++.")
2725 || strstr(filename,
"/libgcc")
2726 || strstr(filename,
"/libc.")
2727 || strstr(filename,
"/libdl.")
2728 || strstr(filename,
"/libm."))
2746 Error(
"Load",
"Trying to load library (%s) from rootcling.",filename);
2752 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
2753 std::string canonLib = DLM->lookupLibrary(filename);
2754 cling::DynamicLibraryManager::LoadLibResult res
2755 = cling::DynamicLibraryManager::kLoadLibNotFound;
2756 if (!canonLib.empty()) {
2758 res = DLM->loadLibrary(filename, system);
2762 cling::Interpreter::CompilationResult compRes;
2763 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
2765 if (compRes == cling::Interpreter::kSuccess)
2766 res = cling::DynamicLibraryManager::kLoadLibSuccess;
2770 if (res == cling::DynamicLibraryManager::kLoadLibSuccess) {
2774 case cling::DynamicLibraryManager::kLoadLibSuccess:
return 0;
2775 case cling::DynamicLibraryManager::kLoadLibAlreadyLoaded:
return 1;
2825 Warning(
"Calc",
"waiting for cling thread to free");
2828 gROOT->SetLineIsProcessing();
2836 cling::Interpreter::CompilationResult cr =
fInterpreter->evaluate(line, valRef);
2837 if (cr != cling::Interpreter::kSuccess) {
2845 if (!valRef.isValid()) {
2854 if (valRef.isVoid()) {
2861 gROOT->SetLineHasBeenProcessed();
2864 return valRef.simplisticCastAs<
long>();
2871 void (*histaddFunc)(
const char*
line))
2876 #if defined(R__MUST_REVISIT) 2877 #if R__MUST_REVISIT(6,2) 2878 Warning(
"SetGetline",
"Cling should support the equivalent of SetGetlineFunc(getlineFunc, histaddFunc)");
2892 || T.deserialized_decls_begin() != T.deserialized_decls_end()
2893 || T.macros_begin() != T.macros_end()
2894 || ((!T.getFirstDecl().isNull()) && ((*T.getFirstDecl().begin()) != T.getWrapperFD()))) {
2911 std::set<TObject*>::iterator iSpecial = ((std::set<TObject*>*)
fgSetOfSpecials)->find(obj);
2928 #if defined(R__MUST_REVISIT) 2929 #if R__MUST_REVISIT(6,2) 2931 Warning(
"Reset",
"Cling should support the equivalent of scratch_upto(&fDictPos)");
2941 #if defined(R__MUST_REVISIT) 2942 #if R__MUST_REVISIT(6,2) 2944 Warning(
"ResetAll",
"Cling should support the equivalent of complete reset (unload everything but the startup decls.");
2971 #if defined(R__MUST_REVISIT) 2972 #if R__MUST_REVISIT(6,2) 2974 Warning(
"ResetGlobalVar",
"Cling should support the equivalent of resetglobalvar(obj)");
2986 #if defined(R__MUST_REVISIT) 2987 #if R__MUST_REVISIT(6,2) 2989 Warning(
"RewindDictionary",
"Cling should provide a way to revert transaction similar to rewinddictionary()");
3000 #if defined(R__MUST_REVISIT) 3001 #if R__MUST_REVISIT(6,2) 3003 Warning(
"DeleteGlobal",
"Cling should provide the equivalent of deleteglobal(obj), see also DeleteVariable.");
3015 #if defined(R__MUST_REVISIT) 3016 #if R__MUST_REVISIT(6,2) 3017 Warning(
"DeleteVariable",
"should do more that just reseting the value to zero");
3022 llvm::StringRef srName(name);
3023 const char* unscopedName =
name;
3024 llvm::StringRef::size_type posScope = srName.rfind(
"::");
3025 const clang::DeclContext* declCtx = 0;
3026 if (posScope != llvm::StringRef::npos) {
3027 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
3028 const clang::Decl* scopeDecl
3029 = lh.findScope(srName.substr(0, posScope),
3030 cling::LookupHelper::WithDiagnostics);
3032 Error(
"DeleteVariable",
"Cannot find enclosing scope for variable %s",
3036 declCtx = llvm::dyn_cast<clang::DeclContext>(scopeDecl);
3038 Error(
"DeleteVariable",
3039 "Enclosing scope for variable %s is not a declaration context",
3043 unscopedName += posScope + 2;
3045 clang::NamedDecl* nVarDecl
3046 = cling::utils::Lookup::Named(&
fInterpreter->getSema(), unscopedName, declCtx);
3048 Error(
"DeleteVariable",
"Unknown variable %s", name);
3051 clang::VarDecl* varDecl = llvm::dyn_cast<clang::VarDecl>(nVarDecl);
3053 Error(
"DeleteVariable",
"Entity %s is not a variable", name);
3057 clang::QualType qType = varDecl->getType();
3061 if (type->isPointerType()) {
3062 int** ppInt = (
int**)
fInterpreter->getAddressOfGlobal(GlobalDecl(varDecl));
3064 if (ppInt) *ppInt = 0;
3074 #if defined(R__MUST_REVISIT) 3075 #if R__MUST_REVISIT(6,2) 3077 Warning(
"SaveContext",
"Cling should provide a way to record a state watermark similar to store_dictposition(&fDictPos)");
3087 #if defined(R__MUST_REVISIT) 3088 #if R__MUST_REVISIT(6,2) 3090 Warning(
"SaveGlobalsContext",
"Cling should provide a way to record a watermark for the list of global variable similar to store_dictposition(&fDictPosGlobals)");
3136 if (!info->IsValid()) {
3160 zombieCandidate =
kTRUE;
3162 if (!info->IsLoaded()) {
3167 zombieCandidate =
kTRUE;
3217 static const char *anonEnum =
"anonymous enum ";
3218 static const int cmplen = strlen(anonEnum);
3220 if (0 == strncmp(name,anonEnum,cmplen)) {
3239 if (isClassOrNamespaceOnly &&
3242 const char *classname =
name;
3253 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
3255 const clang::Decl *decl
3256 = lh.findScope(classname,
3257 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3258 : cling::LookupHelper::NoDiagnostics,
3262 decl = lh.findScope(buf,
3263 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3264 : cling::LookupHelper::NoDiagnostics,
3281 clang::ClassTemplateSpecializationDecl *tmpltDecl =
3282 llvm::dyn_cast_or_null<clang::ClassTemplateSpecializationDecl>
3283 (type->getAsCXXRecordDecl());
3284 if (tmpltDecl && !tmpltDecl->getPointOfInstantiation().isValid()) {
3303 if (tci.
Property() & propertiesMask) {
3339 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
3340 const clang::Decl *decl
3341 = lh.findClassTemplate(name,
3342 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3343 : cling::LookupHelper::NoDiagnostics);
3345 std::string strname =
"std::";
3347 decl = lh.findClassTemplate(strname,
3348 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3349 : cling::LookupHelper::NoDiagnostics);
3375 cl->
fBase = listOfBase;
3391 D =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
3394 if (
const clang::DeclContext* DC = dyn_cast<clang::DeclContext>(D)) {
3395 cling::Interpreter::PushTransactionRAII deserRAII(
fInterpreter);
3397 llvm::SmallVector< DeclContext *, 4> allDeclContexts;
3398 const_cast< clang::DeclContext *
>(DC)->collectAllContexts(allDeclContexts);
3399 for (llvm::SmallVector<DeclContext*, 4>::iterator declIter = allDeclContexts.begin(), declEnd = allDeclContexts.end();
3400 declIter != declEnd; ++declIter) {
3402 for (clang::DeclContext::decl_iterator DI = (*declIter)->decls_begin(),
3403 DE = (*declIter)->decls_end(); DI != DE; ++DI) {
3404 if (
const clang::EnumDecl* ED = dyn_cast<clang::EnumDecl>(*DI)) {
3407 PrintingPolicy Policy(ED->getASTContext().getPrintingPolicy());
3408 llvm::raw_string_ostream stream(buf);
3409 ED->getNameForDiagnostic(stream, Policy,
false);
3413 const char*
name = buf.c_str();
3415 enumList.
Get(ED, name);
3437 D =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
3441 if (
const clang::DeclContext* DC = dyn_cast<clang::DeclContext>(D)) {
3442 cling::Interpreter::PushTransactionRAII deserRAII(
fInterpreter);
3444 llvm::SmallVector< DeclContext *, 4> allDeclContexts;
3445 const_cast< clang::DeclContext *
>(DC)->collectAllContexts(allDeclContexts);
3446 for (llvm::SmallVector<DeclContext*, 4>::iterator declIter = allDeclContexts.begin(),
3447 declEnd = allDeclContexts.end(); declIter != declEnd; ++declIter) {
3449 for (clang::DeclContext::decl_iterator DI = (*declIter)->decls_begin(),
3450 DE = (*declIter)->decls_end(); DI != DE; ++DI) {
3451 if (
const clang::FunctionTemplateDecl* FTD = dyn_cast<clang::FunctionTemplateDecl>(*DI)) {
3452 funcTempList->
Get(FTD);
3500 if (m->fMethodArgs) {
3503 m->fMethodArgs =
new TList;
3508 m->fMethodArgs->Add(
new TMethodArg((MethodArgInfo_t*)a, m));
3549 if (llvm::isa<clang::NamespaceDecl>(cli->
GetDecl())) {
3558 Error(
"GenerateTClass",
3559 "Cannot find %s::Class_Version()! Class version might be wrong.",
3566 if (newvers == -1) {
3574 newvers = callfunc.
ExecInt(0);
3576 Error(
"GenerateTClass",
3577 "Cannot invoke %s::Class_Version()! Class version might be wrong.",
3581 if (newvers != oldvers) {
3598 static void GenerateTClass_GatherInnerIncludes(cling::Interpreter *interp,
TString &includes,
TClingClassInfo *info)
3602 const clang::ClassTemplateSpecializationDecl *templateCl
3603 = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(info->
GetDecl());
3605 for(
unsigned int i=0; i < templateCl->getTemplateArgs().size(); ++i) {
3606 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
3610 if (!uType->isFundamentalType() && !uType->isEnumeralType()) {
3612 const clang::CXXRecordDecl *argdecl = uType->getAsCXXRecordDecl();
3615 TClingClassInfo subinfo(interp,*(argdecl->getASTContext().getRecordType(argdecl).getTypePtr()));
3616 GenerateTClass_GatherInnerIncludes(interp, includes, &subinfo);
3619 llvm::raw_string_ostream OS(Result);
3620 arg.print(argdecl->getASTContext().getPrintingPolicy(),OS);
3621 Warning(
"TCling::GenerateTClass",
"Missing header file for %s",OS.str().c_str());
3636 if (!info || !info->
IsValid()) {
3637 Fatal(
"GenerateTClass",
"Requires a valid ClassInfo object");
3642 std::string classname;
3646 Info(
"GenerateTClass",
"Will (try to) generate the compiled TClass for %s.",classname.c_str());
3650 GenerateTClass_GatherInnerIncludes(
fInterpreter,includes,info);
3656 Error(
"GenerateTClass",
"Even though the dictionary generation for %s seemed successful we can't find the TClass bootstrap!",classname.c_str());
3662 cl =
new TClass(classinfo, version, 0, 0, -1, -1, silent);
3668 cl =
new TClass(classinfo, 1, 0, 0, -1, -1, silent);
3693 if (classes == 0 || classes[0] == 0) {
3697 std::vector<std::string> listClasses;
3699 const char* current = classes, *prev = classes;
3703 if (*current ==
';') {
3704 listClasses.push_back(std::string(prev, current - prev));
3707 else if (*(current + 1) == 0) {
3708 listClasses.push_back(std::string(prev, current + 1 - prev));
3712 std::vector<std::string> listIncludes;
3714 const char* current = includes, *prev = includes;
3718 if (*current ==
';') {
3719 listIncludes.push_back(std::string(prev, current - prev));
3722 else if (*(current + 1) == 0) {
3723 listIncludes.push_back(std::string(prev, current + 1 - prev));
3729 std::vector<std::string>(), std::vector<std::string>());
3750 if (
const ValueDecl* decl = (
const ValueDecl*) d){
3753 if (hasIoName && ioName != name)
return 0;
3771 const clang::Decl* possibleEnum = 0;
3776 const clang::DeclContext* dc = 0;
3777 if (
const clang::Decl* D = cci->
GetDecl()) {
3778 if (!(dc = dyn_cast<clang::NamespaceDecl>(D))) {
3779 dc = dyn_cast<clang::RecordDecl>(D);
3784 possibleEnum = cling::utils::Lookup::Named(&
fInterpreter->getSema(),
name, dc);
3786 Error(
"TCling::GetEnum",
"DeclContext not found for %s .\n", name);
3791 possibleEnum = cling::utils::Lookup::Named(&
fInterpreter->getSema(),
name);
3793 if (possibleEnum && (possibleEnum != (clang::Decl*)-1)
3794 && isa<clang::EnumDecl>(possibleEnum)) {
3795 return possibleEnum;
3807 llvm::StringRef mangled_name = gv->getName();
3822 std::string scopename(demangled_name_c);
3823 free(demangled_name_c);
3829 std::string dataname;
3831 if (!strncmp(scopename.c_str(),
"typeinfo for ",
sizeof(
"typeinfo for ")-1)) {
3832 scopename.erase(0,
sizeof(
"typeinfo for ")-1);
3833 }
if (!strncmp(scopename.c_str(),
"vtable for ",
sizeof(
"vtable for ")-1)) {
3834 scopename.erase(0,
sizeof(
"vtable for ")-1);
3837 std::string::size_type pos = scopename.rfind(
'(');
3838 if (pos != std::string::npos) {
3842 pos = scopename.rfind(
':');
3843 if (pos != std::string::npos) {
3844 if ((pos != 0) && (scopename[pos-1] ==
':')) {
3845 dataname = scopename.substr(pos+1);
3846 scopename.erase(pos-1);
3850 dataname = scopename;
3858 if (scopename.size()) {
3874 Error(
"GetDataMemberWithValue()",
"not implemented");
3884 Error(
"GetDataMemberAtAddr()",
"not implemented");
3894 const char* params,
Bool_t objectIsConst )
3906 func.
SetFunc(&gcl, method, params, &offset);
3912 return mangled_name;
3921 const char* proto,
Bool_t objectIsConst ,
3927 GetMethod(method, proto, objectIsConst, 0 , mode).GetMangledName();
3939 const char* params,
Bool_t objectIsConst )
3951 func.
SetFunc(&gcl, method, params, &offset);
3980 std::vector<DeclId_t>& res)
const 3983 const clang::Decl* CtxDecl
3985 S.Context.getTranslationUnitDecl();
3986 const clang::DeclContext*
3987 DeclCtx = llvm::dyn_cast<
const clang::RecordDecl>(CtxDecl);
3989 DeclCtx = dyn_cast<clang::NamespaceDecl>(CtxDecl);
3990 if (!DeclCtx)
return;
3991 clang::DeclarationName DName
3992 = &S.Context.Idents.get(funcname);
3993 clang::LookupResult
R(S, DName, clang::SourceLocation(),
3994 Sema::LookupOrdinaryName, clang::Sema::ForRedeclaration);
3995 S.LookupQualifiedName(R, const_cast<DeclContext*>(DeclCtx));
3996 if (R.empty())
return;
3998 res.reserve(res.size() + (R.end() - R.begin()));
3999 for (clang::LookupResult::iterator IR = R.begin(), ER = R.end();
4001 if (
const clang::FunctionDecl* FD
4002 = llvm::dyn_cast<const clang::FunctionDecl>(*IR)) {
4003 if (!FD->getDescribedFunctionTemplate()) {
4147 func.
SetFunc(&cl,
function, params, &offset);
4163 const char* params,
Bool_t objectIsConst,
int* error)
4176 void* address = (
void*)((
Long_t)addr + offset);
4183 const char* params,
int* error)
4185 Execute(obj,cl,method,params,
false,error);
4200 Error(
"Execute",
"No method was defined");
4209 if (argc > nparms) {
4210 Error(
"Execute",
"Too many parameters to call %s, got %d but expected at most %d.",method->
GetName(),argc,nparms);
4213 if (nparms != argc) {
4223 Int_t firstDefault = -1;
4224 for (
Int_t i = 0; i < nparms; i ++) {
4231 if (firstDefault >= 0) {
4232 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);
4234 Error(
"Execute",
"Too few arguments to call %s, got only %d but expected %d.",method->
GetName(),argc,nparms);
4240 const char* listpar =
"";
4245 for (
Int_t i = 0; i < argc; i ++) {
4254 chpar += (nxtpar->String()).
ReplaceAll(
"\"",
"\\\"");
4261 complete += nxtpar->String();
4264 listpar = complete.
Data();
4282 const CXXMethodDecl * mdecl = dyn_cast<CXXMethodDecl>(minfo->
GetMethodDecl());
4284 void* address = (
void*)((
Long_t)addr + offset);
4291 const void* args[] ,
4296 Error(
"ExecuteWithArgsAndReturn",
"No method was defined");
4302 func.ExecWithArgsAndReturn(address, args, nargs, ret);
4323 Warning(
"GetTopLevelMacroName",
"Must change return type!");
4370 #if defined(R__MUST_REVISIT) 4371 #if R__MUST_REVISIT(6,0) 4372 Warning(
"GetCurrentMacroName",
"Must change return type!");
4385 TTHREAD_TLS(
char*) t = 0;
4386 TTHREAD_TLS(
unsigned int) tlen = 0;
4388 unsigned int dlen = strlen(typeDesc);
4391 t =
new char[dlen + 1];
4394 const char* s, *template_start;
4395 if (!strstr(typeDesc,
"(*)(")) {
4396 s = strchr(typeDesc,
' ');
4397 template_start = strchr(typeDesc,
'<');
4398 if (!strcmp(typeDesc,
"long long")) {
4399 strlcpy(t, typeDesc, dlen + 1);
4401 else if (!strncmp(typeDesc,
"unsigned ", s + 1 - typeDesc)) {
4402 strlcpy(t, typeDesc, dlen + 1);
4408 else if (s && (template_start == 0 || (s < template_start))) {
4409 strlcpy(t, s + 1, dlen + 1);
4412 strlcpy(t, typeDesc, dlen + 1);
4416 strlcpy(t, typeDesc, dlen + 1);
4419 while (l > 0 && (t[l - 1] ==
'*' || t[l - 1] ==
'&')) {
4433 const std::map<char, unsigned int> keyLenMap = {{
'c',6},{
'n',10},{
't',8},{
'h',7},{
'e',5}};
4435 if (rootmapfile && *rootmapfile) {
4439 std::ifstream file(rootmapfile);
4440 std::string
line; line.reserve(200);
4441 std::string lib_name; line.reserve(100);
4442 bool newFormat=
false;
4443 while (getline(file, line,
'\n')) {
4445 (strstr(line.c_str(),
"Library.")!=
nullptr || strstr(line.c_str(),
"Declare.")!=
nullptr)) {
4451 if (line.compare(0, 9,
"{ decls }") == 0) {
4454 while (getline(file, line,
'\n')) {
4455 if (line[0] ==
'[')
break;
4456 uniqueString->
Append(line);
4459 const char firstChar=line[0];
4460 if (firstChar ==
'[') {
4462 auto brpos = line.find(
']');
4463 if (brpos == string::npos)
continue;
4464 lib_name = line.substr(1, brpos-1);
4466 while( lib_name[nspaces] ==
' ' ) ++nspaces;
4467 if (nspaces) lib_name.replace(0, nspaces,
"");
4469 TString lib_nameTstr(lib_name.c_str());
4470 TObjArray* tokens = lib_nameTstr.Tokenize(
" ");
4474 Info(
"ReadRootmapFile",
"new section for %s", lib_nameTstr.Data());
4477 Info(
"ReadRootmapFile",
"section for %s (library does not exist)", lib_nameTstr.Data());
4484 auto keyLenIt = keyLenMap.find(firstChar);
4485 if (keyLenIt == keyLenMap.end())
continue;
4486 unsigned int keyLen = keyLenIt->second;
4488 const char *keyname = line.c_str()+keyLen;
4490 Info(
"ReadRootmapFile",
"class %s in %s", keyname, lib_name.c_str());
4493 if(lib_name != isThere->GetValue()){
4494 if (firstChar ==
'n') {
4496 Info(
"ReadRootmapFile",
"namespace %s found in %s is already in %s",
4497 keyname, lib_name.c_str(), isThere->GetValue());
4498 }
else if (firstChar ==
'h'){
4500 lib_name+=isThere->GetValue();
4504 Warning(
"ReadRootmapFile",
"%s %s found in %s is already in %s", line.substr(0, keyLen).c_str(),
4505 keyname, lib_name.c_str(), isThere->GetValue());
4509 Info(
"ReadRootmapFile",
"Key %s was already defined for %s", keyname, lib_name.c_str());
4568 using namespace clang;
4570 class ExtVisibleStorageAdder:
public RecursiveASTVisitor<ExtVisibleStorageAdder>{
4576 ExtVisibleStorageAdder(std::unordered_set<const NamespaceDecl*>& nsSet): fNSSet(nsSet) {};
4577 bool VisitNamespaceDecl(NamespaceDecl* nsDecl) {
4581 nsDecl->setHasExternalVisibleStorage();
4582 fNSSet.insert(nsDecl);
4586 std::unordered_set<const NamespaceDecl*>& fNSSet;
4632 for (
Int_t j = 0; j < i; j++) {
4643 Info(
"LoadLibraryMap",
"%s", d.
Data());
4654 Info(
"LoadLibraryMap",
" rootmap file: %s", p.
Data());
4676 Warning(
"LoadLibraryMap",
"please rename %s to end with \".rootmap\"", p.
Data());
4689 if (rootmapfile && *rootmapfile) {
4696 else if (res == -3) {
4706 while ((rec = (
TEnvRec*) next())) {
4708 if (!strncmp(cls.
Data(),
"Library.", 8) && cls.
Length() > 8) {
4727 Info(
"LoadLibraryMap",
"class %s in %s", cls.
Data(), wlib);
4730 Info(
"LoadLibraryMap",
"class %s in %s (library does not exist)", cls.
Data(), lib);
4745 else if (!strncmp(cls.
Data(),
"Declare.", 8) && cls.
Length() > 8) {
4755 cling::Transaction* T =
nullptr;
4757 assert(cling::Interpreter::kSuccess == compRes &&
"A declaration in a rootmap could not be compiled");
4759 if (compRes!=cling::Interpreter::kSuccess){
4761 "Problems in %s declaring '%s' were encountered.", rootmapfile, uniqueString.
Data()) ;
4766 for (
auto declIt = T->decls_begin(); declIt < T->decls_end(); ++declIt) {
4767 if (declIt->m_DGR.isSingleDecl()) {
4768 if (Decl* D = declIt->m_DGR.getSingleDecl()) {
4769 if (NamespaceDecl* NSD = dyn_cast<NamespaceDecl>(D)) {
4770 evsAdder.TraverseDecl(NSD);
4805 for (
Int_t ilib = 0; ilib < nrSharedLibs; ilib++) {
4812 TString rootMapBaseStr = sharedLibBaseStr;
4813 if (sharedLibBaseStr.
EndsWith(
".dll")) {
4816 else if (sharedLibBaseStr.
EndsWith(
".DLL")) {
4819 else if (sharedLibBaseStr.
EndsWith(
".so")) {
4822 else if (sharedLibBaseStr.
EndsWith(
".sl")) {
4825 else if (sharedLibBaseStr.
EndsWith(
".dl")) {
4828 else if (sharedLibBaseStr.
EndsWith(
".a")) {
4832 Error(
"ReloadAllSharedLibraryMaps",
"Unknown library type %s", sharedLibBaseStr.
Data());
4836 rootMapBaseStr +=
".rootmap";
4839 Error(
"ReloadAllSharedLibraryMaps",
"Could not find rootmap %s in path", rootMap);
4846 Error(
"ReloadAllSharedLibraryMaps",
"Error loading map %s", rootMap);
4881 if (!
fMapfile || !library || !*library) {
4889 size_t len = libname.
Length();
4894 while ((rec = (
TEnvRec *) next())) {
4905 if (!strncmp(cls.
Data(),
"Library.", 8) && cls.
Length() > 8) {
4914 if (!strncmp(lib, libname.
Data(), len)) {
4916 Error(
"UnloadLibraryMap",
"entry for <%s, %s> not found in library map table", cls.
Data(), lib);
4924 TString library_rootmap(library);
4925 if (!library_rootmap.
EndsWith(
".rootmap"))
4926 library_rootmap.
Append(
".rootmap");
4981 free(demangled_name);
4997 std::string demangled_name(demangled_name_c);
4998 free(demangled_name_c);
5011 result =
AutoLoad(demangled_name.c_str(), knowDictNotLoaded);
5036 Info(
"TCling::AutoLoad",
5037 "Trying to autoload for %s", cls);
5043 Info(
"TCling::AutoLoad",
5044 "Disabled due to gROOT or gInterpreter being invalid/not ready (the class name is %s)", cls);
5051 Info(
"TCling::AutoLoad",
5052 "Explicitly disabled (the class name is %s)", cls);
5073 if (
gROOT->LoadClass(cls, deplib) == 0) {
5075 Info(
"TCling::AutoLoad",
5076 "loaded dependent library %s for %s", deplib, cls);
5080 Error(
"TCling::AutoLoad",
5081 "failure loading dependent library %s for %s",
5086 if (lib && lib[0]) {
5087 if (
gROOT->LoadClass(cls, lib) == 0) {
5089 Info(
"TCling::AutoLoad",
5090 "loaded library %s for %s", lib, cls);
5095 Error(
"TCling::AutoLoad",
5096 "failure loading library %s for %s", lib, cls);
5111 cling::Interpreter *interpreter)
5114 Sema &SemaR = interpreter->getSema();
5115 ASTContext&
C = SemaR.getASTContext();
5116 Preprocessor &PP = SemaR.getPreprocessor();
5117 Parser&
P =
const_cast<Parser&
>(interpreter->getParser());
5118 Preprocessor::CleanupAndRestoreCacheRAII cleanupRAII(PP);
5119 Parser::ParserCurTokRestoreRAII savedCurToken(P);
5122 Token& Tok =
const_cast<Token&
>(P.getCurToken());
5123 Tok.setKind(tok::semi);
5129 Sema::ContextAndScopeRAII pushedDCAndS(SemaR, C.getTranslationUnitDecl(),
5131 std::string code = gNonInterpreterClassDef ;
5138 code += (
"#include \"");
5142 code += (
"#ifdef __ROOTCLING__\n" 5143 "#undef __ROOTCLING__\n" 5144 + gInterpreterClassDef +
5147 cling::Interpreter::CompilationResult cr;
5153 clangDiagSuppr diagSuppr(SemaR.getDiagnostics());
5155 #if defined(R__MUST_REVISIT) 5156 #if R__MUST_REVISIT(6,2) 5157 Warning(
"TCling::RegisterModule",
"Diagnostics suppression should be gone by now.");
5161 cr = interpreter->parseForModule(code);
5179 Int_t nHheadersParsed = 0;
5182 bool skipFirstEntry =
false;
5183 std::vector<std::string> autoparseKeys;
5184 if (strchr(cls,
'<')) {
5190 if (!autoparseKeys.empty()){
5191 TString templateName(autoparseKeys[0]);
5192 auto tokens = templateName.
Tokenize(
"::");
5193 clang::NamedDecl* previousScopeAsNamedDecl =
nullptr;
5194 clang::DeclContext* previousScopeAsContext =
nullptr;
5195 for (
auto const & scopeObj : *tokens){
5196 auto scopeName = ((
TObjString*) scopeObj)->String().Data();
5197 previousScopeAsNamedDecl = cling::utils::Lookup::Named(&
fInterpreter->getSema(), scopeName, previousScopeAsContext);
5199 if ((clang::NamedDecl*)-1 == previousScopeAsNamedDecl)
break;
5200 previousScopeAsContext = llvm::dyn_cast_or_null<clang::DeclContext>(previousScopeAsNamedDecl);
5201 if (!previousScopeAsContext)
break;
5205 if (
auto templateDecl = llvm::dyn_cast_or_null<clang::ClassTemplateDecl>(previousScopeAsNamedDecl)) {
5206 if (
auto templatedDecl = templateDecl->getTemplatedDecl()) {
5207 skipFirstEntry =
nullptr != templatedDecl->getDefinition();
5213 if (topLevel) autoparseKeys.emplace_back(cls);
5215 for (
const auto & apKeyStr : autoparseKeys) {
5216 if (skipFirstEntry) {
5217 skipFirstEntry=
false;
5220 if (apKeyStr.empty())
continue;
5221 const char *apKey = apKeyStr.c_str();
5225 Info(
"TCling::AutoParse",
5226 "Starting autoparse for %s\n", apKey);
5231 const cling::Transaction *T =
fInterpreter->getCurrentTransaction();
5233 auto const &hNamesPtrs = iter->second;
5235 Info(
"TCling::AutoParse",
5236 "We can proceed for %s. We have %s headers.", apKey, std::to_string(hNamesPtrs.size()).c_str());
5238 for (
auto & hName : hNamesPtrs) {
5240 if (0 !=
fPayloads.count(normNameHash)) {
5241 float initRSSval=0.f, initVSIZEval=0.f;
5243 (
void) initVSIZEval;
5246 "Parsing full payload for %s", apKey);
5253 if (cRes != cling::Interpreter::kSuccess) {
5254 if (hName[0] ==
'\n')
5255 Error(
"AutoParse",
"Error parsing payload code for class %s with content:\n%s", apKey, hName);
5264 Info(
"Autoparse",
">>> RSS key %s - before %.3f MB - after %.3f MB - delta %.3f MB", apKey, initRSSval, endRSSval, endRSSval-initRSSval);
5265 Info(
"Autoparse",
">>> VSIZE key %s - before %.3f MB - after %.3f MB - delta %.3f MB", apKey, initVSIZEval, endVSIZEval, endVSIZEval-initVSIZEval);
5271 "Parsing single header %s", hName);
5274 if (cRes != cling::Interpreter::kSuccess) {
5275 Error(
"AutoParse",
"Error parsing headerfile %s for class %s.", hName, apKey);
5287 if (strchr(apKey,
'<')) {
5294 return nHheadersParsed;
5315 Info(
"TCling::AutoParse",
5316 "Trying to autoparse for %s", cls);
5332 if (nHheadersParsed != 0) {
5351 return nHheadersParsed > 0 ? 1 : 0;
5364 mangled_name.c_str())) {
5375 std::string
name(demangled_name_c);
5376 free(demangled_name_c);
5384 if (!strncmp(name.c_str(),
"typeinfo for ",
sizeof(
"typeinfo for ")-1)) {
5385 name.erase(0,
sizeof(
"typeinfo for ")-1);
5386 }
else if (!strncmp(name.c_str(),
"vtable for ",
sizeof(
"vtable for ")-1)) {
5387 name.erase(0,
sizeof(
"vtable for ")-1);
5388 }
else if (!strncmp(name.c_str(),
"operator",
sizeof(
"operator")-1)
5389 && !isalnum(name[
sizeof(
"operator")])) {
5391 name.erase(0,
sizeof(
"operator")-1);
5392 std::string::size_type pos = name.rfind(
'(');
5393 if (pos != std::string::npos) {
5394 name.erase(0, pos + 1);
5395 pos = name.find(
",");
5396 if (pos != std::string::npos) {
5400 pos = name.rfind(
" const");
5401 if (pos != std::string::npos) {
5402 name.erase(pos, strlen(
" const"));
5404 while (!name.empty() && strchr(
"&*", name.back()))
5405 name.erase(name.length() - 1);
5409 std::string::size_type pos = name.rfind(
'(');
5410 if (pos != std::string::npos) {
5414 pos = name.rfind(
':');
5415 if (pos != std::string::npos) {
5416 if ((pos != 0) && (name[pos-1] ==
':')) {
5433 while (libs.
Tokenize(lib, posLib)) {
5443 void* addr = llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(mangled_name.c_str());
5470 const NamedDecl* ND =
static_cast<const NamedDecl*
>(vTD);
5471 const TagDecl* td = dyn_cast<TagDecl>(ND);
5475 tdDef = td->getDefinition();
5481 if (llvm::isa<clang::FunctionDecl>(td->getDeclContext())) {
5485 clang::QualType
type( td->getTypeForDecl(), 0 );
5487 auto declName=ND->getNameAsString();
5495 name = ND->getNameAsString();
5510 const TagDecl* tdOld = llvm::dyn_cast_or_null<TagDecl>(cci->
GetDecl());
5511 if (!tdOld || (tdDef && tdDef != tdOld)) {
5568 std::set<TClass*> modifiedTClasses;
5573 bool isTUTransaction =
false;
5574 if (T.decls_end()-T.decls_begin() == 1 && !T.hasNestedTransactions()) {
5575 clang::Decl* FirstDecl = *(T.decls_begin()->m_DGR.begin());
5576 if (clang::TranslationUnitDecl* TU
5577 = dyn_cast<clang::TranslationUnitDecl>(FirstDecl)) {
5580 isTUTransaction =
true;
5588 cling::Interpreter::PushTransactionRAII RAII(
fInterpreter);
5589 for (clang::DeclContext::decl_iterator TUI = TU->decls_begin(),
5590 TUE = TU->decls_end(); TUI != TUE; ++TUI)
5595 std::set<const void*> TransactionDeclSet;
5596 if (!isTUTransaction && T.decls_end() - T.decls_begin()) {
5597 const clang::Decl* WrapperFD = T.getWrapperFD();
5598 for (cling::Transaction::const_iterator
I = T.decls_begin(),
E = T.decls_end();
5600 if (
I->m_Call != cling::Transaction::kCCIHandleTopLevelDecl
5601 &&
I->m_Call != cling::Transaction::kCCIHandleTagDeclDefinition)
5604 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
5605 DE =
I->m_DGR.end(); DI != DE; ++DI) {
5606 if (*DI == WrapperFD)
5608 TransactionDeclSet.insert(*DI);
5609 ((
TCling*)
gCling)->HandleNewDecl(*DI,
false, modifiedTClasses);
5616 for (cling::Transaction::const_iterator
I = T.deserialized_decls_begin(),
5617 E = T.deserialized_decls_end();
I !=
E; ++
I) {
5618 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
5619 DE =
I->m_DGR.end(); DI != DE; ++DI)
5620 if (TransactionDeclSet.find(*DI) == TransactionDeclSet.end()) {
5636 std::vector<TClass*> modifiedTClassesDiff(modifiedTClasses.size());
5637 std::vector<TClass*>::iterator it;
5638 it = set_difference(modifiedTClasses.begin(), modifiedTClasses.end(),
5641 modifiedTClassesDiff.begin());
5642 modifiedTClassesDiff.resize(it - modifiedTClassesDiff.begin());
5645 ((
TCling*)
gCling)->GetModTClasses().insert(modifiedTClassesDiff.begin(),
5646 modifiedTClassesDiff.end());
5647 for (std::vector<TClass*>::const_iterator
I = modifiedTClassesDiff.begin(),
5648 E = modifiedTClassesDiff.end();
I !=
E; ++
I) {
5650 if (!
gROOT->GetListOfClasses()->FindObject(*
I)) {
5654 cling::Interpreter::PushTransactionRAII RAII(
fInterpreter);
5674 for (DeclContext::decl_iterator RI = DC->decls_begin(), RE = DC->decls_end(); RI != RE; ++RI) {
5675 if (isa<VarDecl>(*RI) || isa<FieldDecl>(*RI)) {
5676 const clang::ValueDecl* VD = dyn_cast<ValueDecl>(*RI);
5680 datamembers->
Unload(var);
5683 }
else if (
const FunctionDecl* FD = dyn_cast<FunctionDecl>(*RI)) {
5686 functions->
Unload(
function);
5687 function->Update(0);
5689 }
else if (
const EnumDecl* ED = dyn_cast<EnumDecl>(*RI)) {
5697 if (enumConst && enumConst->IsValid()) {
5698 datamembers->
Unload(enumConst);
5699 enumConst->Update(0);
5705 }
else if (
const FunctionTemplateDecl* FTD = dyn_cast<FunctionTemplateDecl>(*RI)) {
5707 if (functiontemplate) {
5708 functiontemplates->
Unload(functiontemplate);
5709 functiontemplate->
Update(0);
5726 cling::Transaction::const_nested_iterator iNested = T.nested_begin();
5727 for(cling::Transaction::const_iterator
I = T.decls_begin(),
E = T.decls_end();
5729 if (
I->m_Call == cling::Transaction::kCCIHandleVTable)
5732 if (
I->m_Call == cling::Transaction::kCCINone) {
5738 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
5739 DE =
I->m_DGR.end(); DI != DE; ++DI) {
5743 if ( (*DI)->isFromASTFile() )
5747 if (isa<VarDecl>(*DI) || isa<EnumConstantDecl>(*DI)) {
5765 }
else if (
const FunctionDecl* FD = dyn_cast<FunctionDecl>(*DI)) {
5767 if (
function &&
function->IsValid()) {
5768 functions->
Unload(
function);
5769 function->Update(0);
5772 }
else if (
const FunctionTemplateDecl* FTD = dyn_cast<FunctionTemplateDecl>(*DI)) {
5774 if (functiontemplate) {
5775 functiontemplates->
Unload(functiontemplate);
5776 functiontemplate->
Update(0);
5779 }
else if (
const EnumDecl* ED = dyn_cast<EnumDecl>(*DI)) {
5782 TIter iEnumConst(e->GetConstants());
5788 globals->
Unload(enumConst);
5789 enumConst->Update(0);
5797 }
else if (
const clang::RecordDecl* RD = dyn_cast<RecordDecl>(*DI)) {
5798 std::vector<TClass*> vectTClass;
5800 if (RD->isCompleteDefinition()) {
5802 for (std::vector<TClass*>::iterator CI = vectTClass.begin(), CE = vectTClass.end();
5805 (*CI)->ResetClassInfo();
5810 }
else if (
const clang::NamespaceDecl* ND = dyn_cast<NamespaceDecl>(*DI)) {
5811 std::vector<TClass*> vectTClass;
5813 for (std::vector<TClass*>::iterator CI = vectTClass.begin(), CE = vectTClass.end();
5816 if (ND->isOriginalNamespace()) {
5817 (*CI)->ResetClassInfo();
5833 std::size_t normNameHash = triter->second;
5839 auto const &hNamesPtrs = iter->second;
5840 for (
auto &hName : hNamesPtrs) {
5842 Info(
"TransactionRollback",
5843 "Restoring ability to autoaparse: %s", hName);
5882 if (!cls || !*cls) {
5890 const char* libs = libs_record->
GetValue();
5891 return (*libs) ? libs : 0;
5908 const char* libs = libs_record->
GetValue();
5909 return (*libs) ? libs : 0;
5924 if (!
fMapfile || !lib || !lib[0]) {
5934 size_t len = libname.
Length();
5935 while ((rec = (
TEnvRec*) next())) {
5936 const char* libs = rec->
GetValue();
5937 if (!strncmp(libs, libname.
Data(), len) && strlen(libs) >= len
5938 && (!libs[len] || libs[len] ==
' ' || libs[len] ==
'.')) {
5951 #if defined(R__MUST_REVISIT) 5952 #if R__MUST_REVISIT(6,2) 5953 Warning(
"IsErrorMessagesEnabled",
"Interface not available yet.");
5965 #if defined(R__MUST_REVISIT) 5966 #if R__MUST_REVISIT(6,2) 5967 Warning(
"SetErrorMessages",
"Interface not available yet.");
5983 llvm::SmallVector<std::string, 10> includePaths;
5985 fInterpreter->GetIncludePaths(includePaths,
false,
true);
5986 if (
const size_t nPaths = includePaths.size()) {
5987 assert(!(nPaths & 1) &&
"GetIncludePath, number of paths and options is not equal");
5989 for (
size_t i = 0; i < nPaths; i += 2) {
5994 if (includePaths[i] !=
"-I")
6028 assert(fout != 0 &&
"DisplayIncludePath, 'fout' parameter is null");
6030 llvm::SmallVector<std::string, 10> includePaths;
6032 fInterpreter->GetIncludePaths(includePaths,
false,
true);
6033 if (
const size_t nPaths = includePaths.size()) {
6034 assert(!(nPaths & 1) &&
"DisplayIncludePath, number of paths and options is not equal");
6036 std::string allIncludes(
"include path:");
6037 for (
size_t i = 0; i < nPaths; i += 2) {
6039 allIncludes += includePaths[i];
6041 if (includePaths[i] !=
"-I")
6043 allIncludes += includePaths[i + 1];
6046 fprintf(fout,
"%s\n", allIncludes.c_str());
6065 #if defined(R__MUST_REVISIT) 6066 #if R__MUST_REVISIT(6,2) 6067 Warning(
"GenericError",
"Interface not available yet.");
6097 Error(
"Getgvp",
"This was controlling the behavior of the wrappers for object construction and destruction.\nThis is now a nop and likely change the behavior of the calling routines.");
6105 Error(
"Getp2f2funcname",
"Will not be implemented: " 6106 "all function pointers are compiled!");
6115 #if defined(R__MUST_REVISIT) 6116 #if R__MUST_REVISIT(6,2) 6117 Warning(
"GetSecurityError",
"Interface not available yet.");
6128 cling::Interpreter::CompilationResult compRes;
6129 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
6131 return compRes == cling::Interpreter::kFailure;
6142 return (
fInterpreter->declare(text) == cling::Interpreter::kSuccess);
6150 TTHREAD_TLS_DECL(std::string,buffer);
6152 return buffer.c_str();
6218 #if defined(R__MUST_REVISIT) 6219 #if R__MUST_REVISIT(6,2) 6220 Warning(
"SetErrmsgcallback",
"Interface not available yet.");
6232 Error(
"Setgvp",
"This was controlling the behavior of the wrappers for object construction and destruction.\nThis is now a nop and likely change the behavior of the calling routines.");
6240 Error(
"SetRTLD_NOW()",
"Will never be implemented! Don't use!");
6247 Error(
"SetRTLD_LAZY()",
"Will never be implemented! Don't use!");
6262 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
6263 std::string canonical = DLM->lookupLibrary(path);
6264 if (canonical.empty()) {
6268 cling::Interpreter::CompilationResult compRes;
6269 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
6271 return compRes == cling::Interpreter::kFailure;
6287 using namespace cling;
6301 if (value.isValid() && value.needsManagedAllocation()) {
6314 cling::Interpreter *interpreter = ((
TCling*)
gCling)->GetInterpreter();
6324 auto iSpecObj = iSpecObjMap->second.find(Name);
6325 if (iSpecObj != iSpecObjMap->second.end()) {
6327 return iSpecObj->second;
6333 Sema &SemaR = interpreter->getSema();
6334 ASTContext&
C = SemaR.getASTContext();
6335 Preprocessor &PP = SemaR.getPreprocessor();
6336 Parser&
P =
const_cast<Parser&
>(interpreter->getParser());
6337 Preprocessor::CleanupAndRestoreCacheRAII cleanupRAII(PP);
6338 Parser::ParserCurTokRestoreRAII savedCurToken(P);
6341 Token& Tok =
const_cast<Token&
>(P.getCurToken());
6342 Tok.setKind(tok::semi);
6348 Sema::ContextAndScopeRAII pushedDCAndS(SemaR, C.getTranslationUnitDecl(),
6351 TObject* specObj =
gROOT->FindSpecialObject(Name, LookupCtx);
6354 Error(
"GetObjectAddress",
"Got a special object without LookupCtx!");
6368 clang::CXXRecordDecl* klass)
const 6370 using namespace clang;
6371 ASTContext& Ctx = klass->getASTContext();
6372 FriendDecl::FriendUnion friendUnion(
function);
6375 FriendDecl* friendDecl = FriendDecl::Create(Ctx, klass, sl, friendUnion, sl);
6376 klass->pushFriendDecl(friendDecl);
6390 if (func)
return ((
TClingCallFunc*)func)->GetDecl()->getCanonicalDecl();
6461 f->
Exec(address, &val);
6475 const void* args[] ,
6642 f->
SetFunc(ci, method, params, offset);
6651 f->
SetFunc(ci, method, params, objectIsConst, offset);
6679 f->
SetFuncProto(ci, method, proto, objectIsConst, offset, mode);
6689 llvm::SmallVector<clang::QualType, 4> funcProto;
6690 for (std::vector<TypeInfo_t*>::const_iterator iter = proto.begin(), end = proto.end();
6691 iter != end; ++iter) {
6692 funcProto.push_back( ((
TClingTypeInfo*)(*iter))->GetQualType() );
6704 llvm::SmallVector<clang::QualType, 4> funcProto;
6705 for (std::vector<TypeInfo_t*>::const_iterator iter = proto.begin(), end = proto.end();
6706 iter != end; ++iter) {
6707 funcProto.push_back( ((
TClingTypeInfo*)(*iter))->GetQualType() );
6709 f->
SetFuncProto(ci, method, funcProto, objectIsConst, offset, mode);
6724 if (!declid)
return kFALSE;
6726 const clang::Decl *scope;
6728 else scope =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
6730 const clang::Decl *decl =
reinterpret_cast<const clang::Decl*
>(declid);
6731 const clang::DeclContext *ctxt = clang::Decl::castToDeclContext(scope);
6732 if (!decl || !ctxt)
return kFALSE;
6733 if (decl->getDeclContext()->Equals(ctxt))
6735 else if (decl->getDeclContext()->isTransparentContext() &&
6736 decl->getDeclContext()->getParent()->Equals(ctxt))
6808 return TClinginfo->
GetMethodNArg(method, proto, objectIsConst, mode);
6833 TClinginfo->
Init(name);
6842 TClinginfo->
Init(tagnum);
6850 return TClinginfo->
IsBase(name);
6881 return TClinginfo->
IsValidMethod(method, proto,
false, offset, mode);
6889 return TClinginfo->
IsValidMethod(method, proto, objectIsConst, offset, mode);
6897 return TClinginfo->
Next();
6945 return TClinginfo->
Size();
6953 return TClinginfo->
Tagnum();
6969 TTHREAD_TLS_DECL(std::string,
output);
6979 return TClinginfo->
Name();
6987 return TClinginfo->
Title();
7024 ClassInfo_t* base)
const 7037 return TClinginfo->
Next();
7045 return TClinginfo->
Next(onlyDirect);
7053 return TClinginfo->
Offset(address, isDerivedObject);
7066 return TClinginfo->
GetBaseOffset(TClinginfoBase, address, isDerivedObject);
7082 return (ClassInfo_t *)TClinginfo->
GetBase();
7090 return TClinginfo->
Tagnum();
7098 TTHREAD_TLS_DECL(std::string,
output);
7108 return TClinginfo->
Name();
7153 const clang::Decl* decl =
reinterpret_cast<const clang::Decl*
>(declid);
7154 const clang::ValueDecl* vd = llvm::dyn_cast_or_null<clang::ValueDecl>(decl);
7187 return TClinginfo->
Next();
7195 return TClinginfo->
Offset();
7243 return TClinginfo->
Name();
7251 return TClinginfo->
Title();
7258 TTHREAD_TLS_DECL(std::string,
result);
7269 Decl* decl =
static_cast<Decl*
>(
const_cast<void*
>(declId));
7270 ASTContext &
C = decl->getASTContext();
7271 SourceRange commentRange;
7272 decl->addAttr(
new (C) AnnotateAttr( commentRange, C, attribute, 0 ) );
7283 cling::Interpreter &interp,
7286 const clang::TypeDecl* td = llvm::dyn_cast<clang::TypeDecl>(decl->getDeclContext());
7289 clang::QualType qualType(td->getTypeForDecl(),0);
7291 unsigned int level = 0;
7292 for(
size_t cursor = name.length()-1; cursor != 0; --cursor) {
7293 if (name[cursor] ==
'>') ++level;
7294 else if (name[cursor] ==
'<' && level) --level;
7295 else if (level == 0 && name[cursor] ==
':') {
7296 name.erase(0,cursor+1);
7307 if (llvm::isa<clang::CXXConstructorDecl>(decl))
7311 }
else if (llvm::isa<clang::CXXDestructorDecl>(decl))
7314 output.insert(output.begin(),
'~');
7316 llvm::raw_string_ostream stream(output);
7317 decl->getNameForDiagnostic(stream, decl->getASTContext().getPrintingPolicy(),
false);
7347 return (FuncTempInfo_t*)
const_cast<void*
>(declid);
7358 return (FuncTempInfo_t*)ft_info;
7378 if (!ft_info)
return 0;
7379 const clang::FunctionTemplateDecl *ft = (
const clang::FunctionTemplateDecl*)ft_info;
7380 return ft->getTemplateParameters()->size();
7389 if (!ft_info)
return 0;
7390 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
7391 return ft->getTemplateParameters()->getMinRequiredArguments();
7399 if (!ft_info)
return 0;
7404 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
7406 switch (ft->getAccess()) {
7407 case clang::AS_public:
7410 case clang::AS_protected:
7413 case clang::AS_private:
7416 case clang::AS_none:
7417 if (ft->getDeclContext()->isNamespace())
7425 const clang::FunctionDecl *fd = ft->getTemplatedDecl();
7426 if (
const clang::CXXMethodDecl *md =
7427 llvm::dyn_cast<clang::CXXMethodDecl>(fd)) {
7428 if (md->getTypeQualifiers() & clang::Qualifiers::Const) {
7431 if (md->isVirtual()) {
7437 if (
const clang::CXXConstructorDecl *cd =
7438 llvm::dyn_cast<clang::CXXConstructorDecl>(md)) {
7439 if (cd->isExplicit()) {
7443 else if (
const clang::CXXConversionDecl *cd =
7444 llvm::dyn_cast<clang::CXXConversionDecl>(md)) {
7445 if (cd->isExplicit()) {
7459 if (!ft_info)
return;
7460 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
7472 if (!ft_info)
return;
7473 const clang::FunctionTemplateDecl *ft = (
const clang::FunctionTemplateDecl*)ft_info;
7477 if (
const RedeclarableTemplateDecl *AnnotFD
7479 if (AnnotateAttr *
A = AnnotFD->getAttr<AnnotateAttr>()) {
7480 output =
A->getAnnotation().str();
7484 if (!ft->isFromASTFile()) {
7534 const clang::Decl* decl =
reinterpret_cast<const clang::Decl*
>(declid);
7536 const clang::FunctionDecl* fd = llvm::dyn_cast_or_null<clang::FunctionDecl>(decl);
7568 return info->
NArg();
7584 return info->
Next();
7608 return (TypeInfo_t*)info->
Type();
7616 TTHREAD_TLS_DECL(
TString, mangled_name);
7618 return mangled_name;
7661 return info->
Title();
7680 if (info && info->
IsValid()) {
7682 clang::QualType QT( typeinfo->
GetQualType().getCanonicalType() );
7683 if (QT->isEnumeralType()) {
7685 }
else if (QT->isPointerType()) {
7687 QT = llvm::cast<clang::PointerType>(QT)->getPointeeType();
7688 if ( QT->isCharType() ) {
7693 }
else if ( QT->isFloatingType() ) {
7694 int sz = typeinfo->
Size();
7695 if (sz == 4 || sz == 8) {
7701 }
else if ( QT->isIntegerType() ) {
7702 int sz = typeinfo->
Size();
7755 return (MethodArgInfo_t*)
7772 return info->
Next();
7796 return info->
Name();
7856 TClinginfo->
Init(name);
7872 return TClinginfo->
Name();
7896 return TClinginfo->
Size();
7946 const char*
name)
const 7950 TClinginfo->
Init(name);
7966 return TClinginfo->
Next();
7982 return TClinginfo->
Size();
7998 return TClinginfo->
Name();
8006 return TClinginfo->
Title();
int TCling__AutoLoadCallback(const char *className)
Describe Streamer information for one class version.
const char * GetIncludePath()
Refresh the list of include paths known to the interpreter and return it with -I prepended.
void ResetCaches()
To clean out all caches.
virtual TypeInfo_t * TypeInfo_Factory() const
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual const char * GetName() const
Returns name of object.
const TClingTypeInfo * Type() const
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
const clang::FunctionTemplateDecl * GetFunctionTemplate(const char *fname) const
virtual const char * TypeInfo_Name(TypeInfo_t *) const
virtual Bool_t FuncTempInfo_IsValid(FuncTempInfo_t *) const
Check validity of a FuncTempInfo_t.
virtual void SetRcName(const char *name)
virtual DeclId_t GetDataMemberAtAddr(const void *addr) const
Return pointer to cling DeclId for a data member with a given name.
TObject * GetObjectAddress(const char *Name, void *&LookupCtx)
If the interpreter encounters Name, check whether that is an object ROOT could retrieve.
virtual Long_t ClassInfo_Tagnum(ClassInfo_t *info) const
virtual int DataMemberInfo_ArrayDim(DataMemberInfo_t *dminfo) const
A collection of TDataMember objects designed for fast access given a DeclId_t and for keep track of T...
The TEnum class implements the enum type.
int TCling__IsAutoLoadNamespaceCandidate(const clang::NamespaceDecl *nsDecl)
This class defines an abstract interface to a generic command line interpreter.
int TCling__CompileMacro(const char *fileName, const char *options)
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 ...
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...
virtual void * MethodInfo_InterfaceMethod(MethodInfo_t *minfo) const
const char * TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Return the normalized name of the type (i.e.
virtual const char * ClassInfo_FullName(ClassInfo_t *info) const
int Size() const
Return the size in bytes of the underlying type of the current typedef.
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.e.
void TransactionRollback(const cling::Transaction &T)
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
virtual TVirtualMutex * Factory(Bool_t=kFALSE)=0
virtual const char * BaseClassInfo_FullName(BaseClassInfo_t *bcinfo) const
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
void LibraryLoaded(const void *dyLibHandle, const char *canonicalName)
Bool_t HandleNewTransaction(const cling::Transaction &T)
Helper function to increase the internal Cling count of transactions that change the AST...
bool LoadPCM(TString pcmFileName, const char **headers, void(*triggerFunc)()) const
Tries to load a PCM; returns true on success.
virtual void LoadEnums(TListOfEnums &cl) const
Create list of pointers to enums for TClass cl.
void TCling__UpdateListsOnCommitted(const cling::Transaction &T, cling::Interpreter *)
virtual std::string MethodInfo_TypeNormalizedName(MethodInfo_t *minfo) const
virtual void PostLoadCheck()
Do the initialization that can only be done after the CINT dictionary has been fully populated and ca...
DeclId_t GetDeclId(const llvm::GlobalValue *gv) const
Return pointer to cling DeclId for a global value.
virtual Long_t DataMemberInfo_Offset(DataMemberInfo_t *dminfo) const
const char * GetDeclFileName() const
virtual Double_t CallFunc_ExecDouble(CallFunc_t *func, void *address) const
virtual void CallFunc_ResetArg(CallFunc_t *func) const
static void ConstructorName(std::string &name, const clang::NamedDecl *decl, cling::Interpreter &interp, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt)
R__EXTERN Int_t gErrorIgnoreLevel
virtual Long_t MethodInfo_ExtraProperty(MethodInfo_t *minfo) const
virtual const char * WorkingDirectory()
Return working directory.
Namespace for new ROOT classes and functions.
std::map< SpecialObjectLookupCtx_t, SpecialObjectMap_t > fSpecialObjectMaps
virtual int UnloadFile(const char *path) const
static Bool_t Check(const char *cname, std::string &normname)
static const char **& GetExtraInterpreterArgs()
static cling::Interpreter::CompilationResult ExecAutoParse(const char *what, Bool_t header, cling::Interpreter *interpreter)
Parse the payload or header.
void RegisterLoadedSharedLibrary(const char *name)
Register a new shared library name with the interpreter; add it to fSharedLibs.
Collectable string class.
clang::QualType GetQualType() const
static void AddClassToDeclIdMap(TDictionary::DeclId_t id, TClass *cl)
static: Add a TClass* to the map of classes.
R__EXTERN TClassTable * gClassTable
void UpdateListsOnCommitted(const cling::Transaction &T)
TDictionary::DeclId_t DeclId_t
const char * TmpltName() const
RooArgList L(const RooAbsArg &v1)
void * llvmLazyFunctionCreator(const std::string &mangled_name)
Autoload a library provided the mangled name of a missing symbol.
Dictionary for function template This class describes one single function template.
const clang::Decl * GetDecl() const
const char * TypeName() const
virtual TString SplitAclicMode(const char *filename, TString &mode, TString &args, TString &io) const
This method split a filename of the form: ~~~ {.cpp} [path/]macro.C[+|++[k|f|g|O|c|s|d|v|-]][(args)]...
double ExecDouble(void *address)
void Init(const char *name)
All ROOT classes may have RTTI (run time type identification) support added.
int GetSplit(const char *type, std::vector< std::string > &output, int &nestedLoc, EModType mode=TClassEdit::kNone)
Stores in output (after emptying it) the splited type.
static TProtoClass * GetProtoNorm(const char *cname)
Given the class normalized name returns the TClassProto object for the class.
virtual void ClassInfo_Init(ClassInfo_t *info, const char *funcname) const
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
R__EXTERN TVirtualMutex * gInterpreterMutex
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...
virtual DataMemberInfo_t * DataMemberInfo_Factory(ClassInfo_t *clinfo=0) const
const char * Name() const
TList * GetListOfEnums(Bool_t load=kTRUE)
Return list containing the TEnums of a class.
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual bool ClassInfo_HasDefaultConstructor(ClassInfo_t *info) const
void Init(const char *name)
Lookup named typedef and reset the iterator to point to it.
std::atomic< TListOfEnums * > fEnums
llvm::StringRef ValidArrayIndex() const
virtual const char * MethodArgInfo_DefaultValue(MethodArgInfo_t *marginfo) const
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.
TClingMethodInfo GetMethod(const char *fname) const
Bool_t TestBit(UInt_t f) const
void SetFunc(const TClingClassInfo *info, const char *method, const char *arglist, long *poffset)
Double_t distance(const TPoint2 &p1, const TPoint2 &p2)
void SetArgArray(long *argArr, int narg)
cling::MetaProcessor * fMetaProcessor
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
const char * Name() const
Get the name of the current typedef.
Persistent version of a TClass.
Emulation of the CINT DataMemberInfo class.
virtual UInt_t FuncTempInfo_TemplateMinReqArgs(FuncTempInfo_t *) const
Return the number of required template arguments of the function template described by ft_info...
TEnum * Get(DeclId_t id, const char *name)
Return (after creating it if necessary) the TEnum describing the enum corresponding to the Decl 'id'...
std::atomic< Bool_t > fHasRootPcmInfo
C++ Property of the class (is abstract, has virtual table, etc.)
void CreateListOfBaseClasses(TClass *cl) const
Create list of pointers to base class(es) for TClass cl.
TClass * GenerateTClass(const char *classname, Bool_t emulation, Bool_t silent=kFALSE)
Generate a TClass for the given class.
void UpdateListOfGlobals()
No op: see TClingCallbacks (used to update the list of globals)
virtual MethodInfo_t * MethodInfo_FactoryCopy(MethodInfo_t *minfo) const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual Int_t GetEntries() const
void UpdateListOfGlobalFunctions()
No op: see TClingCallbacks (used to update the list of global functions)
virtual int SetClassAutoloading(int) const
Enable/Disable the Autoloading of libraries.
Emulation of the CINT MethodInfo class.
ptrdiff_t GetBaseOffset(TClingClassInfo *toBase, void *address, bool isDerivedObject)
void SaveContext()
Save the current Cling state.
virtual const char * MethodInfo_Name(MethodInfo_t *minfo) const
cling::Interpreter * fInterpreter
virtual bool ClassInfo_IsValid(ClassInfo_t *info) const
virtual const char * HomeDirectory(const char *userName=0)
Return the user's home directory.
static void RemoveClassDeclId(TDictionary::DeclId_t id)
const char * GetClassSharedLibs(const char *cls)
Get the list of shared libraries containing the code for class cls.
virtual FuncTempInfo_t * FuncTempInfo_Factory(DeclId_t declid) const
Construct a FuncTempInfo_t.
void TCling__DEBUG__dump(clang::DeclContext *DC)
const char * DefaultValue() const
long ClassProperty() const
static const char * filename()
void TCling__UpdateListsOnUnloaded(const cling::Transaction &T)
virtual TObject * Remove(TObject *obj)
Remove object from array.
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
Bool_t IsErrorMessagesEnabled() const
If error messages are disabled, the interpreter should suppress its failures and warning messages fro...
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
bool HasDefaultConstructor() const
TFunction * Find(DeclId_t id) const
Return the TMethod or TFunction describing the function corresponding to the Decl 'id'...
virtual Bool_t IsTreatingNonAccessibleTypes()
virtual int TypedefInfo_Next(TypedefInfo_t *tinfo) const
virtual const char * MapCppName(const char *) const
Interface to cling function.
Int_t Load(const char *filenam, Bool_t system=kFALSE)
Load a library file in cling's memory.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
virtual Long_t ClassInfo_Property(ClassInfo_t *info) const
void * InterfaceMethod(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
The TEnv class reads config files, by default named .rootrc.
std::string InsertStd(const char *tname)
clang::DeclContext * TCling__DEBUG__getDeclContext(clang::Decl *D)
virtual int MethodInfo_NDefaultArg(MethodInfo_t *minfo) const
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
ROOT::TMetaUtils::TNormalizedCtxt * fNormalizedCtxt
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...
static Bool_t HasNoInfoOrEmuOrFwdDeclaredDecl(const char *)
const char * GetValue() const
virtual const char * MethodArgInfo_TypeName(MethodArgInfo_t *marginfo) const
virtual TApplicationImp * GetApplicationImp()
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
virtual void CallFunc_SetArgArray(CallFunc_t *func, Long_t *paramArr, Int_t nparam) const
std::vector< std::pair< std::string, int > > FwdDeclArgsToKeepCollection_t
virtual Long_t TypeInfo_Property(TypeInfo_t *tinfo) const
void * fPrevLoadedDynLibInfo
virtual void GenericError(const char *error) const
Let the interpreter issue a generic error, and set its error state.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual const char * ClassInfo_Title(ClassInfo_t *info) const
virtual void TypeInfo_Delete(TypeInfo_t *tinfo) const
Each ROOT method (see TMethod) has a linked list of its arguments.
virtual void SetTempLevel(int val) const
Create / close a scope for temporaries.
const char * TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Get the name of the underlying type of the current typedef.
virtual bool ClassInfo_HasMethod(ClassInfo_t *info, const char *name) const
Int_t DeleteVariable(const char *name)
Undeclare obj called name.
virtual int SetClassAutoparsing(int)
Enable/Disable the Autoparsing of headers.
virtual ClassInfo_t * ClassInfo_Factory(Bool_t all=kTRUE) const
virtual bool DataMemberInfo_IsValid(DataMemberInfo_t *dminfo) const
TString & Prepend(const char *cs)
void SetAutoParsingSuspended(bool val=true)
R__EXTERN TApplication * gApplication
Abstract base class for accessing the data-members of a class.
TObject * At(Int_t idx) const
Bool_t IsLoaded(const char *filename) const
Return true if the file has already been loaded by cint.
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.e.
std::vector< cling::Value > * fTemporaries
virtual void MethodInfo_CreateSignature(MethodInfo_t *minfo, TString &signature) const
virtual ~TCling()
Destroy the interpreter interface.
virtual void FuncTempInfo_Delete(FuncTempInfo_t *) const
Delete the FuncTempInfo_t.
TObject * FindObject(const char *name) const
Find object using its name.
std::string GetMangledName() const
const char * GetFullTypeName() const
Get full type description of method argument, e.g.: "class TDirectory*".
virtual const char * TypeInfo_TrueName(TypeInfo_t *tinfo) const
virtual bool Update(FuncTempInfo_t *info)
Update the TFunctionTemplate to reflect the new info.
void Delete(void *arena, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
const TSeqCollection * GetConstants() const
Emulation of the CINT CallFunc class.
virtual BaseClassInfo_t * BaseClassInfo_Factory(ClassInfo_t *info) const
static const TString & GetIncludeDir()
Get the include directory in the installation. Static utility function.
const char * TypeTrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Bool_t R_ISREG(Int_t mode)
DeclId_t GetDeclId() const
virtual const char * TypedefInfo_TrueName(TypedefInfo_t *tinfo) const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void SetDeclAttr(DeclId_t, const char *)
virtual const char * TypedefInfo_Title(TypedefInfo_t *tinfo) const
virtual void BaseClassInfo_Delete(BaseClassInfo_t *bcinfo) const
V GetOffset(E val1, E val2, V iso)
void Execute(const char *function, const char *params, int *error=0)
Execute a global function with arguments params.
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
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...
const char * GetSharedLibDeps(const char *lib)
Get the list a libraries on which the specified lib depends.
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'...
static const char * GetMacroPath()
Get macro search path. Static utility function.
virtual bool ClassInfo_IsLoaded(ClassInfo_t *info) const
virtual TypeInfo_t * MethodInfo_Type(MethodInfo_t *minfo) const
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.
virtual Long_t BaseClassInfo_Property(BaseClassInfo_t *bcinfo) const
std::set< size_t > fPayloads
virtual const char * DataMemberInfo_Title(DataMemberInfo_t *dminfo) const
std::vector< const char * > fCurExecutingMacros
Bool_t IsValid()
Return true if this data member object is pointing to a currently loaded data member.
virtual void SetAllocunlockfunc(void(*)()) const
[Place holder for Mutex Unlock] Provide the interpreter with a way to release a lock used to protect ...
virtual int TypeInfo_Size(TypeInfo_t *tinfo) const
virtual int DataMemberInfo_TypeSize(DataMemberInfo_t *dminfo) const
virtual TypedefInfo_t * TypedefInfo_FactoryCopy(TypedefInfo_t *tinfo) const
virtual Long64_t CallFunc_ExecInt64(CallFunc_t *func, void *address) const
void TCling__DEBUG__decl_dump(void *D)
Int_t UnloadLibraryMap(const char *library)
Unload library map entries coming from the specified library.
void ExecuteWithArgsAndReturn(TMethod *method, void *address, const void *args[]=0, int nargs=0, void *ret=0) const
virtual void SetErrmsgcallback(void *p) const
Set a callback to receive error messages.
void ClearStack()
Delete existing temporary values.
virtual Long_t DataMemberInfo_Property(DataMemberInfo_t *dminfo) const
long Property() const
Return a bit mask of metadata about the current typedef.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
void ResetAll()
Reset the Cling state to its initial state.
void Exec(void *address, TInterpreterValue *interpVal=0)
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...
int Next()
Increment the iterator.
virtual bool MethodArgInfo_IsValid(MethodArgInfo_t *marginfo) const
TInterpreter::CallFuncIFacePtr_t IFacePtr()
Int_t GenerateDictionary(const char *classes, const char *includes=0, const char *options=0)
Generate the dictionary for the C++ classes listed in the first argument (in a semi-colon separated l...
virtual MethodArgInfo_t * MethodArgInfo_FactoryCopy(MethodArgInfo_t *marginfo) const
THashTable implements a hash table to store TObject's.
const char * TCling__GetClassSharedLibs(const char *className)
clang::NamespaceDecl * TCling__DEBUG__DCtoNamespace(clang::DeclContext *DC)
virtual TEnum * CreateEnum(void *VD, TClass *cl) const
virtual bool TypeInfo_IsValid(TypeInfo_t *tinfo) const
virtual const char * DataMemberInfo_TypeName(DataMemberInfo_t *dminfo) const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
bool IsBase(const char *name) const
Vc_ALWAYS_INLINE void free(T *p)
Frees memory that was allocated with Vc::malloc.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Bool_t CheckClassInfo(const char *name, Bool_t autoload, Bool_t isClassOrNamespaceOnly=kFALSE)
Checks if an entity with the specified name is defined in Cling.
std::atomic< TList * > fBase
Bool_t Declare(const char *code)
Declare code to the interpreter, without any of the interpreter actions that could trigger a re-inter...
std::map< const cling::Transaction *, size_t > fTransactionHeadersMap
virtual void MethodArgInfo_Delete(MethodArgInfo_t *marginfo) const
virtual Long_t MethodArgInfo_Property(MethodArgInfo_t *marginfo) const
void ShortType(std::string &answer, int mode)
Return the absolute type of typeDesc into the string answ.
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...
The TNamed class is the base class for all named ROOT classes.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
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.
void SetObjectValidity(EObjectPointerState val)
virtual void TypedefInfo_Init(TypedefInfo_t *tinfo, const char *name) const
virtual DataMemberInfo_t * DataMemberInfo_FactoryCopy(DataMemberInfo_t *dminfo) const
void SetArgs(const char *args)
virtual Long_t MethodInfo_Property(MethodInfo_t *minfo) const
char * DemangleName(const char *mangled_name, int &errorCode)
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...
int MaxIndex(int dim) const
virtual ClassInfo_t * BaseClassInfo_ClassInfo(BaseClassInfo_t *) const
void CreateSignature(TString &signature) 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...
TClass * GetClass() const
void Init(TClassEdit::TInterpreterLookupHelper *helper)
void ClearFileBusy()
Reset the interpreter internal state in case a previous action was not correctly terminated.
static void UpdateClassInfo(char *name, Long_t tagnum)
No op: see TClingCallbacks.
virtual const char * GetDynamicPath()
Return the dynamic path (used to find shared libraries).
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
const char * TypeName() const
void Clear()
Clear string without changing its capacity.
bool Append(const std::string &str)
Append string to the storage if not added already.
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 * Getenv(const char *env)
Get environment variable.
virtual Long_t BaseClassInfo_Tagnum(BaseClassInfo_t *bcinfo) const
virtual Long_t TypedefInfo_Property(TypedefInfo_t *tinfo) const
TString & Append(const char *cs)
static bool IsEnum(cling::Interpreter *interp, const char *name)
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
ULong64_t fTransactionCount
ClassInfo_t * GetClassInfo() const
TClass * GetClass() const
char * DemangleTypeIdName(const std::type_info &ti, int &errorCode)
Demangle in a portable way the type id name.
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...
virtual int DisplayClass(FILE *fout, const char *name, int base, int start) const
void UpdateListOfMethods(TClass *cl) const
Update the list of pointers to method for TClass cl This is now a nop.
Long_t ProcessLine(const char *line, EErrorCode *error=0)
Let cling process a command line.
virtual bool Update(DataMemberInfo_t *info)
Update the TFunction to reflect the new info.
virtual int DataMemberInfo_MaxIndex(DataMemberInfo_t *dminfo, Int_t dim) const
static void Add(const char *cname, Version_t id, const type_info &info, DictFuncPtr_t dict, Int_t pragmabits)
Add a class to the class table (this is a static function).
Emulation of the CINT TypeInfo class.
clang::RecordDecl * TCling__DEBUG__DCtoRecordDecl(clang::DeclContext *DC)
This class defines an interface to the cling C++ interpreter.
Bool_t IgnoreDuplicates(Bool_t ignore)
If set to true, no warnings in case of duplicates are issued.
TClass *(* DictFuncPtr_t)()
bool HasMethod(const char *name) const
virtual const char * DataMemberInfo_Name(DataMemberInfo_t *dminfo) const
virtual int GetSecurityError() const
Interface to cling function.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Int_t UnloadAllSharedLibraryMaps()
Unload the library map entries coming from all the loaded shared libraries.
void InitRootmapFile(const char *name)
Create a resource table and read the (possibly) three resource files, i.e $ROOTSYS/etc/system<name> (...
virtual Long_t CallFunc_ExecInt(CallFunc_t *func, void *address) const
std::string GetLong64_Name(const char *original)
Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.
void InspectMembers(TMemberInspector &, const void *obj, const TClass *cl, Bool_t isTransient)
Visit all members over members, recursing over base classes.
long ExtraProperty() const
const clang::FunctionDecl * GetMethodDecl() const
static void TCling__UpdateClassInfo(const NamedDecl *TD)
Update TClingClassInfo for a class (e.g. upon seeing a definition).
const char * GetPrototype(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
void TCling__DEBUG__printName(clang::Decl *D)
EComplexType GetComplexType(const char *)
void GetObject(const char *namecycle, T *&ptr)
virtual const char * TypedefInfo_Name(TypedefInfo_t *tinfo) const
virtual void CallFunc_SetArg(CallFunc_t *func, Long_t param) const
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
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...
virtual DeclId_t GetDataMemberWithValue(const void *ptrvalue) const
NOT IMPLEMENTED.
virtual Bool_t IsCmdThread()
const char * Name() const
void PrintIntro()
No-op; see TRint instead.
const clang::ValueDecl * GetDataMember(const char *name) const
virtual const char * DataMemberInfo_TypeTrueName(DataMemberInfo_t *dminfo) const
R__EXTERN TVirtualMutex * gGlobalMutex
virtual bool ClassInfo_IsBase(ClassInfo_t *info, const char *name) const
virtual TypedefInfo_t * TypedefInfo_Factory() const
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
Read and parse the resource file for a certain level.
const Decl * TCling__GetObjectDecl(TObject *obj)
R__EXTERN TROOT * gROOTLocal
void UpdateListOfTypes()
No op: see TClingCallbacks (used to update the list of types)
virtual TObject * FindObject(const TObject *obj) const
Find object using its hash value (returned by its Hash() member).
const char * TmpltName() 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 TList * GetListOfMethodArgs()
Returns methodarg list and additionally updates fDataMember in TMethod by calling FindDataMember();...
virtual Bool_t LoadText(const char *text) const
Load the declarations from text into the interpreter.
void Init(const char *name)
virtual int BaseClassInfo_Next(BaseClassInfo_t *bcinfo) const
void function(const char *name_, T fun, const char *docstring=0)
bool TCling__TEST_isInvalidDecl(clang::Decl *D)
std::vector< void * > fRegisterModuleDyLibs
TFunctionTemplate * Get(DeclId_t id)
Return (after creating it if necessary) the TMethod or TFunction describing the function correspondin...
Int_t AutoParse(const char *cls)
Parse the headers relative to the class Returns 1 in case of success, 0 in case of failure...
void TCling__SplitAclicMode(const char *fileName, string &mode, string &args, string &io, string &fname)
void DeleteArray(void *arena, bool dtorOnly, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Emulation of the CINT BaseClassInfo class.
void FullName(std::string &output, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
virtual bool MethodInfo_IsValid(MethodInfo_t *minfo) const
Double_t length(const TVector2 &v)
virtual TypeInfo_t * TypeInfo_FactoryCopy(TypeInfo_t *) const
TClingMethodInfo * FactoryMethod() const
R__EXTERN TSystem * gSystem
virtual const char * MethodInfo_GetPrototype(MethodInfo_t *minfo) const
virtual const char * GetTopLevelMacroName() const
Return the file name of the current un-included interpreted file.
int GetMethodNArg(const char *method, const char *proto, Bool_t objectIsConst, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
virtual MethodArgInfo_t * MethodArgInfo_Factory() const
Basic data type descriptor (datatype information is obtained from CINT).
void SetFuncProto(const TClingClassInfo *info, const char *method, const char *proto, long *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
std::set< TClass * > & GetModTClasses()
THashList * GetTable() const
virtual void CallFunc_SetFunc(CallFunc_t *func, ClassInfo_t *info, const char *method, const char *params, Long_t *Offset) const
virtual CallFunc_t * CallFunc_FactoryCopy(CallFunc_t *func) const
virtual const char * BaseClassInfo_TmpltName(BaseClassInfo_t *bcinfo) const
const char * TypeName() const
virtual Long_t ClassInfo_ClassProperty(ClassInfo_t *info) const
static void UpdateAllCanvases()
Update all canvases at end the terminal input command.
virtual const char * MethodInfo_GetMangledName(MethodInfo_t *minfo) const
virtual void * FindSym(const char *entry) const
Interface to cling function.
const char * GetName() const
Returns name of object.
virtual int MethodInfo_NArg(MethodInfo_t *minfo) const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
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 TEnvRec * Lookup(const char *n)
Loop over all resource records and return the one with name.
virtual const char * GetSTLIncludePath() const
Return the directory containing CINT's stl cintdlls.
TObject * Remove(TObject *obj)
Remove object from the list.
virtual Int_t AutoParse(const char *cls)=0
Collection abstract base class.
Bool_t SetErrorMessages(Bool_t enable=kTRUE)
If error messages are disabled, the interpreter should suppress its failures and warning messages fro...
int TCling__AutoParseCallback(const char *className)
void SaveGlobalsContext()
Save the current Cling state of global objects.
void UpdateClassInfoWithDecl(const void *vTD)
Internal function. Inform a TClass about its new TagDecl or NamespaceDecl.
TDictionary::DeclId_t GetDeclId() const
TDictionary::DeclId_t GetDeclId() const
virtual Bool_t IsValid()
Return true if this global object is pointing to a currently loaded global.
virtual Long_t BaseClassInfo_Offset(BaseClassInfo_t *toBaseClassInfo, void *address, bool isDerivedObject) const
Int_t GetEntriesFast() const
std::string NormalizedName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Return the normalized name of the type (i.e.
void UpdateListOfLoadedSharedLibraries()
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
Int_t Size() const
Return size of object of this class.
virtual Long_t ClassInfo_GetBaseOffset(ClassInfo_t *fromDerived, ClassInfo_t *toBase, void *address, bool isDerivedObject) const
Long_t Calc(const char *line, EErrorCode *error=0)
Directly execute an executable statement (e.g.
Int_t RescanLibraryMap()
Scan again along the dynamic path for library maps.
The TEnumConstant class implements the constants of the enum type.
virtual MethodInfo_t * MethodInfo_Factory() const
The ROOT global object gROOT contains a list of all defined classes.
virtual Long_t FuncTempInfo_Property(FuncTempInfo_t *) const
Return the property of the function template.
ROOT::ESTLType GetCollectionType() const
Return the 'type' of the STL the TClass is representing.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Global variables class (global variables are obtained from CINT).
void * LazyFunctionCreatorAutoload(const std::string &mangled_name)
Autoload a library based on a missing symbol.
Long_t ExecuteMacro(const char *filename, EErrorCode *error=0)
Execute a cling macro.
virtual void Initialize()
Initialize the interpreter, once TROOT::fInterpreter is set.
Bool_t CheckClassTemplate(const char *name)
Return true if there is a class template by the given name ...
static void indent(ostringstream &buf, int indent_level)
virtual const char * ClassInfo_TmpltName(ClassInfo_t *info) const
virtual const char * Getp2f2funcname(void *receiver) const
Long_t Property() const
Set TObject::fBits and fStreamerType to cache information about the class.
virtual void FreeDirectory(void *dirp)
Free a directory.
TObject * TCling__GetObjectAddress(const char *Name, void *&LookupCtx)
virtual int ClassInfo_Size(ClassInfo_t *info) const
virtual bool TypedefInfo_IsValid(TypedefInfo_t *tinfo) const
Each class (see TClass) has a linked list of its base class(es).
void EnableAutoLoading()
Enable the automatic loading of shared libraries when a class is used that is stored in a not yet loa...
Type
enumeration specifying the integration types.
R__DLLEXPORT void DestroyInterpreter(TInterpreter *interp)
virtual void UpdateEnumConstants(TEnum *enumObj, TClass *cl) const
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...
bool IsAutoloadingEnabled()
TDictionary::DeclId_t DeclId_t
virtual Long_t GetExecByteCode() const
This routines used to return the address of the internal wrapper function (of the interpreter) that w...
#define R__LOCKGUARD2(mutex)
virtual int LoadFile(const char *path) const
Load a source file or library called path into the interpreter.
std::unordered_set< const clang::NamespaceDecl * > fNSFromRootmaps
void TCling__GetNormalizedContext(const ROOT::TMetaUtils::TNormalizedCtxt *&normCtxt)
void UpdateListOfDataMembers(TClass *cl) const
Update the list of pointers to data members for TClass cl This is now a nop.
virtual const char * FindDynamicLibrary(TString &lib, Bool_t quiet=kFALSE)
Find a dynamic library using the system search paths.
void EndOfLineAction()
It calls a "fantom" method to synchronize user keyboard input and ROOT prompt line.
virtual int MethodArgInfo_Next(MethodArgInfo_t *marginfo) const
TString & Remove(Ssiz_t pos)
void SetClassInfo(TClass *cl, Bool_t reload=kFALSE)
Set pointer to the TClingClassInfo in TClass.
virtual void FuncTempInfo_Title(FuncTempInfo_t *, TString &name) const
Return the comments associates with this function template.
Emulation of the CINT TypedefInfo class.
void * New(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
virtual void LoadFunctionTemplates(TClass *cl) const
Create list of pointers to function templates for TClass cl.
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
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.
Version_t GetClassVersion() const
int(* AutoLoadCallBack_t)(const char *)
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
virtual const char * GetIncludePath()
Get the list of include path.
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)
TInterpreterValue * CreateTemporary()
The created temporary must be deleted by the caller.
void CreateListOfDataMembers(TClass *cl) const
Create list of pointers to data members for TClass cl.
void UpdateListsOnUnloaded(const cling::Transaction &T)
virtual const char * DataMemberInfo_ValidArrayIndex(DataMemberInfo_t *dminfo) const
TObjArray * fStreamerInfo
void CreateListOfMethods(TClass *cl) const
Create list of pointers to methods for TClass cl.
virtual const char * BaseClassInfo_Name(BaseClassInfo_t *bcinfo) const
std::set< size_t > fLookedUpClasses
virtual void TypedefInfo_Delete(TypedefInfo_t *tinfo) const
MyComplex< T > P(MyComplex< T > z, T c_real, T c_imag)
[MyComplex]
bool IsValidMethod(const char *method, const char *proto, Bool_t objectIsConst, long *offset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
TClingClassInfo * GetBase() const
void UnloadClassMembers(TClass *cl, const clang::DeclContext *DC)
Helper function to go through the members of a class or namespace and unload them.
virtual const void * GetValAddr() const =0
EState fState
cached of the streaming method to use
void TCling__LibraryLoadedRTTI(const void *dyLibHandle, const char *canonicalName)
Emulation of the CINT MethodInfo class.
virtual void SetRTLD_NOW() const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
bool IsValid() const
Return true if the current iterator position is valid.
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
virtual int MethodInfo_Next(MethodInfo_t *minfo) const
static DictFuncPtr_t GetDict(const char *cname)
Given the class name returns the Dictionary() function of a class (uses hash of name).
void Unload()
Mark 'all func' as being unloaded.
virtual int ClassInfo_GetMethodNArg(ClassInfo_t *info, const char *method, const char *proto, Bool_t objectIsConst=false, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
void RegisterTClassUpdate(TClass *oldcl, DictFuncPtr_t dict)
Register classes that already existed prior to their dictionary loading and that already had a ClassI...
Bool_t IsAutoLoadNamespaceCandidate(const char *name)
TDictionary::DeclId_t DeclId_t
void ResetGlobalVar(void *obj)
Reset the Cling 'user' global objects/variables state to the state saved by the last call to TCling::...
unsigned long long ULong64_t
virtual CallFuncIFacePtr_t CallFunc_IFacePtr(CallFunc_t *func) 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...
const char * GetParent() const
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
void Reset()
Pressing Ctrl+C should forward here.
Int_t LoadLibraryMap(const char *rootmapfile=0)
Load map between class and library.
TObjArray * fRootmapFiles
double func(double *x, double *p)
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
std::set< const char * > fParsedPayloadsAddresses
ROOT::TMetaUtils::TClingLookupHelper * fLookupHelper
virtual void CallFunc_SetArgs(CallFunc_t *func, const char *param) const
TClingCallbacks * fClingCallbacks
Int_t AutoLoad(const char *classname, Bool_t knowDictNotLoaded=kFALSE)
Load library containing the specified class.
EObjectPointerState GetObjectValidity() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Emulation of the CINT ClassInfo class.
virtual ~TROOT()
Clean up and free resources used by ROOT (files, network sockets, shared memory segments, etc.).
#define R__LOCKGUARD(mutex)
void InspectMember(const T &obj, const char *name, Bool_t isTransient)
virtual void Add(TObject *obj)=0
void SetGetline(const char *(*getlineFunc)(const char *prompt), void(*histaddFunc)(const char *line))
Set a getline function to call when input is needed.
virtual void CallFunc_IgnoreExtraArgs(CallFunc_t *func, bool ignore) const
virtual EReturnType MethodCallReturnType(TFunction *func) const
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.
ptrdiff_t Offset(void *address=0, bool isDerivedObject=true) const
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)
Inject the module named "modulename" into cling; load all headers.
virtual bool ClassInfo_IsEnum(const char *name) const
virtual bool Update(DataMemberInfo_t *info)
Update the TFunction to reflect the new info.
Int_t ReloadAllSharedLibraryMaps()
Reload the library map entries coming from all the loaded shared libraries, after first unloading the...
void GetFunctionOverloads(ClassInfo_t *cl, const char *funcname, std::vector< DeclId_t > &res) const
Insert overloads of name in cl to res.
static TClass * LoadClass(const char *requestedname, Bool_t silent)
Helper function used by TClass::GetClass().
Bool_t IsPersistent() const
void HandleNewDecl(const void *DV, bool isDeserialized, std::set< TClass *> &modifiedClasses)
void RecursiveRemove(TObject *obj)
Delete object from cling symbol table so it can not be used anymore.
void UnRegisterTClassUpdate(const TClass *oldcl)
If the dictionary is loaded, we can remove the class from the list (otherwise the class might be load...
Mother of all ROOT objects.
void TCling__LibraryUnloadedRTTI(const void *dyLibHandle, const char *canonicalName)
void RegisterTemporary(const TInterpreterValue &value)
virtual FuncTempInfo_t * FuncTempInfo_FactoryCopy(FuncTempInfo_t *) const
Construct a FuncTempInfo_t.
virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr)
virtual const char * GetCurrentMacroName() const
Return the file name of the currently interpreted file, included or not.
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 (...
virtual const char * MethodArgInfo_Name(MethodArgInfo_t *marginfo) const
TClassRef is used to implement a permanent reference to a TClass object.
virtual const char * GetTitle() const
Returns title of object.
typedef void((*Func_t)())
void Unload()
Mark 'all func' as being unloaded.
const char * GetFullTypeName() const
Get full type description of typedef, e,g.: "class TDirectory*".
const char * GetDefault() const
Get default value of method argument.
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
void SetAutoloadingEnabled(bool val=true)
virtual int DataMemberInfo_Next(DataMemberInfo_t *dminfo) const
Bridge between cling::Value and ROOT.
virtual void TypeInfo_Init(TypeInfo_t *tinfo, const char *funcname) const
void AddFriendToClass(clang::FunctionDecl *, clang::CXXRecordDecl *) const
Inject function as a friend into klass.
virtual bool ClassInfo_IsValidMethod(ClassInfo_t *info, const char *method, const char *proto, Long_t *offset, ROOT::EFunctionMatchMode=ROOT::kConversionMatch) const
const char * GetUnqualifiedName(const char *name)
Return the start of the unqualified name include in 'original'.
void Unload()
Mark 'all func' as being unloaded.
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
TDictionary::DeclId_t DeclId_t
virtual void Add(TObject *obj)
virtual void ClassInfo_DeleteArray(ClassInfo_t *info, void *arena, bool dtorOnly) const
virtual const char * MethodInfo_Title(MethodInfo_t *minfo) const
virtual std::string MethodArgInfo_TypeNormalizedName(MethodArgInfo_t *marginfo) const
virtual TList * GetListOfKeys() const
Bool_t fHeaderParsingOnDemand
virtual int ClassInfo_Next(ClassInfo_t *info) const
virtual void CallFunc_Init(CallFunc_t *func) const
virtual void * ClassInfo_New(ClassInfo_t *info) const
const char * Name() const
Each ROOT class (see TClass) has a linked list of methods.
std::vector< std::pair< TClass *, DictFuncPtr_t > > fClassesToUpdate
virtual Long_t DataMemberInfo_TypeProperty(DataMemberInfo_t *dminfo) const
virtual void CallFunc_ExecWithArgsAndReturn(CallFunc_t *func, void *address, const void *args[]=0, int nargs=0, void *ret=0) const
static void * fgSetOfSpecials
virtual int GetProcInfo(ProcInfo_t *info) const
Returns cpu and memory used by this process into the ProcInfo_t structure.
TDictionary * Find(DeclId_t id) const
Return (after creating it if necessary) the TDataMember describing the data member corresponding to t...
virtual EReturnType MethodInfo_MethodCallReturnType(MethodInfo_t *minfo) const
void Destruct(void *arena, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
const char * Name() const
static void SetFactory(TVirtualStreamerInfo *factory)
static function: Set the StreamerInfo factory
long ExecInt(void *address)
virtual Long_t Getgvp() const
Interface to the CINT global object pointer which was controlling the behavior of the wrapper around ...
virtual void SetRTLD_LAZY() const
Int_t SetClassSharedLibs(const char *cls, const char *libs)
Register the autoloading information for a class.
Int_t GetEntries() const
Return the number of objects in array (i.e.
virtual UInt_t FuncTempInfo_TemplateNargs(FuncTempInfo_t *) const
Return the maximum number of template arguments of the function template described by ft_info...
virtual void GetFunctionName(const clang::FunctionDecl *decl, std::string &name) const
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual void MethodInfo_Delete(MethodInfo_t *minfo) const
Interface to cling function.
TClingTypeInfo * Type() const
Bool_t SetSuspendAutoParsing(Bool_t value)
Suspend the Autoparsing of headers.
virtual void CallFunc_Exec(CallFunc_t *func, void *address) const
virtual void ClassInfo_Destruct(ClassInfo_t *info, void *arena) const
static bool R__InitStreamerInfoFactory()
Helper to initialize TVirtualStreamerInfo's factor early.
virtual void CallFunc_Delete(CallFunc_t *func) const
void IgnoreExtraArgs(bool ignore)
virtual int TypedefInfo_Size(TypedefInfo_t *tinfo) const
Bool_t fIsAutoParsingSuspended
TDataMember * GetDataMember(const char *datamember) const
Return pointer to datamember object with name "datamember".
static void UpdateClassInfoWork(const char *name)
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.
virtual void SetAlloclockfunc(void(*)()) const
[Place holder for Mutex Lock] Provide the interpreter with a way to acquire a lock used to protect cr...
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
bool TClingLookupHelper__AutoParse(const char *cname)
Allow calling autoparsing from TMetaUtils.
void FullName(std::string &output, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
std::hash< std::string > fStringHashFunction
virtual const char * ClassInfo_Name(ClassInfo_t *info) const
const char * GetSharedLibs()
Return the list of shared libraries loaded into the process.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
static const char * FindLibraryName(void(*func)())
Wrapper around dladdr (and friends)
R__EXTERN TInterpreter * gCling
R__DLLEXPORT TInterpreter * CreateInterpreter(void *interpLibHandle)
virtual void Compress()
Remove empty slots from array.
virtual bool CallFunc_IsValid(CallFunc_t *func) const
Long_t ProcessLineAsynch(const char *line, EErrorCode *error=0)
Let cling process a command line asynch.
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...
static void output(int code)
void TCling__TransactionRollback(const cling::Transaction &T)
virtual void FuncTempInfo_Name(FuncTempInfo_t *, TString &name) const
Return the name of this function template.
virtual const char * MethodInfo_TypeName(MethodInfo_t *minfo) const
const char * Name() const
TList * GetListOfMethods(Bool_t load=kTRUE)
Return list containing the TMethods of a class.
virtual int DisplayIncludePath(FILE *fout) const
Interface to cling function.
virtual const char * ClassInfo_FileName(ClassInfo_t *info) const
void Unload()
Mark 'all func' as being unloaded.
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
void LoadMacro(const char *filename, EErrorCode *error=0)
Load a macro file in cling's memory.
static DictFuncPtr_t GetDictNorm(const char *cname)
Given the normalized class name returns the Dictionary() function of a class (uses hash of name)...
const char * TypeName(const char *typeDesc)
Return the absolute type of typeDesc.
virtual MethodInfo_t * CallFunc_FactoryMethod(CallFunc_t *func) const
static char * skip(char **buf, const char *delimiters)
void LibraryUnloaded(const void *dyLibHandle, const char *canonicalName)
const char * Name(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
void RewindDictionary()
Rewind Cling dictionary to the point where it was before executing the current macro.
virtual CallFunc_t * CallFunc_Factory() const
void AddIncludePath(const char *path)
Add the given path to the list of directories in which the interpreter looks for include files...
Int_t DeleteGlobal(void *obj)
Delete obj from Cling symbol table so it cannot be accessed anymore.
TEnum * Find(DeclId_t id) const
Return the TEnum corresponding to the Decl 'id' or NULL if it does not exist.
void ResetGlobals()
Reset in Cling the list of global variables to the state saved by the last call to TCling::SaveGlobal...
virtual int TypeInfo_RefType(TypeInfo_t *) const
virtual void CallFunc_ExecWithReturn(CallFunc_t *func, void *address, void *ret) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void ExecWithArgsAndReturn(void *address, const void *args[]=0, int nargs=0, void *ret=0)
if(line.BeginsWith("/*"))
const clang::Type * GetType() const
void CreateListOfMethodArgs(TFunction *m) const
Create list of pointers to method arguments for TMethod m.
virtual void Setgvp(Long_t) const
Interface to the cling global object pointer which was controlling the behavior of the wrapper around...
void ExecWithReturn(void *address, void *ret=0)
virtual void ClassInfo_Delete(ClassInfo_t *info) const
long TypeProperty() const
std::map< size_t, std::vector< const char * > > fClassesHeadersMap
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.
const char * Data() const
virtual void DataMemberInfo_Delete(DataMemberInfo_t *dminfo) const
TList * GetListOfFunctionTemplates(Bool_t load=kTRUE)
Return list containing the TEnums of a class.
virtual const char * GetClassSharedLibs(const char *cls)=0
TClingMethodInfo GetMethodWithArgs(const char *fname, const char *arglist, long *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch, EInheritanceMode imode=kWithInheritance) const
long long ExecInt64(void *address)