59 #include "RConfigure.h" 60 #include "compiledata.h" 74 #include "clang/AST/ASTContext.h" 75 #include "clang/AST/Decl.h" 76 #include "clang/AST/DeclarationName.h" 77 #include "clang/AST/GlobalDecl.h" 78 #include "clang/AST/RecordLayout.h" 79 #include "clang/AST/RecursiveASTVisitor.h" 80 #include "clang/AST/Type.h" 81 #include "clang/Basic/SourceLocation.h" 82 #include "clang/Basic/Specifiers.h" 83 #include "clang/Basic/TargetInfo.h" 84 #include "clang/CodeGen/ModuleBuilder.h" 85 #include "clang/Frontend/CompilerInstance.h" 86 #include "clang/Frontend/FrontendDiagnostic.h" 87 #include "clang/Lex/HeaderSearch.h" 88 #include "clang/Lex/Preprocessor.h" 89 #include "clang/Sema/Lookup.h" 90 #include "clang/Sema/Sema.h" 91 #include "clang/Parse/Parser.h" 93 #include "cling/Interpreter/ClangInternalState.h" 94 #include "cling/Interpreter/DynamicLibraryManager.h" 95 #include "cling/Interpreter/Interpreter.h" 96 #include "cling/Interpreter/LookupHelper.h" 97 #include "cling/Interpreter/Value.h" 98 #include "cling/Interpreter/Transaction.h" 99 #include "cling/MetaProcessor/MetaProcessor.h" 100 #include "cling/Utils/AST.h" 102 #include "llvm/IR/GlobalValue.h" 103 #include "llvm/IR/Module.h" 105 #include "llvm/Support/DynamicLibrary.h" 106 #include "llvm/Support/raw_ostream.h" 107 #include "llvm/Support/Path.h" 120 #include <unordered_map> 133 #include <mach-o/dyld.h> 140 #if defined(__CYGWIN__) 141 #include <sys/cygwin.h> 142 #define HMODULE void * 144 __declspec(dllimport)
void * __stdcall GetCurrentProcess();
145 __declspec(dllimport)
bool __stdcall EnumProcessModules(
void *,
void **,
unsigned long,
unsigned long *);
146 __declspec(dllimport)
unsigned long __stdcall GetModuleFileNameExW(
void *,
void *,
wchar_t *,
unsigned long);
151 #if defined(_MSC_VER) 153 # define STDIN_FILENO 0 155 #ifndef STDOUT_FILENO 156 # define STDOUT_FILENO 1 158 #ifndef STDERR_FILENO 159 # define STDERR_FILENO 2 168 #undef GetModuleFileName 169 #define RTLD_DEFAULT ((void *)::GetModuleHandle(NULL)) 170 #define dlsym(library, function_name) ::GetProcAddress((HMODULE)library, function_name) 171 #define dlopen(library_name, flags) ::LoadLibrary(library_name) 172 #define dlclose(library) ::FreeLibrary((HMODULE)library) 173 #define R__DLLEXPORT __declspec(dllexport) 181 class TCling_UnloadMarker {
183 ~TCling_UnloadMarker() {
189 static TCling_UnloadMarker gTClingUnloadMarker;
198 return D->getDeclContext();
201 return llvm::dyn_cast<clang::NamespaceDecl>(DC);
204 return llvm::dyn_cast<clang::RecordDecl>(DC);
207 return DC->dumpDeclContext();
216 return ((clang::Decl*)D)->dump();
219 if (clang::NamedDecl* ND = llvm::dyn_cast<clang::NamedDecl>(D)) {
222 llvm::raw_string_ostream OS(name);
223 ND->getNameForDiagnostic(OS, D->getASTContext().getPrintingPolicy(),
226 printf(
"%s\n", name.c_str());
234 return D->isInvalidDecl();
239 return info->
GetDecl()->isInvalidDecl();
243 using namespace clang;
244 using namespace ROOT;
247 static const std::string gInterpreterClassDef = R
"ICF( 249 #define ClassDef(name, id) \ 250 _ClassDefInterp_(name,id,virtual,) \ 251 static int DeclFileLine() { return __LINE__; } 253 #define ClassDefNV(name, id) \ 254 _ClassDefInterp_(name,id,,) \ 255 static int DeclFileLine() { return __LINE__; } 256 #undef ClassDefOverride 257 #define ClassDefOverride(name, id) \ 258 _ClassDefInterp_(name,id,,override) \ 259 static int DeclFileLine() { return __LINE__; } 262 static const std::string gNonInterpreterClassDef = R
"ICF( 263 #define __ROOTCLING__ 1 265 #define ClassDef(name,id) \ 266 _ClassDef_(name,id,virtual,) \ 267 static int DeclFileLine() { return __LINE__; } 269 #define ClassDefNV(name, id)\ 270 _ClassDef_(name,id,,)\ 271 static int DeclFileLine() { return __LINE__; } 272 #undef ClassDefOverride 273 #define ClassDefOverride(name, id)\ 274 _ClassDef_(name,id,,override)\ 275 static int DeclFileLine() { return __LINE__; } 279 static const std::string gClassDefInterpMacro = R
"ICF( 284 #define _ClassDefInterp_(name,id,virtual_keyword, overrd) \ 287 static TClass *Class() { static TClass* sIsA = 0; if (!sIsA) sIsA = TClass::GetClass(#name); return sIsA; } \ 288 static const char *Class_Name() { return #name; } \ 289 static Version_t Class_Version() { return id; } \ 290 static TClass *Dictionary() { return 0; } \ 291 virtual_keyword TClass *IsA() const overrd { return name::Class(); } \ 292 virtual_keyword void ShowMembers(TMemberInspector&insp) const overrd { ::ROOT::Class_ShowMembers(name::Class(), this, insp); } \ 293 virtual_keyword void Streamer(TBuffer&) overrd { ::Error("Streamer", "Cannot stream interpreted class."); } \ 294 void StreamerNVirtual(TBuffer&ClassDef_StreamerNVirtual_b) { name::Streamer(ClassDef_StreamerNVirtual_b); } \ 295 static const char *DeclFileName() { return __FILE__; } \ 296 static int ImplFileLine() { return 0; } \ 297 static const char *ImplFileName() { return __FILE__; } 308 class EnumVisitor :
public RecursiveASTVisitor<EnumVisitor> {
310 llvm::SmallVector<EnumDecl*,128> &fClassEnums;
312 EnumVisitor(llvm::SmallVector<EnumDecl*,128> &enums) : fClassEnums(enums)
315 bool TraverseStmt(Stmt*) {
320 bool shouldVisitTemplateInstantiations()
const {
return true; }
322 bool TraverseClassTemplateDecl(ClassTemplateDecl*) {
327 bool TraverseClassTemplatePartialSpecializationDecl(ClassTemplatePartialSpecializationDecl*) {
332 bool VisitEnumDecl(EnumDecl *TEnumD) {
333 if (!TEnumD->getDeclContext()->isDependentContext())
334 fClassEnums.push_back(TEnumD);
345 static vector<const NamedDecl*> updateList;
348 if (entered) topLevel =
kFALSE;
363 updateList.push_back(TD);
366 while (!updateList.empty()) {
368 updateList.pop_back();
375 const clang::Decl* D =
static_cast<const clang::Decl*
>(enumObj->
GetDeclId());
376 if(
const clang::EnumDecl* ED = dyn_cast<clang::EnumDecl>(D)) {
378 for (EnumDecl::enumerator_iterator EDI = ED->enumerator_begin(),
379 EDE = ED->enumerator_end(); EDI != EDE; ++EDI) {
381 std::string constbuf;
382 if (
const NamedDecl* END = llvm::dyn_cast<NamedDecl>(*EDI)) {
383 PrintingPolicy Policy((*EDI)->getASTContext().getPrintingPolicy());
384 llvm::raw_string_ostream stream(constbuf);
385 (END)->getNameForDiagnostic(stream, Policy,
false);
387 const char* constantName = constbuf.c_str();
391 const llvm::APSInt valAPSInt = (*EDI)->getInitVal();
392 if (valAPSInt.isSigned()) {
393 value = valAPSInt.getSExtValue();
395 value = valAPSInt.getZExtValue();
402 DataMemberInfo_t* dmInfo = (DataMemberInfo_t*) tcDmInfo;
406 enumConstant =
new TEnumConstant(dmInfo, constantName, value, enumObj);
413 globals->
Add(enumConstant);
426 const clang::Decl* D =
static_cast<const clang::Decl*
>(VD);
428 if (
const EnumDecl* ED = llvm::dyn_cast<EnumDecl>(D)) {
430 PrintingPolicy Policy(ED->getASTContext().getPrintingPolicy());
431 llvm::raw_string_ostream stream(buf);
432 ED->getNameForDiagnostic(stream, Policy,
false);
438 const char*
name = buf.c_str();
440 enumType =
new TEnum(name, VD, cl);
442 enumType =
new TEnum(name, VD, cl);
444 UpdateEnumConstants(enumType, cl);
453 const clang::Decl* D =
static_cast<const clang::Decl*
>(DV);
455 if (!D->isCanonicalDecl() && !isa<clang::NamespaceDecl>(D)
456 && !dyn_cast<clang::RecordDecl>(D))
return;
458 if (isa<clang::FunctionDecl>(D->getDeclContext())
459 || isa<clang::TagDecl>(D->getDeclContext()))
463 if (
const clang::CXXRecordDecl* RD = dyn_cast<clang::CXXRecordDecl>(D)) {
464 if (RD->getDescribedClassTemplate())
466 }
else if (
const clang::FunctionDecl* FD = dyn_cast<clang::FunctionDecl>(D)) {
467 if (FD->getDescribedFunctionTemplate())
471 if (
const RecordDecl *TD = dyn_cast<RecordDecl>(D)) {
472 if (TD->isCanonicalDecl() || TD->isThisDeclarationADefinition())
475 else if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
477 if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
481 }
else if (
const NamespaceDecl* NSD = dyn_cast<NamespaceDecl>(D)) {
489 if (
const NamespaceDecl* NCtx = dyn_cast<NamespaceDecl>(ND->getDeclContext())) {
490 if (NCtx->getIdentifier()) {
493 std::string NCtxName;
494 PrintingPolicy Policy(NCtx->getASTContext().getPrintingPolicy());
495 llvm::raw_string_ostream stream(NCtxName);
496 NCtx->getNameForDiagnostic(stream, Policy,
true);
500 modifiedTClasses.insert(cl);
507 if (!isa<TranslationUnitDecl>(ND->getDeclContext()))
511 if (isa<EnumDecl>(ND))
516 if (!(isa<VarDecl>(ND)))
520 if (
gROOT->GetListOfGlobals()->FindObject(ND->getNameAsString().c_str()))
524 gROOT->GetListOfGlobals()->Add(
new TGlobal((DataMemberInfo_t *)
526 cast<ValueDecl>(ND), 0)));
553 const char* canonicalName) {
555 ((
TCling*)
gCling)->LibraryLoaded(dyLibHandle, canonicalName);
559 const char* canonicalName) {
561 ((
TCling*)
gCling)->LibraryUnloaded(dyLibHandle, canonicalName);
567 return ((
TCling*)
gCling)->GetObjectAddress(Name, LookupCtx);
576 cling::DynamicLibraryManager::ExposeHiddenSharedLibrarySymbols(interpLibHandle);
577 return new TCling(
"C++",
"cling C++ Interpreter");
599 return ((
TCling*)
gCling)->GetClassSharedLibs(className);
611 return ((
TCling*)
gCling)->IsAutoLoadNamespaceCandidate(nsDecl);
616 string file(fileName);
622 string &args,
string &io,
string &fname)
624 string file(fileName);
625 TString f, amode, arguments, aclicio;
627 mode = amode.
Data(); args = arguments.Data();
628 io = aclicio.
Data(); fname = f.
Data();
638 char *__unDName(
char *demangled,
const char *mangled,
int out_len,
639 void * (* pAlloc )(
size_t),
void (* pFree )(
void *),
640 unsigned short int flags);
652 using namespace clang;
653 if (NamespaceDecl* nsd = llvm::dyn_cast<NamespaceDecl>(decl)){
657 if (ClassTemplateDecl* ctd = llvm::dyn_cast<ClassTemplateDecl>(decl)){
669 return ((
TCling*)
gCling)->LazyFunctionCreatorAutoload(mangled_name);
678 const std::vector<std::string> &headers,
679 const std::vector<std::string> &fwdDecls,
680 const std::vector<std::string> &unknown)
686 if (classes.empty()) {
690 const std::string& className = classes[0];
692 TString fileName =
"AutoDict_";
693 std::string::const_iterator sIt;
694 for (sIt = className.begin(); sIt != className.end(); sIt++) {
695 if (*sIt ==
'<' || *sIt ==
'>' ||
696 *sIt ==
' ' || *sIt ==
'*' ||
697 *sIt ==
',' || *sIt ==
'&' ||
705 if (classes.size() > 1) {
707 std::vector<std::string>::const_iterator it = classes.begin();
708 while ((++it) != classes.end()) {
709 for (
UInt_t cursor = 0; cursor != it->length(); ++cursor) {
710 chk = chk * 3 + it->at(cursor);
723 static const std::set<std::string> sSTLTypes {
"vector",
"list",
"unordered_list",
"deque",
"map",
"multimap",
"set",
"unordered_set",
"multiset",
"queue",
"priority_queue",
"stack",
"iterator"};
724 std::vector<std::string>::const_iterator it;
725 std::string fileContent(
"");
726 for (it = headers.begin(); it != headers.end(); ++it) {
727 fileContent +=
"#include \"" + *it +
"\"\n";
729 for (it = unknown.begin(); it != unknown.end(); ++it) {
735 while (dirbase.Length() && dirbase !=
"." 736 && dirbase !=
"include" && dirbase !=
"inc" 737 && dirbase !=
"prec_stl") {
741 fileContent +=
TString(
"#include \"") + header +
"\"\n";
744 for (it = fwdDecls.begin(); it != fwdDecls.end(); ++it) {
745 fileContent +=
"class " + *it +
";\n";
747 fileContent +=
"#ifdef __CINT__ \n";
748 fileContent +=
"#pragma link C++ nestedclasses;\n";
749 fileContent +=
"#pragma link C++ nestedtypedefs;\n";
750 for (it = classes.begin(); it != classes.end(); ++it) {
752 size_t posTemplate = n.find(
'<');
753 std::set<std::string>::const_iterator iSTLType = sSTLTypes.end();
754 if (posTemplate != std::string::npos) {
755 n.erase(posTemplate, std::string::npos);
756 if (n.compare(0, 5,
"std::") == 0) {
759 iSTLType = sSTLTypes.find(n);
761 fileContent +=
"#pragma link C++ class ";
762 fileContent += *it +
"+;\n" ;
763 fileContent +=
"#pragma link C++ class ";
764 if (iSTLType != sSTLTypes.end()) {
768 fileContent += *it +
"::*;\n" ;
773 fileContent += *it +
"::*+;\n" ;
775 std::string oprLink(
"#pragma link C++ operators ");
779 if (iSTLType != sSTLTypes.end()) {
781 fileContent +=
"#ifdef G__VECTOR_HAS_CLASS_ITERATOR\n";
783 fileContent += oprLink +
"::iterator;\n";
784 fileContent += oprLink +
"::const_iterator;\n";
785 fileContent += oprLink +
"::reverse_iterator;\n";
787 fileContent +=
"#endif\n";
791 fileContent +=
"#endif\n";
795 filePointer = fopen(fileName,
"w");
796 if (filePointer ==
NULL) {
802 fprintf(filePointer,
"%s", fileContent.c_str());
818 const std::vector<std::string> &headers,
819 const std::vector<std::string> &fwdDecls,
820 const std::vector<std::string> &unknown)
826 std::vector<std::string> classes;
827 classes.push_back(className);
855 void exceptionErrorHandler(
void * ,
856 const std::string& reason,
858 throw std::runtime_error(std::string(
">>> Interpreter compilation error:\n") + reason);
872 class clangDiagSuppr {
874 clangDiagSuppr(clang::DiagnosticsEngine& diag): fDiagEngine(diag){
875 fOldDiagValue = fDiagEngine.getIgnoreAllWarnings();
876 fDiagEngine.setIgnoreAllWarnings(
true);
880 fDiagEngine.setIgnoreAllWarnings(fOldDiagValue);
883 clang::DiagnosticsEngine& fDiagEngine;
905 unsigned long offset = 0;
906 if (strncmp(tname.c_str(),
"const ", 6) == 0) {
909 unsigned long end = tname.length();
910 while( end && (tname[end-1]==
'&' || tname[end-1]==
'*' || tname[end-1]==
']') ) {
911 if ( tname[end-1]==
']' ) {
913 while ( end && tname[end-1]!=
'[' ) --end;
917 std::string innerbuf;
919 if (end != tname.length()) {
920 innerbuf = tname.substr(offset,end-offset);
921 inner = innerbuf.c_str();
923 inner = tname.c_str()+offset;
927 if (
gROOT->GetListOfClasses()->FindObject(inner)
939 newname =
"Long64_t";
941 newname =
"ULong64_t";
943 if (strcmp(inner,newname) == 0) {
946 if (offset) result =
"const ";
948 if ( end != tname.length() ) {
949 result += tname.substr(end,tname.length()-end);
951 if (result == tname) result.clear();
957 if (lastPos != inner)
961 const auto enName = lastPos;
962 const auto scopeNameSize = ((
Long64_t)lastPos - (
Long64_t)inner) /
sizeof(decltype(*lastPos)) - 2;
964 char *scopeName =
new char[scopeNameSize + 1];
966 char scopeName[scopeNameSize + 1];
968 strncpy(scopeName, inner, scopeNameSize);
969 scopeName[scopeNameSize] =
'\0';
971 if (
auto scope = static_cast<TClass *>(
gROOT->GetListOfClasses()->FindObject(scopeName))) {
972 auto enumTable =
dynamic_cast<const THashList *
>(scope->GetListOfEnums(
false));
973 if (enumTable && enumTable->THashList::FindObject(enName))
return true;
977 auto listOfEnums = scope->GetListOfEnums();
979 auto enumTable =
dynamic_cast<const THashList *
>(listOfEnums);
980 if (enumTable && enumTable->THashList::FindObject(enName))
return true;
989 auto enumTable =
dynamic_cast<const THashList *
>(
gROOT->GetListOfEnums());
990 if (enumTable && enumTable->THashList::FindObject(inner))
return true;
1006 fContent.reserve(size);
1013 return fContent.c_str();
1021 bool notPresent = fLinesHashSet.emplace(fHashFunc(str)).second;
1032 :
TInterpreter(name, title), fGlobalsListSerial(-1), fInterpreter(0),
1033 fMetaProcessor(0), fNormalizedCtxt(0), fPrevLoadedDynLibInfo(0),
1034 fClingCallbacks(0), fAutoLoadCallBack(0),
1035 fTransactionCount(0), fHeaderParsingOnDemand(true), fIsAutoParsingSuspended(
kFALSE)
1038 bool fromRootCling = dlsym(RTLD_DEFAULT,
"usedToIdentifyRootClingByDlSym");
1040 llvm::install_fatal_error_handler(&exceptionErrorHandler);
1044 std::vector<std::string> clingArgsStorage;
1045 clingArgsStorage.push_back(
"cling4root");
1047 std::string interpInclude;
1049 if (!fromRootCling) {
1053 clingArgsStorage.push_back(
"-I" + interpInclude);
1055 std::string pchFilename = interpInclude +
"/allDict.cxx.pch";
1059 clingArgsStorage.push_back(
"-include-pch");
1060 clingArgsStorage.push_back(pchFilename);
1065 std::string include;
1067 clingArgsStorage.push_back(
"-I" + include);
1068 clingArgsStorage.push_back(
"-Wno-undefined-inline");
1069 clingArgsStorage.push_back(
"-fsigned-char");
1072 std::vector<const char*> interpArgs;
1073 for (std::vector<std::string>::const_iterator iArg = clingArgsStorage.begin(),
1074 eArg = clingArgsStorage.end(); iArg != eArg; ++iArg)
1075 interpArgs.push_back(iArg->c_str());
1077 #ifdef R__EXTERN_LLVMDIR 1078 TString llvmResourceDir = R__EXTERN_LLVMDIR;
1084 extraArgs && *extraArgs; ++extraArgs) {
1085 if (!strcmp(*extraArgs,
"-resource-dir")) {
1087 llvmResourceDir = *(++extraArgs);
1089 interpArgs.push_back(*extraArgs);
1093 fInterpreter =
new cling::Interpreter(interpArgs.size(),
1097 if (!fromRootCling) {
1114 fInterpreter->getCI()->getPreprocessorOpts().DisablePCHValidation =
true;
1118 fInterpreter->getCI()->getLangOpts().SpellChecking =
false;
1124 static llvm::raw_fd_ostream fMPOuts (STDOUT_FILENO,
false);
1130 if (fromRootCling) {
1132 "#include <string>\n" 1133 "using std::string;");
1136 + gClassDefInterpMacro +
"\n" 1137 + gInterpreterClassDef +
"\n" 1138 +
"#undef ClassImp\n" 1139 "#define ClassImp(X)\n" 1140 "#include <string>\n" 1141 "using namespace std;");
1169 std::unique_ptr<TClingCallbacks>
1175 if (!fromRootCling) {
1195 #if defined(R__MUST_REVISIT) 1196 #if R__MUST_REVISIT(6,2) 1197 Warning(
"~TCling",
"Interface not available yet.");
1198 #ifdef R__COMPLETE_MEM_TERMINATION 1219 #if defined(__CYGWIN__) && defined(__GNUC__) 1221 #elif defined(G__WIN32) 1222 MEMORY_BASIC_INFORMATION mbi;
1223 if (!VirtualQuery (
func, &mbi,
sizeof (mbi)))
1228 HMODULE hMod = (HMODULE) mbi.AllocationBase;
1229 TTHREAD_TLS_ARRAY(
char, MAX_PATH, moduleName);
1231 if (!GetModuleFileNameA (hMod, moduleName,
sizeof (moduleName)))
1238 if (dladdr((
void*)
func,&info)==0) {
1243 return info.dli_fname;
1255 auto setFactory = []() {
1259 static bool doneFactory = setFactory();
1268 const char** headers,
1269 void (*triggerFunc)())
const {
1277 searchPath = llvm::sys::path::parent_path(libraryName);
1297 if (
gROOT->IsRootFile(pcmFileName)) {
1301 ::Info(
"TCling::LoadPCM",
"Loading ROOT PCM %s", pcmFileName.
Data());
1308 TFile *pcmFile =
new TFile(pcmFileName+
"?filetype=pcm",
"READ");
1313 if (listOfKeys && listOfKeys->GetSize() == 0) {
1321 ::Info(
"TCling::LoadPCM",
"reading protoclasses for %s \n",pcmFileName.
Data());
1323 pcmFile->
GetObject(
"__ProtoClasses", protoClasses);
1326 for (
auto obj : *protoClasses) {
1336 for (
auto proto : *protoClasses) {
1338 = (
TClass*)
gROOT->GetListOfClasses()->FindObject(proto->GetName())) {
1345 ::Error(
"TCling::LoadPCM",
"Inconsistent TClassTable for %s",
1357 protoClasses->Clear();
1358 delete protoClasses;
1362 pcmFile->
GetObject(
"__Typedefs", dataTypes);
1364 for (
auto typedf: *dataTypes)
1365 gROOT->GetListOfTypes()->Add(typedf);
1374 auto listOfGlobals =
gROOT->GetListOfGlobals();
1375 auto listOfEnums =
dynamic_cast<THashList*
>(
gROOT->GetListOfEnums());
1377 for (
auto selEnum: *enums){
1378 const char* enumScope = selEnum->
GetTitle();
1379 const char* enumName = selEnum->GetName();
1380 if (strcmp(enumScope,
"") == 0){
1383 if (!listOfEnums->THashList::FindObject(enumName)){
1384 ((
TEnum*) selEnum)->SetClass(
nullptr);
1385 listOfEnums->Add(selEnum);
1387 for (
auto enumConstant: *static_cast<TEnum*>(selEnum)->GetConstants()){
1388 if (!listOfGlobals->FindObject(enumConstant)){
1389 listOfGlobals->Add(enumConstant);
1397 if (!nsTClassEntry){
1400 auto listOfEnums = nsTClassEntry->
fEnums.load();
1411 if (listOfEnums && !listOfEnums->THashList::FindObject(enumName)){
1412 ((
TEnum*) selEnum)->SetClass(nsTClassEntry);
1413 listOfEnums->Add(selEnum);
1426 ::Info(
"TCling::LoadPCM",
"Loading clang PCM %s", pcmFileName.
Data());
1440 using namespace clang;
1442 class ExtLexicalStorageAdder:
public RecursiveASTVisitor<ExtLexicalStorageAdder>{
1447 bool VisitRecordDecl(clang::RecordDecl* rcd){
1449 Info(
"ExtLexicalStorageAdder",
1450 "Adding external lexical storage to class %s",
1451 rcd->getNameAsString().c_str());
1452 auto reDeclPtr = rcd->getMostRecentDecl();
1454 reDeclPtr->setHasExternalLexicalStorage();
1455 }
while ((reDeclPtr = reDeclPtr->getPreviousDecl()));
1475 const char** headers,
1476 const char** includePaths,
1477 const char* payloadCode,
1478 const char* fwdDeclsCode,
1479 void (*triggerFunc)(),
1481 const char** classesHeaders)
1484 static const bool fromRootCling = dlsym(RTLD_DEFAULT,
"usedToIdentifyRootClingByDlSym");
1488 if (fromRootCling)
return;
1492 bool isACLiC =
false;
1493 if (hasHeaderParsingOnDemand &&
1494 strstr(modulename,
"_ACLiC_dict") !=
nullptr){
1496 Info(
"TCling::RegisterModule",
1497 "Header parsing on demand is active but this is an Aclic library. Disabling it for this library.");
1498 hasHeaderParsingOnDemand =
false;
1515 for (
const char** inclPath = includePaths; *inclPath; ++inclPath) {
1518 cling::Transaction* T = 0;
1520 for (
auto& fwdDeclArgToSkipPair : fwdDeclsArgToSkip){
1521 const std::string& fwdDecl = fwdDeclArgToSkipPair.first;
1522 const int nArgsToSkip = fwdDeclArgToSkipPair.second;
1524 assert(cling::Interpreter::kSuccess == compRes &&
1525 "A fwd declaration could not be compiled");
1526 if (compRes!=cling::Interpreter::kSuccess){
1527 Warning(
"TCling::RegisterModule",
1528 "Problems in declaring string '%s' were encountered.",
1543 TString code = gNonInterpreterClassDef;
1544 code += payloadCode;
1553 void* dyLibHandle = dlopen(dyLibName, RTLD_LAZY | RTLD_GLOBAL);
1556 char dyLibError[1000];
1557 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(),
1558 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), dyLibError,
1559 sizeof(dyLibError),
NULL);
1562 const char* dyLibError = dlerror();
1566 ::Info(
"TCling::RegisterModule",
1567 "Cannot open shared library %s for dictionary %s:\n %s",
1568 dyLibName, modulename, dyLibError);
1577 if (hasHeaderParsingOnDemand && fwdDeclsCode){
1580 std::string fwdDeclsCodeLessEnums;
1584 std::string fwdDeclsLine;
1585 std::istringstream fwdDeclsCodeStr(fwdDeclsCode);
1586 std::vector<std::string> scope;
1587 while (std::getline(fwdDeclsCodeStr, fwdDeclsLine)) {
1588 if (fwdDeclsLine.find(
"namespace ") == 0
1589 || fwdDeclsLine.find(
"inline namespace ") == 0) {
1591 scope.push_back(fwdDeclsLine.substr(10,
1592 fwdDeclsLine.length() - 10 - 2));
1593 }
else if (fwdDeclsLine ==
"}") {
1595 }
else if (fwdDeclsLine.find(
"enum __attribute__((annotate(\"") == 0) {
1596 clang::DeclContext* DC = 0;
1597 for (
auto &&aScope: scope) {
1604 if (scope.empty() || DC) {
1606 size_t posEnumName = fwdDeclsLine.find(
"\"))) ", 32);
1607 R__ASSERT(posEnumName != std::string::npos &&
"Inconsistent enum fwd decl!");
1609 while (isspace(fwdDeclsLine[posEnumName]))
1611 size_t posEnumNameEnd = fwdDeclsLine.find(
" : ", posEnumName);
1612 R__ASSERT(posEnumNameEnd != std::string::npos &&
"Inconsistent enum fwd decl (end)!");
1613 while (isspace(fwdDeclsLine[posEnumNameEnd]))
1617 std::string enumName = fwdDeclsLine.substr(posEnumName,
1618 posEnumNameEnd - posEnumName + 1);
1620 if (clang::NamedDecl* enumDecl
1621 = cling::utils::Lookup::Named(&
fInterpreter->getSema(),
1622 enumName.c_str(), DC)) {
1625 R__ASSERT(llvm::dyn_cast<clang::EnumDecl>(enumDecl) &&
"not an enum decl!");
1631 fwdDeclsCodeLessEnums += fwdDeclsLine +
"\n";
1635 if (fwdDeclsCodeLessEnums.size() != 0){
1636 auto compRes =
fInterpreter->declare(fwdDeclsCodeLessEnums, &T);
1637 assert(cling::Interpreter::kSuccess == compRes &&
1638 "The forward declarations could not be compiled");
1639 if (compRes!=cling::Interpreter::kSuccess){
1640 Warning(
"TCling::RegisterModule",
1641 "Problems in compiling forward declarations for module %s: '%s'",
1642 modulename, fwdDeclsCodeLessEnums.c_str()) ;
1650 ExtLexicalStorageAdder elsa;
1651 for (
auto dciIt = T->decls_begin();dciIt!=T->decls_end();dciIt++){
1652 cling::Transaction::DelayCallInfo& dci = *dciIt;
1653 for(
auto dit = dci.m_DGR.begin(); dit != dci.m_DGR.end(); ++dit) {
1654 clang::Decl* declPtr = *dit;
1655 elsa.TraverseDecl(declPtr);
1669 for (
const char** classesHeader = classesHeaders; *classesHeader; ++classesHeader) {
1670 temp=*classesHeader;
1672 size_t theTemplateHash = 0;
1673 bool addTemplate =
false;
1674 size_t posTemplate = temp.find(
'<');
1675 if (posTemplate != std::string::npos) {
1677 std::string templateName = temp.substr(0, posTemplate);
1683 for (
const char** classesHeader_inner = classesHeader; 0!=strcmp(*classesHeader_inner,
"@"); ++classesHeader_inner,++classesHeader){
1685 if (payloadCode == *classesHeader_inner ){
1687 if (addTemplate)
fPayloads.insert(theTemplateHash);
1690 Info(
"TCling::RegisterModule",
1691 "Adding a header for %s", temp.c_str());
1697 addTemplate =
false;
1704 if (strcmp(modulename,
"libCore")!=0 && strcmp(modulename,
"libRint")!=0
1705 && strcmp(modulename,
"libThread")!=0 && strcmp(modulename,
"libRIO")!=0
1706 && strcmp(modulename,
"libcomplexDict")!=0 && strcmp(modulename,
"libdequeDict")!=0
1707 && strcmp(modulename,
"liblistDict")!=0 && strcmp(modulename,
"libforward_listDict")!=0
1708 && strcmp(modulename,
"libvectorDict")!=0
1709 && strcmp(modulename,
"libmapDict")!=0 && strcmp(modulename,
"libmultimap2Dict")!=0
1710 && strcmp(modulename,
"libmap2Dict")!=0 && strcmp(modulename,
"libmultimapDict")!=0
1711 && strcmp(modulename,
"libsetDict")!=0 && strcmp(modulename,
"libmultisetDict")!=0
1712 && strcmp(modulename,
"libunordered_setDict")!=0 && strcmp(modulename,
"libunordered_multisetDict")!=0
1713 && strcmp(modulename,
"libunordered_mapDict")!=0 && strcmp(modulename,
"libunordered_multimapDict")!=0
1714 && strcmp(modulename,
"libvalarrayDict")!=0
1715 && strcmp(modulename,
"G__GenVector32")!=0 && strcmp(modulename,
"G__Smatrix32")!=0
1719 if (!
LoadPCM(pcmFileName, headers, triggerFunc)) {
1720 ::Error(
"TCling::RegisterModule",
"cannot find dictionary module %s",
1725 bool oldValue =
false;
1733 clangDiagSuppr diagSuppr(
fInterpreter->getSema().getDiagnostics());
1735 #if defined(R__MUST_REVISIT) 1736 #if R__MUST_REVISIT(6,2) 1737 Warning(
"TCling::RegisterModule",
"Diagnostics suppression should be gone by now.");
1741 if (!hasHeaderParsingOnDemand){
1742 const cling::Transaction* watermark =
fInterpreter->getLastTransaction();
1743 cling::Interpreter::CompilationResult compRes =
fInterpreter->parseForModule(code.
Data());
1749 assert(cling::Interpreter::kSuccess == compRes &&
1750 "Payload code of a dictionary could not be parsed correctly.");
1751 if (compRes!=cling::Interpreter::kSuccess) {
1752 Warning(
"TCling::RegisterModule",
1753 "Problems declaring payload for module %s.", modulename) ;
1762 if (!hasHeaderParsingOnDemand) {
1789 if (!hasHeaderParsingOnDemand) {
1792 "#undef __ROOTCLING__\n" 1793 + gInterpreterClassDef +
1800 dlclose(dyLibHandle);
1822 typedef std::vector<std::pair<TClass*,DictFuncPtr_t> >::iterator iterator;
1828 if ( i->first == oldcl ) {
1851 if (strstr(line,fantomline)) {
1866 gROOT->SetLineIsProcessing();
1870 gROOT->SetLineHasBeenProcessed();
1883 gROOT->SetLineIsProcessing();
1885 struct InterpreterFlagsRAII_t {
1887 bool fWasDynamicLookupEnabled;
1889 InterpreterFlagsRAII_t(cling::Interpreter* interp):
1891 fWasDynamicLookupEnabled(interp->isDynamicLookupEnabled())
1893 fInterpreter->enableDynamicLookup(
true);
1895 ~InterpreterFlagsRAII_t() {
1896 fInterpreter->enableDynamicLookup(fWasDynamicLookupEnabled);
1905 cling::Interpreter::CompilationResult compRes = cling::Interpreter::kSuccess;
1906 if (!strncmp(sLine.
Data(),
".L", 2) || !strncmp(sLine.
Data(),
".x", 2) ||
1907 !strncmp(sLine.
Data(),
".X", 2)) {
1915 aclicMode, arguments, io);
1916 if (aclicMode.
Length()) {
1918 R__ASSERT(aclicMode[0]==
'+' &&
"ACLiC mode must start with a +");
1920 if (aclicMode[1]==
'+') {
1926 compRes = cling::Interpreter::kFailure;
1928 if (strncmp(sLine.
Data(),
".L", 2) != 0) {
1931 if (arguments.Length()==0) {
1940 mod_line =
function + arguments + io;
1941 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
1947 bool unnamedMacro =
false;
1950 std::ifstream in(fname);
1951 static const char whitespace[] =
" \t\r\n";
1953 std::getline(in, line);
1954 std::string::size_type posNonWS = line.find_first_not_of(whitespace);
1955 if (posNonWS == std::string::npos)
continue;
1956 if (line[posNonWS] ==
'/' && line[posNonWS + 1] ==
'/')
1959 unnamedMacro = (line[posNonWS] ==
'{');
1965 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
1978 if (0!=strncmp(sLine.
Data(),
".autodict ",10) && sLine !=
".autodict") {
1981 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
1984 bool isInclusionDirective = sLine.
Contains(
"\n#include");
1985 if (isInclusionDirective) {
1993 if (result.isValid())
2002 case cling::Interpreter::kSuccess: *error =
kNoError;
break;
2003 case cling::Interpreter::kFailure: *error =
kRecoverable;
break;
2004 case cling::Interpreter::kMoreInputExpected: *error =
kProcessing;
break;
2007 if (compRes == cling::Interpreter::kSuccess
2009 && !result.isVoid())
2011 gROOT->SetLineHasBeenProcessed();
2012 return result.simplisticCastAs<
long>();
2014 gROOT->SetLineHasBeenProcessed();
2054 static const TClassRef clRefString(
"std::string");
2055 if (clRefString == cl) {
2060 const char* cobj = (
const char*) obj;
2067 auto inspInspect = [&] (ptrdiff_t offset){
2068 insp.
Inspect(const_cast<TClass*>(cl), insp.
GetParent(),
"_real", cobj, isTransient);
2069 insp.
Inspect(const_cast<TClass*>(cl), insp.
GetParent(),
"_imag", cobj + offset, isTransient);
2073 switch(complexType) {
2080 inspInspect(
sizeof(
float));
2085 inspInspect(
sizeof(
double));
2090 inspInspect(
sizeof(
int));
2095 inspInspect(
sizeof(
long));
2100 static clang::PrintingPolicy
2102 if (printPol.Indentation) {
2104 printPol.Indentation = 0;
2105 printPol.SuppressInitializers =
true;
2108 const char* clname = cl->
GetName();
2111 const clang::ASTContext& astContext =
fInterpreter->getCI()->getASTContext();
2112 const clang::Decl *scopeDecl = 0;
2117 scopeDecl = clingCI->
GetDecl();
2118 recordType = clingCI->
GetType();
2120 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
2122 scopeDecl = lh.findScope(clname, cling::LookupHelper::NoDiagnostics,
2126 Error(
"InspectMembers",
"Cannot find Decl for class %s", clname);
2129 const clang::CXXRecordDecl* recordDecl
2130 = llvm::dyn_cast<
const clang::CXXRecordDecl>(scopeDecl);
2132 Error(
"InspectMembers",
"Cannot find Decl for class %s is not a CXXRecordDecl.", clname);
2139 cling::Interpreter::PushTransactionRAII deserRAII(
fInterpreter);
2141 astContext.getASTRecordLayout(recordDecl);
2143 for (clang::RecordDecl::field_iterator iField = recordDecl->field_begin(),
2144 eField = recordDecl->field_end(); iField != eField; ++iField) {}
2147 const clang::ASTRecordLayout& recLayout
2148 = astContext.getASTRecordLayout(recordDecl);
2155 if (cl->
Size() != recLayout.getSize().getQuantity()) {
2156 Error(
"InspectMembers",
"TClass and cling disagree on the size of the class %s, respectively %d %lld\n",
2160 unsigned iNField = 0;
2163 for (clang::RecordDecl::field_iterator iField = recordDecl->field_begin(),
2164 eField = recordDecl->field_end(); iField != eField;
2165 ++iField, ++iNField) {
2168 clang::QualType memberQT = iField->getType();
2173 memberQT = cling::utils::Transform::GetPartiallyDesugaredType(astContext, memberQT,
fNormalizedCtxt->
GetConfig(),
false );
2174 if (memberQT.isNull()) {
2175 std::string memberName;
2176 llvm::raw_string_ostream stream(memberName);
2177 iField->getNameForDiagnostic(stream, printPol,
true );
2179 Error(
"InspectMembers",
2180 "Cannot retrieve QualType for member %s while inspecting class %s",
2181 memberName.c_str(), clname);
2184 const clang::Type* memType = memberQT.getTypePtr();
2186 std::string memberName;
2187 llvm::raw_string_ostream stream(memberName);
2188 iField->getNameForDiagnostic(stream, printPol,
true );
2190 Error(
"InspectMembers",
2191 "Cannot retrieve Type for member %s while inspecting class %s",
2192 memberName.c_str(), clname);
2197 Bool_t ispointer =
false;
2198 if (memNonPtrType->isPointerType()) {
2200 clang::QualType ptrQT
2201 = memNonPtrType->getAs<clang::PointerType>()->getPointeeType();
2206 ptrQT = cling::utils::Transform::GetPartiallyDesugaredType(astContext, ptrQT,
fNormalizedCtxt->
GetConfig(),
false );
2207 if (ptrQT.isNull()) {
2208 std::string memberName;
2209 llvm::raw_string_ostream stream(memberName);
2210 iField->getNameForDiagnostic(stream, printPol,
true );
2212 Error(
"InspectMembers",
2213 "Cannot retrieve pointee Type for member %s while inspecting class %s",
2214 memberName.c_str(), clname);
2217 memNonPtrType = ptrQT.getTypePtr();
2221 llvm::SmallString<8> arraySize;
2222 const clang::ArrayType* arrType = memNonPtrType->getAsArrayTypeUnsafe();
2223 unsigned arrLevel = 0;
2224 bool haveErrorDueToArray =
false;
2228 const clang::ConstantArrayType* constArrType =
2229 clang::dyn_cast<clang::ConstantArrayType>(arrType);
2231 constArrType->getSize().toStringUnsigned(arraySize);
2234 clang::QualType subArrQT = arrType->getElementType();
2235 if (subArrQT.isNull()) {
2236 std::string memberName;
2237 llvm::raw_string_ostream stream(memberName);
2238 iField->getNameForDiagnostic(stream, printPol,
true );
2240 Error(
"InspectMembers",
2241 "Cannot retrieve QualType for array level %d (i.e. element type of %s) for member %s while inspecting class %s",
2242 arrLevel, subArrQT.getAsString(printPol).c_str(),
2243 memberName.c_str(), clname);
2244 haveErrorDueToArray =
true;
2247 arrType = subArrQT.getTypePtr()->getAsArrayTypeUnsafe();
2249 if (haveErrorDueToArray) {
2254 std::string fieldName;
2255 if (memType->isPointerType()) {
2260 std::string
ioname(iField->getName());
2263 fieldName += arraySize;
2268 clang::CharUnits offset(astContext.toCharUnitsFromBits(recLayout.getFieldOffset(iNField)));
2269 ptrdiff_t fieldOffset = offset.getQuantity();
2279 auto iFiledQtype = iField->getType();
2280 if (
auto tagDecl = iFiledQtype->getAsTagDecl()){
2281 auto declAccess = tagDecl->getAccess();
2282 if (declAccess == AS_private || declAccess == AS_protected) {
2288 insp.
Inspect(const_cast<TClass*>(cl), insp.
GetParent(), fieldName.c_str(), cobj + fieldOffset, isTransient);
2291 const clang::CXXRecordDecl* fieldRecDecl = memNonPtrType->getAsCXXRecordDecl();
2295 std::string sFieldRecName;
2296 if (!ROOT::TMetaUtils::ExtractAttrPropertyFromName(*fieldRecDecl,
"iotype",sFieldRecName)){
2298 clang::QualType(memNonPtrType,0),
2308 insp.
InspectMember(sFieldRecName.c_str(), cobj + fieldOffset,
2309 (fieldName +
'.').c_str(),
transient);
2317 unsigned iNBase = 0;
2318 for (clang::CXXRecordDecl::base_class_const_iterator iBase
2319 = recordDecl->bases_begin(), eBase = recordDecl->bases_end();
2320 iBase != eBase; ++iBase, ++iNBase) {
2321 clang::QualType baseQT = iBase->getType();
2322 if (baseQT.isNull()) {
2323 Error(
"InspectMembers",
2324 "Cannot find QualType for base number %d while inspecting class %s",
2328 const clang::CXXRecordDecl* baseDecl
2329 = baseQT->getAsCXXRecordDecl();
2331 Error(
"InspectMembers",
2332 "Cannot find CXXRecordDecl for base number %d while inspecting class %s",
2337 std::string sBaseName;
2339 std::vector<TClass*> foundClasses;
2341 if (foundClasses.size()==1){
2342 baseCl=foundClasses[0];
2355 std::string qualNameForDiag;
2357 Error(
"InspectMembers",
2358 "Cannot find TClass for base class %s", qualNameForDiag.c_str() );
2363 if (iBase->isVirtual()) {
2366 Error(
"InspectMembers",
2367 "Base %s of class %s is virtual but no object provided",
2368 sBaseName.c_str(), clname);
2376 baseOffset = ci->
GetBaseOffset(baseCi, const_cast<void*>(obj),
2378 if (baseOffset == -1) {
2379 Error(
"InspectMembers",
2380 "Error calculating offset of virtual base %s of class %s",
2381 sBaseName.c_str(), clname);
2384 Error(
"InspectMembers",
2385 "Cannot calculate offset of virtual base %s of class %s",
2386 sBaseName.c_str(), clname);
2391 baseOffset = recLayout.getBaseClassOffset(baseDecl).getQuantity();
2438 bool oldDynLookup =
fInterpreter->isDynamicLookupEnabled();
2490 size_t at = std::string::npos;
2491 while ((at = file_name.find(
"/./")) != std::string::npos)
2492 file_name.replace(at, 3,
"/");
2494 std::string filesStr =
"";
2495 llvm::raw_string_ostream filesOS(filesStr);
2496 clang::SourceManager &SM =
fInterpreter->getCI()->getSourceManager();
2497 cling::ClangInternalState::printIncludedFiles(filesOS, SM);
2500 llvm::SmallVector<llvm::StringRef, 100> files;
2501 llvm::StringRef(filesStr).split(files,
"\n");
2503 std::set<std::string> fileMap;
2505 for (llvm::SmallVector<llvm::StringRef, 100>::const_iterator
2506 iF = files.begin(), iE = files.end(); iF != iE; ++iF) {
2507 if ((*iF) == file_name.c_str())
return kTRUE;
2508 fileMap.insert(*iF);
2511 if (fileMap.empty())
return kFALSE;
2514 TString sFilename(file_name.c_str());
2516 && fileMap.count(sFilename.Data())) {
2524 while (incPath.
Index(
" :") != -1) {
2528 sFilename = file_name.c_str();
2530 && fileMap.count(sFilename.Data())) {
2535 sFilename = file_name.c_str();
2537 cling::DynamicLibraryManager* dyLibManager
2540 if (dyLibManager->isLibraryLoaded(found)) {
2545 const clang::DirectoryLookup *CurDir = 0;
2546 clang::Preprocessor &PP =
fInterpreter->getCI()->getPreprocessor();
2547 clang::HeaderSearch &HS = PP.getHeaderSearchInfo();
2548 const clang::FileEntry *FE = HS.LookupFile(file_name.c_str(),
2549 clang::SourceLocation(),
2552 clang::ArrayRef<std::pair<
const clang::FileEntry *,
2553 const clang::DirectoryEntry *>>(),
2560 if (FE && FE->isValid()) {
2562 clang::SourceManager &SM =
fInterpreter->getCI()->getSourceManager();
2564 clang::FileID FID = SM.translateFile(FE);
2565 if (!FID.isInvalid() && FID.getHashValue() == 0)
2568 clang::SrcMgr::SLocEntry SLocE = SM.getSLocEntry(FID);
2569 if (SLocE.isFile() && SLocE.getFile().getContentCache()->getRawBuffer() == 0)
2571 if (!FID.isInvalid())
2575 sFilename = FE->getName();
2577 && fileMap.count(sFilename.Data())) {
2588 #if defined(R__WIN32) || defined(__CYGWIN__) 2589 HMODULE hModules[1024];
2591 unsigned long cbModules;
2593 hProcess = (
void *)::GetCurrentProcess();
2594 ::EnumProcessModules(hProcess, hModules,
sizeof(hModules), &cbModules);
2596 for (i = 1; i < (cbModules /
sizeof(
void *)); i++) {
2597 static const int bufsize = 260;
2598 wchar_t winname[bufsize];
2599 char posixname[bufsize];
2600 ::GetModuleFileNameExW(hProcess, hModules[i], winname, bufsize);
2601 #if defined(__CYGWIN__) 2602 cygwin_conv_path(CCP_WIN_W_TO_POSIX, winname, posixname, bufsize);
2604 std::wstring wpath = winname;
2605 std::replace(wpath.begin(), wpath.end(),
'\\',
'/');
2606 string path(wpath.begin(), wpath.end());
2607 strncpy(posixname, path.c_str(), bufsize);
2613 #elif defined(R__MACOSX) 2616 const char* imageName = 0;
2617 while ((imageName = _dyld_get_image_name(imageIndex))) {
2624 #elif defined(R__LINUX) 2625 struct PointerNo4_t {
2637 PointerNo4_t* procLinkMap = (PointerNo4_t*)dlopen(0, RTLD_LAZY | RTLD_GLOBAL);
2640 LinkMap_t* linkMap = (LinkMap_t*) ((PointerNo4_t*)procLinkMap->fPtr)->fPtr;
2646 while (iDyLib->fNext) {
2647 iDyLib = iDyLib->fNext;
2652 Error(
"TCling::UpdateListOfLoadedSharedLibraries",
2653 "Platform not supported!");
2664 if (!filename)
return;
2668 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
2669 if (!DLM->isLibraryLoaded(filename)) {
2670 DLM->loadLibrary(filename,
true );
2673 #if defined(R__MACOSX) 2675 if (!strncmp(filename,
"/usr/lib/system/", 16)
2676 || !strncmp(filename,
"/usr/lib/libc++", 15)
2677 || !strncmp(filename,
"/System/Library/Frameworks/", 27)
2678 || !strncmp(filename,
"/System/Library/PrivateFrameworks/", 34)
2679 || !strncmp(filename,
"/System/Library/CoreServices/", 29)
2680 || !strcmp(filename,
"cl_kernels")
2681 || strstr(filename,
"/usr/lib/libSystem")
2682 || strstr(filename,
"/usr/lib/libstdc++")
2683 || strstr(filename,
"/usr/lib/libicucore")
2684 || strstr(filename,
"/usr/lib/libbsm")
2685 || strstr(filename,
"/usr/lib/libobjc")
2686 || strstr(filename,
"/usr/lib/libresolv")
2687 || strstr(filename,
"/usr/lib/libauto")
2688 || strstr(filename,
"/usr/lib/libcups")
2689 || strstr(filename,
"/usr/lib/libDiagnosticMessagesClient")
2690 || strstr(filename,
"/usr/lib/liblangid")
2691 || strstr(filename,
"/usr/lib/libCRFSuite")
2692 || strstr(filename,
"/usr/lib/libpam")
2693 || strstr(filename,
"/usr/lib/libOpenScriptingUtil")
2694 || strstr(filename,
"/usr/lib/libextension"))
2696 #elif defined(__CYGWIN__) 2698 static const int bufsize = 260;
2699 char posixwindir[bufsize];
2700 char *windir = getenv(
"WINDIR");
2702 cygwin_conv_path(CCP_WIN_A_TO_POSIX, windir, posixwindir, bufsize);
2704 snprintf(posixwindir,
sizeof(posixwindir),
"/Windows/");
2705 if (strstr(filename, posixwindir) ||
2706 strstr(filename,
"/usr/bin/cyg"))
2708 #elif defined(R__WIN32) 2709 if (strstr(filename,
"/Windows/"))
2711 #elif defined (R__LINUX) 2712 if (strstr(filename,
"/ld-linux")
2713 || strstr(filename,
"linux-gnu/")
2714 || strstr(filename,
"/libstdc++.")
2715 || strstr(filename,
"/libgcc")
2716 || strstr(filename,
"/libc.")
2717 || strstr(filename,
"/libdl.")
2718 || strstr(filename,
"/libm."))
2736 Error(
"Load",
"Trying to load library (%s) from rootcling.",filename);
2742 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
2743 std::string canonLib = DLM->lookupLibrary(filename);
2744 cling::DynamicLibraryManager::LoadLibResult res
2745 = cling::DynamicLibraryManager::kLoadLibNotFound;
2746 if (!canonLib.empty()) {
2748 res = DLM->loadLibrary(filename, system);
2752 cling::Interpreter::CompilationResult compRes;
2753 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
2755 if (compRes == cling::Interpreter::kSuccess)
2756 res = cling::DynamicLibraryManager::kLoadLibSuccess;
2760 if (res == cling::DynamicLibraryManager::kLoadLibSuccess) {
2764 case cling::DynamicLibraryManager::kLoadLibSuccess:
return 0;
2765 case cling::DynamicLibraryManager::kLoadLibAlreadyLoaded:
return 1;
2815 Warning(
"Calc",
"waiting for cling thread to free");
2818 gROOT->SetLineIsProcessing();
2826 cling::Interpreter::CompilationResult cr =
fInterpreter->evaluate(line, valRef);
2827 if (cr != cling::Interpreter::kSuccess) {
2835 if (!valRef.isValid()) {
2844 if (valRef.isVoid()) {
2851 gROOT->SetLineHasBeenProcessed();
2854 return valRef.simplisticCastAs<
long>();
2861 void (*histaddFunc)(
const char*
line))
2866 #if defined(R__MUST_REVISIT) 2867 #if R__MUST_REVISIT(6,2) 2868 Warning(
"SetGetline",
"Cling should support the equivalent of SetGetlineFunc(getlineFunc, histaddFunc)");
2882 || T.deserialized_decls_begin() != T.deserialized_decls_end()
2883 || T.macros_begin() != T.macros_end()
2884 || ((!T.getFirstDecl().isNull()) && ((*T.getFirstDecl().begin()) != T.getWrapperFD()))) {
2901 std::set<TObject*>::iterator iSpecial = ((std::set<TObject*>*)
fgSetOfSpecials)->find(obj);
2918 #if defined(R__MUST_REVISIT) 2919 #if R__MUST_REVISIT(6,2) 2921 Warning(
"Reset",
"Cling should support the equivalent of scratch_upto(&fDictPos)");
2931 #if defined(R__MUST_REVISIT) 2932 #if R__MUST_REVISIT(6,2) 2934 Warning(
"ResetAll",
"Cling should support the equivalent of complete reset (unload everything but the startup decls.");
2961 #if defined(R__MUST_REVISIT) 2962 #if R__MUST_REVISIT(6,2) 2964 Warning(
"ResetGlobalVar",
"Cling should support the equivalent of resetglobalvar(obj)");
2976 #if defined(R__MUST_REVISIT) 2977 #if R__MUST_REVISIT(6,2) 2979 Warning(
"RewindDictionary",
"Cling should provide a way to revert transaction similar to rewinddictionary()");
2990 #if defined(R__MUST_REVISIT) 2991 #if R__MUST_REVISIT(6,2) 2993 Warning(
"DeleteGlobal",
"Cling should provide the equivalent of deleteglobal(obj), see also DeleteVariable.");
3005 #if defined(R__MUST_REVISIT) 3006 #if R__MUST_REVISIT(6,2) 3007 Warning(
"DeleteVariable",
"should do more that just reseting the value to zero");
3012 llvm::StringRef srName(name);
3013 const char* unscopedName =
name;
3014 llvm::StringRef::size_type posScope = srName.rfind(
"::");
3015 const clang::DeclContext* declCtx = 0;
3016 if (posScope != llvm::StringRef::npos) {
3017 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
3018 const clang::Decl* scopeDecl
3019 = lh.findScope(srName.substr(0, posScope),
3020 cling::LookupHelper::WithDiagnostics);
3022 Error(
"DeleteVariable",
"Cannot find enclosing scope for variable %s",
3026 declCtx = llvm::dyn_cast<clang::DeclContext>(scopeDecl);
3028 Error(
"DeleteVariable",
3029 "Enclosing scope for variable %s is not a declaration context",
3033 unscopedName += posScope + 2;
3035 clang::NamedDecl* nVarDecl
3036 = cling::utils::Lookup::Named(&
fInterpreter->getSema(), unscopedName, declCtx);
3038 Error(
"DeleteVariable",
"Unknown variable %s", name);
3041 clang::VarDecl* varDecl = llvm::dyn_cast<clang::VarDecl>(nVarDecl);
3043 Error(
"DeleteVariable",
"Entity %s is not a variable", name);
3047 clang::QualType qType = varDecl->getType();
3051 if (type->isPointerType()) {
3052 int** ppInt = (
int**)
fInterpreter->getAddressOfGlobal(GlobalDecl(varDecl));
3054 if (ppInt) *ppInt = 0;
3064 #if defined(R__MUST_REVISIT) 3065 #if R__MUST_REVISIT(6,2) 3067 Warning(
"SaveContext",
"Cling should provide a way to record a state watermark similar to store_dictposition(&fDictPos)");
3077 #if defined(R__MUST_REVISIT) 3078 #if R__MUST_REVISIT(6,2) 3080 Warning(
"SaveGlobalsContext",
"Cling should provide a way to record a watermark for the list of global variable similar to store_dictposition(&fDictPosGlobals)");
3126 if (!info->IsValid()) {
3150 zombieCandidate =
kTRUE;
3152 if (!info->IsLoaded()) {
3157 zombieCandidate =
kTRUE;
3207 static const char *anonEnum =
"anonymous enum ";
3208 static const int cmplen = strlen(anonEnum);
3210 if (0 == strncmp(name,anonEnum,cmplen)) {
3229 if (isClassOrNamespaceOnly &&
3232 const char *classname =
name;
3243 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
3245 const clang::Decl *decl
3246 = lh.findScope(classname,
3247 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3248 : cling::LookupHelper::NoDiagnostics,
3252 decl = lh.findScope(buf,
3253 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3254 : cling::LookupHelper::NoDiagnostics,
3271 clang::ClassTemplateSpecializationDecl *tmpltDecl =
3272 llvm::dyn_cast_or_null<clang::ClassTemplateSpecializationDecl>
3273 (type->getAsCXXRecordDecl());
3274 if (tmpltDecl && !tmpltDecl->getPointOfInstantiation().isValid()) {
3293 if (tci.
Property() & propertiesMask) {
3329 const cling::LookupHelper& lh =
fInterpreter->getLookupHelper();
3330 const clang::Decl *decl
3331 = lh.findClassTemplate(name,
3332 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3333 : cling::LookupHelper::NoDiagnostics);
3335 std::string strname =
"std::";
3337 decl = lh.findClassTemplate(strname,
3338 gDebug > 5 ? cling::LookupHelper::WithDiagnostics
3339 : cling::LookupHelper::NoDiagnostics);
3381 D =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
3384 if (
const clang::DeclContext* DC = dyn_cast<clang::DeclContext>(D)) {
3385 cling::Interpreter::PushTransactionRAII deserRAII(
fInterpreter);
3387 llvm::SmallVector< DeclContext *, 4> allDeclContexts;
3388 const_cast< clang::DeclContext *
>(DC)->collectAllContexts(allDeclContexts);
3389 for (llvm::SmallVector<DeclContext*, 4>::iterator declIter = allDeclContexts.begin(), declEnd = allDeclContexts.end();
3390 declIter != declEnd; ++declIter) {
3392 for (clang::DeclContext::decl_iterator DI = (*declIter)->decls_begin(),
3393 DE = (*declIter)->decls_end(); DI != DE; ++DI) {
3394 if (
const clang::EnumDecl* ED = dyn_cast<clang::EnumDecl>(*DI)) {
3397 PrintingPolicy Policy(ED->getASTContext().getPrintingPolicy());
3398 llvm::raw_string_ostream stream(buf);
3399 ED->getNameForDiagnostic(stream, Policy,
false);
3403 const char*
name = buf.c_str();
3405 enumList.
Get(ED, name);
3427 D =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
3431 if (
const clang::DeclContext* DC = dyn_cast<clang::DeclContext>(D)) {
3432 cling::Interpreter::PushTransactionRAII deserRAII(
fInterpreter);
3434 llvm::SmallVector< DeclContext *, 4> allDeclContexts;
3435 const_cast< clang::DeclContext *
>(DC)->collectAllContexts(allDeclContexts);
3436 for (llvm::SmallVector<DeclContext*, 4>::iterator declIter = allDeclContexts.begin(),
3437 declEnd = allDeclContexts.end(); declIter != declEnd; ++declIter) {
3439 for (clang::DeclContext::decl_iterator DI = (*declIter)->decls_begin(),
3440 DE = (*declIter)->decls_end(); DI != DE; ++DI) {
3441 if (
const clang::FunctionTemplateDecl* FTD = dyn_cast<clang::FunctionTemplateDecl>(*DI)) {
3442 funcTempList->
Get(FTD);
3490 if (m->fMethodArgs) {
3493 m->fMethodArgs =
new TList;
3498 m->fMethodArgs->Add(
new TMethodArg((MethodArgInfo_t*)a, m));
3539 if (llvm::isa<clang::NamespaceDecl>(cli->
GetDecl())) {
3548 Error(
"GenerateTClass",
3549 "Cannot find %s::Class_Version()! Class version might be wrong.",
3556 if (newvers == -1) {
3564 newvers = callfunc.
ExecInt(0);
3566 Error(
"GenerateTClass",
3567 "Cannot invoke %s::Class_Version()! Class version might be wrong.",
3571 if (newvers != oldvers) {
3588 static void GenerateTClass_GatherInnerIncludes(cling::Interpreter *interp,
TString &includes,
TClingClassInfo *info)
3592 const clang::ClassTemplateSpecializationDecl *templateCl
3593 = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(info->
GetDecl());
3595 for(
unsigned int i=0; i < templateCl->getTemplateArgs().size(); ++i) {
3596 const clang::TemplateArgument &arg( templateCl->getTemplateArgs().get(i) );
3600 if (!uType->isFundamentalType() && !uType->isEnumeralType()) {
3602 const clang::CXXRecordDecl *argdecl = uType->getAsCXXRecordDecl();
3605 TClingClassInfo subinfo(interp,*(argdecl->getASTContext().getRecordType(argdecl).getTypePtr()));
3606 GenerateTClass_GatherInnerIncludes(interp, includes, &subinfo);
3609 llvm::raw_string_ostream OS(Result);
3610 arg.print(argdecl->getASTContext().getPrintingPolicy(),OS);
3611 Warning(
"TCling::GenerateTClass",
"Missing header file for %s",OS.str().c_str());
3626 if (!info || !info->
IsValid()) {
3627 Fatal(
"GenerateTClass",
"Requires a valid ClassInfo object");
3632 std::string classname;
3636 Info(
"GenerateTClass",
"Will (try to) generate the compiled TClass for %s.",classname.c_str());
3640 GenerateTClass_GatherInnerIncludes(
fInterpreter,includes,info);
3646 Error(
"GenerateTClass",
"Even though the dictionary generation for %s seemed successful we can't find the TClass bootstrap!",classname.c_str());
3652 cl =
new TClass(classinfo, version, 0, 0, -1, -1, silent);
3658 cl =
new TClass(classinfo, 1, 0, 0, -1, -1, silent);
3683 if (classes == 0 || classes[0] == 0) {
3687 std::vector<std::string> listClasses;
3689 const char* current = classes, *prev = classes;
3693 if (*current ==
';') {
3694 listClasses.push_back(std::string(prev, current - prev));
3697 else if (*(current + 1) == 0) {
3698 listClasses.push_back(std::string(prev, current + 1 - prev));
3702 std::vector<std::string> listIncludes;
3704 const char* current = includes, *prev = includes;
3708 if (*current ==
';') {
3709 listIncludes.push_back(std::string(prev, current - prev));
3712 else if (*(current + 1) == 0) {
3713 listIncludes.push_back(std::string(prev, current + 1 - prev));
3719 std::vector<std::string>(), std::vector<std::string>());
3740 if (
const ValueDecl* decl = (
const ValueDecl*) d){
3743 if (hasIoName && ioName != name)
return 0;
3761 const clang::Decl* possibleEnum = 0;
3766 const clang::DeclContext* dc = 0;
3767 if (
const clang::Decl* D = cci->
GetDecl()) {
3768 if (!(dc = dyn_cast<clang::NamespaceDecl>(D))) {
3769 dc = dyn_cast<clang::RecordDecl>(D);
3774 possibleEnum = cling::utils::Lookup::Named(&
fInterpreter->getSema(),
name, dc);
3776 Error(
"TCling::GetEnum",
"DeclContext not found for %s .\n", name);
3781 possibleEnum = cling::utils::Lookup::Named(&
fInterpreter->getSema(),
name);
3783 if (possibleEnum && (possibleEnum != (clang::Decl*)-1)
3784 && isa<clang::EnumDecl>(possibleEnum)) {
3785 return possibleEnum;
3797 llvm::StringRef mangled_name = gv->getName();
3812 std::string scopename(demangled_name_c);
3813 free(demangled_name_c);
3819 std::string dataname;
3821 if (!strncmp(scopename.c_str(),
"typeinfo for ",
sizeof(
"typeinfo for ")-1)) {
3822 scopename.erase(0,
sizeof(
"typeinfo for ")-1);
3823 }
if (!strncmp(scopename.c_str(),
"vtable for ",
sizeof(
"vtable for ")-1)) {
3824 scopename.erase(0,
sizeof(
"vtable for ")-1);
3827 std::string::size_type pos = scopename.rfind(
'(');
3828 if (pos != std::string::npos) {
3832 pos = scopename.rfind(
':');
3833 if (pos != std::string::npos) {
3834 if ((pos != 0) && (scopename[pos-1] ==
':')) {
3835 dataname = scopename.substr(pos+1);
3836 scopename.erase(pos-1);
3840 dataname = scopename;
3848 if (scopename.size()) {
3864 Error(
"GetDataMemberWithValue()",
"not implemented");
3874 Error(
"GetDataMemberAtAddr()",
"not implemented");
3884 const char* params,
Bool_t objectIsConst )
3896 func.
SetFunc(&gcl, method, params, &offset);
3902 return mangled_name;
3911 const char* proto,
Bool_t objectIsConst ,
3917 GetMethod(method, proto, objectIsConst, 0 , mode).GetMangledName();
3929 const char* params,
Bool_t objectIsConst )
3941 func.
SetFunc(&gcl, method, params, &offset);
3970 std::vector<DeclId_t>& res)
const 3973 const clang::Decl* CtxDecl
3975 S.Context.getTranslationUnitDecl();
3976 const clang::DeclContext*
3977 DeclCtx = llvm::dyn_cast<
const clang::RecordDecl>(CtxDecl);
3979 DeclCtx = dyn_cast<clang::NamespaceDecl>(CtxDecl);
3980 if (!DeclCtx)
return;
3981 clang::DeclarationName DName
3982 = &S.Context.Idents.get(funcname);
3983 clang::LookupResult
R(S, DName, clang::SourceLocation(),
3984 Sema::LookupOrdinaryName, clang::Sema::ForRedeclaration);
3985 S.LookupQualifiedName(R, const_cast<DeclContext*>(DeclCtx));
3986 if (R.empty())
return;
3988 res.reserve(res.size() + (R.end() - R.begin()));
3989 for (clang::LookupResult::iterator IR = R.begin(), ER = R.end();
3991 if (
const clang::FunctionDecl* FD
3992 = llvm::dyn_cast<const clang::FunctionDecl>(*IR)) {
3993 if (!FD->getDescribedFunctionTemplate()) {
4137 func.
SetFunc(&cl,
function, params, &offset);
4153 const char* params,
Bool_t objectIsConst,
int* error)
4166 void* address = (
void*)((
Long_t)addr + offset);
4173 const char* params,
int* error)
4175 Execute(obj,cl,method,params,
false,error);
4190 Error(
"Execute",
"No method was defined");
4199 if (argc > nparms) {
4200 Error(
"Execute",
"Too many parameters to call %s, got %d but expected at most %d.",method->
GetName(),argc,nparms);
4203 if (nparms != argc) {
4213 Int_t firstDefault = -1;
4214 for (
Int_t i = 0; i < nparms; i ++) {
4221 if (firstDefault >= 0) {
4222 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);
4224 Error(
"Execute",
"Too few arguments to call %s, got only %d but expected %d.",method->
GetName(),argc,nparms);
4230 const char* listpar =
"";
4235 for (
Int_t i = 0; i < argc; i ++) {
4244 chpar += (nxtpar->String()).
ReplaceAll(
"\"",
"\\\"");
4251 complete += nxtpar->String();
4254 listpar = complete.
Data();
4272 const CXXMethodDecl * mdecl = dyn_cast<CXXMethodDecl>(minfo->
GetMethodDecl());
4274 void* address = (
void*)((
Long_t)addr + offset);
4281 const void* args[] ,
4286 Error(
"ExecuteWithArgsAndReturn",
"No method was defined");
4292 func.ExecWithArgsAndReturn(address, args, nargs, ret);
4313 Warning(
"GetTopLevelMacroName",
"Must change return type!");
4360 #if defined(R__MUST_REVISIT) 4361 #if R__MUST_REVISIT(6,0) 4362 Warning(
"GetCurrentMacroName",
"Must change return type!");
4375 TTHREAD_TLS(
char*) t = 0;
4376 TTHREAD_TLS(
unsigned int) tlen = 0;
4378 unsigned int dlen = strlen(typeDesc);
4381 t =
new char[dlen + 1];
4384 const char* s, *template_start;
4385 if (!strstr(typeDesc,
"(*)(")) {
4386 s = strchr(typeDesc,
' ');
4387 template_start = strchr(typeDesc,
'<');
4388 if (!strcmp(typeDesc,
"long long")) {
4389 strlcpy(t, typeDesc, dlen + 1);
4391 else if (!strncmp(typeDesc,
"unsigned ", s + 1 - typeDesc)) {
4392 strlcpy(t, typeDesc, dlen + 1);
4398 else if (s && (template_start == 0 || (s < template_start))) {
4399 strlcpy(t, s + 1, dlen + 1);
4402 strlcpy(t, typeDesc, dlen + 1);
4406 strlcpy(t, typeDesc, dlen + 1);
4409 while (l > 0 && (t[l - 1] ==
'*' || t[l - 1] ==
'&')) {
4423 const std::map<char, unsigned int> keyLenMap = {{
'c',6},{
'n',10},{
't',8},{
'h',7},{
'e',5}};
4425 if (rootmapfile && *rootmapfile) {
4429 std::ifstream file(rootmapfile);
4430 std::string
line; line.reserve(200);
4431 std::string lib_name; line.reserve(100);
4432 bool newFormat=
false;
4433 while (getline(file, line,
'\n')) {
4435 (strstr(line.c_str(),
"Library.")!=
nullptr || strstr(line.c_str(),
"Declare.")!=
nullptr)) {
4441 if (line.compare(0, 9,
"{ decls }") == 0) {
4444 while (getline(file, line,
'\n')) {
4445 if (line[0] ==
'[')
break;
4446 uniqueString->
Append(line);
4449 const char firstChar=line[0];
4450 if (firstChar ==
'[') {
4452 auto brpos = line.find(
']');
4453 if (brpos == string::npos)
continue;
4454 lib_name = line.substr(1, brpos-1);
4456 while( lib_name[nspaces] ==
' ' ) ++nspaces;
4457 if (nspaces) lib_name.replace(0, nspaces,
"");
4459 TString lib_nameTstr(lib_name.c_str());
4460 TObjArray* tokens = lib_nameTstr.Tokenize(
" ");
4464 Info(
"ReadRootmapFile",
"new section for %s", lib_nameTstr.Data());
4467 Info(
"ReadRootmapFile",
"section for %s (library does not exist)", lib_nameTstr.Data());
4474 auto keyLenIt = keyLenMap.find(firstChar);
4475 if (keyLenIt == keyLenMap.end())
continue;
4476 unsigned int keyLen = keyLenIt->second;
4478 const char *keyname = line.c_str()+keyLen;
4480 Info(
"ReadRootmapFile",
"class %s in %s", keyname, lib_name.c_str());
4483 if(lib_name != isThere->GetValue()){
4484 if (firstChar ==
'n') {
4486 Info(
"ReadRootmapFile",
"namespace %s found in %s is already in %s",
4487 keyname, lib_name.c_str(), isThere->GetValue());
4488 }
else if (firstChar ==
'h'){
4490 lib_name+=isThere->GetValue();
4494 Warning(
"ReadRootmapFile",
"%s %s found in %s is already in %s", line.substr(0, keyLen).c_str(),
4495 keyname, lib_name.c_str(), isThere->GetValue());
4499 Info(
"ReadRootmapFile",
"Key %s was already defined for %s", keyname, lib_name.c_str());
4558 using namespace clang;
4560 class ExtVisibleStorageAdder:
public RecursiveASTVisitor<ExtVisibleStorageAdder>{
4566 ExtVisibleStorageAdder(std::unordered_set<const NamespaceDecl*>& nsSet): fNSSet(nsSet) {};
4567 bool VisitNamespaceDecl(NamespaceDecl* nsDecl) {
4571 nsDecl->setHasExternalVisibleStorage();
4572 fNSSet.insert(nsDecl);
4576 std::unordered_set<const NamespaceDecl*>& fNSSet;
4622 for (
Int_t j = 0; j < i; j++) {
4633 Info(
"LoadLibraryMap",
"%s", d.
Data());
4644 Info(
"LoadLibraryMap",
" rootmap file: %s", p.
Data());
4666 Warning(
"LoadLibraryMap",
"please rename %s to end with \".rootmap\"", p.
Data());
4679 if (rootmapfile && *rootmapfile) {
4686 else if (res == -3) {
4696 while ((rec = (
TEnvRec*) next())) {
4698 if (!strncmp(cls.
Data(),
"Library.", 8) && cls.
Length() > 8) {
4717 Info(
"LoadLibraryMap",
"class %s in %s", cls.
Data(), wlib);
4720 Info(
"LoadLibraryMap",
"class %s in %s (library does not exist)", cls.
Data(), lib);
4735 else if (!strncmp(cls.
Data(),
"Declare.", 8) && cls.
Length() > 8) {
4745 cling::Transaction* T =
nullptr;
4747 assert(cling::Interpreter::kSuccess == compRes &&
"A declaration in a rootmap could not be compiled");
4749 if (compRes!=cling::Interpreter::kSuccess){
4751 "Problems in %s declaring '%s' were encountered.", rootmapfile, uniqueString.
Data()) ;
4756 for (
auto declIt = T->decls_begin(); declIt < T->decls_end(); ++declIt) {
4757 if (declIt->m_DGR.isSingleDecl()) {
4758 if (Decl* D = declIt->m_DGR.getSingleDecl()) {
4759 if (NamespaceDecl* NSD = dyn_cast<NamespaceDecl>(D)) {
4760 evsAdder.TraverseDecl(NSD);
4795 for (
Int_t ilib = 0; ilib < nrSharedLibs; ilib++) {
4802 TString rootMapBaseStr = sharedLibBaseStr;
4803 if (sharedLibBaseStr.
EndsWith(
".dll")) {
4806 else if (sharedLibBaseStr.
EndsWith(
".DLL")) {
4809 else if (sharedLibBaseStr.
EndsWith(
".so")) {
4812 else if (sharedLibBaseStr.
EndsWith(
".sl")) {
4815 else if (sharedLibBaseStr.
EndsWith(
".dl")) {
4818 else if (sharedLibBaseStr.
EndsWith(
".a")) {
4822 Error(
"ReloadAllSharedLibraryMaps",
"Unknown library type %s", sharedLibBaseStr.
Data());
4826 rootMapBaseStr +=
".rootmap";
4829 Error(
"ReloadAllSharedLibraryMaps",
"Could not find rootmap %s in path", rootMap);
4836 Error(
"ReloadAllSharedLibraryMaps",
"Error loading map %s", rootMap);
4871 if (!
fMapfile || !library || !*library) {
4879 size_t len = libname.
Length();
4884 while ((rec = (
TEnvRec *) next())) {
4895 if (!strncmp(cls.
Data(),
"Library.", 8) && cls.
Length() > 8) {
4904 if (!strncmp(lib, libname.
Data(), len)) {
4906 Error(
"UnloadLibraryMap",
"entry for <%s, %s> not found in library map table", cls.
Data(), lib);
4914 TString library_rootmap(library);
4915 if (!library_rootmap.
EndsWith(
".rootmap"))
4916 library_rootmap.
Append(
".rootmap");
4971 free(demangled_name);
4987 std::string demangled_name(demangled_name_c);
4988 free(demangled_name_c);
5001 result =
AutoLoad(demangled_name.c_str(), knowDictNotLoaded);
5026 Info(
"TCling::AutoLoad",
5027 "Trying to autoload for %s", cls);
5033 Info(
"TCling::AutoLoad",
5034 "Disabled due to gROOT or gInterpreter being invalid/not ready (the class name is %s)", cls);
5041 Info(
"TCling::AutoLoad",
5042 "Explicitly disabled (the class name is %s)", cls);
5063 if (
gROOT->LoadClass(cls, deplib) == 0) {
5065 Info(
"TCling::AutoLoad",
5066 "loaded dependent library %s for %s", deplib, cls);
5070 Error(
"TCling::AutoLoad",
5071 "failure loading dependent library %s for %s",
5076 if (lib && lib[0]) {
5077 if (
gROOT->LoadClass(cls, lib) == 0) {
5079 Info(
"TCling::AutoLoad",
5080 "loaded library %s for %s", lib, cls);
5085 Error(
"TCling::AutoLoad",
5086 "failure loading library %s for %s", lib, cls);
5101 cling::Interpreter *interpreter)
5104 Sema &SemaR = interpreter->getSema();
5105 ASTContext&
C = SemaR.getASTContext();
5106 Preprocessor &PP = SemaR.getPreprocessor();
5107 Parser&
P =
const_cast<Parser&
>(interpreter->getParser());
5108 Preprocessor::CleanupAndRestoreCacheRAII cleanupRAII(PP);
5109 Parser::ParserCurTokRestoreRAII savedCurToken(P);
5112 Token& Tok =
const_cast<Token&
>(P.getCurToken());
5113 Tok.setKind(tok::semi);
5119 Sema::ContextAndScopeRAII pushedDCAndS(SemaR, C.getTranslationUnitDecl(),
5121 std::string code = gNonInterpreterClassDef ;
5128 code += (
"#include \"");
5132 code += (
"#ifdef __ROOTCLING__\n" 5133 "#undef __ROOTCLING__\n" 5134 + gInterpreterClassDef +
5137 cling::Interpreter::CompilationResult cr;
5143 clangDiagSuppr diagSuppr(SemaR.getDiagnostics());
5145 #if defined(R__MUST_REVISIT) 5146 #if R__MUST_REVISIT(6,2) 5147 Warning(
"TCling::RegisterModule",
"Diagnostics suppression should be gone by now.");
5151 cr = interpreter->parseForModule(code);
5169 Int_t nHheadersParsed = 0;
5172 bool skipFirstEntry =
false;
5173 std::vector<std::string> autoparseKeys;
5174 if (strchr(cls,
'<')) {
5180 if (!autoparseKeys.empty()){
5181 TString templateName(autoparseKeys[0]);
5182 auto tokens = templateName.
Tokenize(
"::");
5183 clang::NamedDecl* previousScopeAsNamedDecl =
nullptr;
5184 clang::DeclContext* previousScopeAsContext =
nullptr;
5185 for (
auto const & scopeObj : *tokens){
5186 auto scopeName = ((
TObjString*) scopeObj)->String().Data();
5187 previousScopeAsNamedDecl = cling::utils::Lookup::Named(&
fInterpreter->getSema(), scopeName, previousScopeAsContext);
5189 if ((clang::NamedDecl*)-1 == previousScopeAsNamedDecl)
break;
5190 previousScopeAsContext = llvm::dyn_cast_or_null<clang::DeclContext>(previousScopeAsNamedDecl);
5191 if (!previousScopeAsContext)
break;
5195 if (
auto templateDecl = llvm::dyn_cast_or_null<clang::ClassTemplateDecl>(previousScopeAsNamedDecl)) {
5196 if (
auto templatedDecl = templateDecl->getTemplatedDecl()) {
5197 skipFirstEntry =
nullptr != templatedDecl->getDefinition();
5203 if (topLevel) autoparseKeys.emplace_back(cls);
5205 for (
const auto & apKeyStr : autoparseKeys) {
5206 if (skipFirstEntry) {
5207 skipFirstEntry=
false;
5210 if (apKeyStr.empty())
continue;
5211 const char *apKey = apKeyStr.c_str();
5215 Info(
"TCling::AutoParse",
5216 "Starting autoparse for %s\n", apKey);
5221 const cling::Transaction *T =
fInterpreter->getCurrentTransaction();
5223 auto const &hNamesPtrs = iter->second;
5225 Info(
"TCling::AutoParse",
5226 "We can proceed for %s. We have %s headers.", apKey, std::to_string(hNamesPtrs.size()).c_str());
5228 for (
auto & hName : hNamesPtrs) {
5230 if (0 !=
fPayloads.count(normNameHash)) {
5231 float initRSSval=0.f, initVSIZEval=0.f;
5233 (
void) initVSIZEval;
5236 "Parsing full payload for %s", apKey);
5243 if (cRes != cling::Interpreter::kSuccess) {
5244 if (hName[0] ==
'\n')
5245 Error(
"AutoParse",
"Error parsing payload code for class %s with content:\n%s", apKey, hName);
5254 Info(
"Autoparse",
">>> RSS key %s - before %.3f MB - after %.3f MB - delta %.3f MB", apKey, initRSSval, endRSSval, endRSSval-initRSSval);
5255 Info(
"Autoparse",
">>> VSIZE key %s - before %.3f MB - after %.3f MB - delta %.3f MB", apKey, initVSIZEval, endVSIZEval, endVSIZEval-initVSIZEval);
5261 "Parsing single header %s", hName);
5264 if (cRes != cling::Interpreter::kSuccess) {
5265 Error(
"AutoParse",
"Error parsing headerfile %s for class %s.", hName, apKey);
5277 if (strchr(apKey,
'<')) {
5284 return nHheadersParsed;
5305 Info(
"TCling::AutoParse",
5306 "Trying to autoparse for %s", cls);
5322 if (nHheadersParsed != 0) {
5341 return nHheadersParsed > 0 ? 1 : 0;
5354 mangled_name.c_str())) {
5365 std::string
name(demangled_name_c);
5366 free(demangled_name_c);
5374 if (!strncmp(name.c_str(),
"typeinfo for ",
sizeof(
"typeinfo for ")-1)) {
5375 name.erase(0,
sizeof(
"typeinfo for ")-1);
5376 }
else if (!strncmp(name.c_str(),
"vtable for ",
sizeof(
"vtable for ")-1)) {
5377 name.erase(0,
sizeof(
"vtable for ")-1);
5378 }
else if (!strncmp(name.c_str(),
"operator",
sizeof(
"operator")-1)
5379 && !isalnum(name[
sizeof(
"operator")])) {
5381 name.erase(0,
sizeof(
"operator")-1);
5382 std::string::size_type pos = name.rfind(
'(');
5383 if (pos != std::string::npos) {
5384 name.erase(0, pos + 1);
5385 pos = name.find(
",");
5386 if (pos != std::string::npos) {
5390 pos = name.rfind(
" const");
5391 if (pos != std::string::npos) {
5392 name.erase(pos, strlen(
" const"));
5394 while (!name.empty() && strchr(
"&*", name.back()))
5395 name.erase(name.length() - 1);
5399 std::string::size_type pos = name.rfind(
'(');
5400 if (pos != std::string::npos) {
5404 pos = name.rfind(
':');
5405 if (pos != std::string::npos) {
5406 if ((pos != 0) && (name[pos-1] ==
':')) {
5423 while (libs.
Tokenize(lib, posLib)) {
5433 void* addr = llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(mangled_name.c_str());
5460 const NamedDecl* ND =
static_cast<const NamedDecl*
>(vTD);
5461 const TagDecl* td = dyn_cast<TagDecl>(ND);
5465 tdDef = td->getDefinition();
5471 if (llvm::isa<clang::FunctionDecl>(td->getDeclContext())) {
5475 clang::QualType
type( td->getTypeForDecl(), 0 );
5477 auto declName=ND->getNameAsString();
5485 name = ND->getNameAsString();
5500 const TagDecl* tdOld = llvm::dyn_cast_or_null<TagDecl>(cci->
GetDecl());
5501 if (!tdOld || (tdDef && tdDef != tdOld)) {
5558 std::set<TClass*> modifiedTClasses;
5563 bool isTUTransaction =
false;
5564 if (T.decls_end()-T.decls_begin() == 1 && !T.hasNestedTransactions()) {
5565 clang::Decl* FirstDecl = *(T.decls_begin()->m_DGR.begin());
5566 if (clang::TranslationUnitDecl* TU
5567 = dyn_cast<clang::TranslationUnitDecl>(FirstDecl)) {
5570 isTUTransaction =
true;
5578 cling::Interpreter::PushTransactionRAII RAII(
fInterpreter);
5579 for (clang::DeclContext::decl_iterator TUI = TU->decls_begin(),
5580 TUE = TU->decls_end(); TUI != TUE; ++TUI)
5585 std::set<const void*> TransactionDeclSet;
5586 if (!isTUTransaction && T.decls_end() - T.decls_begin()) {
5587 const clang::Decl* WrapperFD = T.getWrapperFD();
5588 for (cling::Transaction::const_iterator
I = T.decls_begin(),
E = T.decls_end();
5590 if (
I->m_Call != cling::Transaction::kCCIHandleTopLevelDecl
5591 &&
I->m_Call != cling::Transaction::kCCIHandleTagDeclDefinition)
5594 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
5595 DE =
I->m_DGR.end(); DI != DE; ++DI) {
5596 if (*DI == WrapperFD)
5598 TransactionDeclSet.insert(*DI);
5599 ((
TCling*)
gCling)->HandleNewDecl(*DI,
false, modifiedTClasses);
5606 for (cling::Transaction::const_iterator
I = T.deserialized_decls_begin(),
5607 E = T.deserialized_decls_end();
I !=
E; ++
I) {
5608 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
5609 DE =
I->m_DGR.end(); DI != DE; ++DI)
5610 if (TransactionDeclSet.find(*DI) == TransactionDeclSet.end()) {
5626 std::vector<TClass*> modifiedTClassesDiff(modifiedTClasses.size());
5627 std::vector<TClass*>::iterator it;
5628 it = set_difference(modifiedTClasses.begin(), modifiedTClasses.end(),
5631 modifiedTClassesDiff.begin());
5632 modifiedTClassesDiff.resize(it - modifiedTClassesDiff.begin());
5635 ((
TCling*)
gCling)->GetModTClasses().insert(modifiedTClassesDiff.begin(),
5636 modifiedTClassesDiff.end());
5637 for (std::vector<TClass*>::const_iterator
I = modifiedTClassesDiff.begin(),
5638 E = modifiedTClassesDiff.end();
I !=
E; ++
I) {
5640 if (!
gROOT->GetListOfClasses()->FindObject(*
I)) {
5644 cling::Interpreter::PushTransactionRAII RAII(
fInterpreter);
5664 for (DeclContext::decl_iterator RI = DC->decls_begin(), RE = DC->decls_end(); RI != RE; ++RI) {
5665 if (isa<VarDecl>(*RI) || isa<FieldDecl>(*RI)) {
5666 const clang::ValueDecl* VD = dyn_cast<ValueDecl>(*RI);
5670 datamembers->
Unload(var);
5673 }
else if (
const FunctionDecl* FD = dyn_cast<FunctionDecl>(*RI)) {
5676 functions->
Unload(
function);
5677 function->Update(0);
5679 }
else if (
const EnumDecl* ED = dyn_cast<EnumDecl>(*RI)) {
5687 if (enumConst && enumConst->IsValid()) {
5688 datamembers->
Unload(enumConst);
5689 enumConst->Update(0);
5695 }
else if (
const FunctionTemplateDecl* FTD = dyn_cast<FunctionTemplateDecl>(*RI)) {
5697 if (functiontemplate) {
5698 functiontemplates->
Unload(functiontemplate);
5699 functiontemplate->
Update(0);
5716 cling::Transaction::const_nested_iterator iNested = T.nested_begin();
5717 for(cling::Transaction::const_iterator
I = T.decls_begin(),
E = T.decls_end();
5719 if (
I->m_Call == cling::Transaction::kCCIHandleVTable)
5722 if (
I->m_Call == cling::Transaction::kCCINone) {
5728 for (DeclGroupRef::const_iterator DI =
I->m_DGR.begin(),
5729 DE =
I->m_DGR.end(); DI != DE; ++DI) {
5733 if ( (*DI)->isFromASTFile() )
5737 if (isa<VarDecl>(*DI) || isa<EnumConstantDecl>(*DI)) {
5755 }
else if (
const FunctionDecl* FD = dyn_cast<FunctionDecl>(*DI)) {
5757 if (
function &&
function->IsValid()) {
5758 functions->
Unload(
function);
5759 function->Update(0);
5762 }
else if (
const FunctionTemplateDecl* FTD = dyn_cast<FunctionTemplateDecl>(*DI)) {
5764 if (functiontemplate) {
5765 functiontemplates->
Unload(functiontemplate);
5766 functiontemplate->
Update(0);
5769 }
else if (
const EnumDecl* ED = dyn_cast<EnumDecl>(*DI)) {
5772 TIter iEnumConst(e->GetConstants());
5778 globals->
Unload(enumConst);
5779 enumConst->Update(0);
5787 }
else if (
const clang::RecordDecl* RD = dyn_cast<RecordDecl>(*DI)) {
5788 std::vector<TClass*> vectTClass;
5790 if (RD->isCompleteDefinition()) {
5792 for (std::vector<TClass*>::iterator CI = vectTClass.begin(), CE = vectTClass.end();
5795 (*CI)->ResetClassInfo();
5800 }
else if (
const clang::NamespaceDecl* ND = dyn_cast<NamespaceDecl>(*DI)) {
5801 std::vector<TClass*> vectTClass;
5803 for (std::vector<TClass*>::iterator CI = vectTClass.begin(), CE = vectTClass.end();
5806 if (ND->isOriginalNamespace()) {
5807 (*CI)->ResetClassInfo();
5823 std::size_t normNameHash = triter->second;
5829 auto const &hNamesPtrs = iter->second;
5830 for (
auto &hName : hNamesPtrs) {
5832 Info(
"TransactionRollback",
5833 "Restoring ability to autoaparse: %s", hName);
5872 if (!cls || !*cls) {
5880 const char* libs = libs_record->
GetValue();
5881 return (*libs) ? libs : 0;
5898 const char* libs = libs_record->
GetValue();
5899 return (*libs) ? libs : 0;
5914 if (!
fMapfile || !lib || !lib[0]) {
5924 size_t len = libname.
Length();
5925 while ((rec = (
TEnvRec*) next())) {
5926 const char* libs = rec->
GetValue();
5927 if (!strncmp(libs, libname.
Data(), len) && strlen(libs) >= len
5928 && (!libs[len] || libs[len] ==
' ' || libs[len] ==
'.')) {
5941 #if defined(R__MUST_REVISIT) 5942 #if R__MUST_REVISIT(6,2) 5943 Warning(
"IsErrorMessagesEnabled",
"Interface not available yet.");
5955 #if defined(R__MUST_REVISIT) 5956 #if R__MUST_REVISIT(6,2) 5957 Warning(
"SetErrorMessages",
"Interface not available yet.");
5973 llvm::SmallVector<std::string, 10> includePaths;
5975 fInterpreter->GetIncludePaths(includePaths,
false,
true);
5976 if (
const size_t nPaths = includePaths.size()) {
5977 assert(!(nPaths & 1) &&
"GetIncludePath, number of paths and options is not equal");
5979 for (
size_t i = 0; i < nPaths; i += 2) {
5984 if (includePaths[i] !=
"-I")
6018 assert(fout != 0 &&
"DisplayIncludePath, 'fout' parameter is null");
6020 llvm::SmallVector<std::string, 10> includePaths;
6022 fInterpreter->GetIncludePaths(includePaths,
false,
true);
6023 if (
const size_t nPaths = includePaths.size()) {
6024 assert(!(nPaths & 1) &&
"DisplayIncludePath, number of paths and options is not equal");
6026 std::string allIncludes(
"include path:");
6027 for (
size_t i = 0; i < nPaths; i += 2) {
6029 allIncludes += includePaths[i];
6031 if (includePaths[i] !=
"-I")
6033 allIncludes += includePaths[i + 1];
6036 fprintf(fout,
"%s\n", allIncludes.c_str());
6055 #if defined(R__MUST_REVISIT) 6056 #if R__MUST_REVISIT(6,2) 6057 Warning(
"GenericError",
"Interface not available yet.");
6087 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.");
6095 Error(
"Getp2f2funcname",
"Will not be implemented: " 6096 "all function pointers are compiled!");
6105 #if defined(R__MUST_REVISIT) 6106 #if R__MUST_REVISIT(6,2) 6107 Warning(
"GetSecurityError",
"Interface not available yet.");
6118 cling::Interpreter::CompilationResult compRes;
6119 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
6121 return compRes == cling::Interpreter::kFailure;
6132 return (
fInterpreter->declare(text) == cling::Interpreter::kSuccess);
6140 TTHREAD_TLS_DECL(std::string,buffer);
6142 return buffer.c_str();
6208 #if defined(R__MUST_REVISIT) 6209 #if R__MUST_REVISIT(6,2) 6210 Warning(
"SetErrmsgcallback",
"Interface not available yet.");
6222 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.");
6230 Error(
"SetRTLD_NOW()",
"Will never be implemented! Don't use!");
6237 Error(
"SetRTLD_LAZY()",
"Will never be implemented! Don't use!");
6252 cling::DynamicLibraryManager* DLM =
fInterpreter->getDynamicLibraryManager();
6253 std::string canonical = DLM->lookupLibrary(path);
6254 if (canonical.empty()) {
6258 cling::Interpreter::CompilationResult compRes;
6259 cling::MetaProcessor::MaybeRedirectOutputRAII RAII(
fMetaProcessor);
6261 return compRes == cling::Interpreter::kFailure;
6277 using namespace cling;
6291 if (value.isValid() && value.needsManagedAllocation()) {
6304 cling::Interpreter *interpreter = ((
TCling*)
gCling)->GetInterpreter();
6314 auto iSpecObj = iSpecObjMap->second.find(Name);
6315 if (iSpecObj != iSpecObjMap->second.end()) {
6317 return iSpecObj->second;
6323 Sema &SemaR = interpreter->getSema();
6324 ASTContext&
C = SemaR.getASTContext();
6325 Preprocessor &PP = SemaR.getPreprocessor();
6326 Parser&
P =
const_cast<Parser&
>(interpreter->getParser());
6327 Preprocessor::CleanupAndRestoreCacheRAII cleanupRAII(PP);
6328 Parser::ParserCurTokRestoreRAII savedCurToken(P);
6331 Token& Tok =
const_cast<Token&
>(P.getCurToken());
6332 Tok.setKind(tok::semi);
6338 Sema::ContextAndScopeRAII pushedDCAndS(SemaR, C.getTranslationUnitDecl(),
6341 TObject* specObj =
gROOT->FindSpecialObject(Name, LookupCtx);
6344 Error(
"GetObjectAddress",
"Got a special object without LookupCtx!");
6358 clang::CXXRecordDecl* klass)
const 6360 using namespace clang;
6361 ASTContext& Ctx = klass->getASTContext();
6362 FriendDecl::FriendUnion friendUnion(
function);
6365 FriendDecl* friendDecl = FriendDecl::Create(Ctx, klass, sl, friendUnion, sl);
6366 klass->pushFriendDecl(friendDecl);
6380 if (func)
return ((
TClingCallFunc*)func)->GetDecl()->getCanonicalDecl();
6451 f->
Exec(address, &val);
6465 const void* args[] ,
6632 f->
SetFunc(ci, method, params, offset);
6641 f->
SetFunc(ci, method, params, objectIsConst, offset);
6669 f->
SetFuncProto(ci, method, proto, objectIsConst, offset, mode);
6679 llvm::SmallVector<clang::QualType, 4> funcProto;
6680 for (std::vector<TypeInfo_t*>::const_iterator iter = proto.begin(), end = proto.end();
6681 iter != end; ++iter) {
6682 funcProto.push_back( ((
TClingTypeInfo*)(*iter))->GetQualType() );
6694 llvm::SmallVector<clang::QualType, 4> funcProto;
6695 for (std::vector<TypeInfo_t*>::const_iterator iter = proto.begin(), end = proto.end();
6696 iter != end; ++iter) {
6697 funcProto.push_back( ((
TClingTypeInfo*)(*iter))->GetQualType() );
6699 f->
SetFuncProto(ci, method, funcProto, objectIsConst, offset, mode);
6714 if (!declid)
return kFALSE;
6716 const clang::Decl *scope;
6718 else scope =
fInterpreter->getCI()->getASTContext().getTranslationUnitDecl();
6720 const clang::Decl *decl =
reinterpret_cast<const clang::Decl*
>(declid);
6721 const clang::DeclContext *ctxt = clang::Decl::castToDeclContext(scope);
6722 if (!decl || !ctxt)
return kFALSE;
6723 if (decl->getDeclContext()->Equals(ctxt))
6725 else if (decl->getDeclContext()->isTransparentContext() &&
6726 decl->getDeclContext()->getParent()->Equals(ctxt))
6798 return TClinginfo->
GetMethodNArg(method, proto, objectIsConst, mode);
6823 TClinginfo->
Init(name);
6832 TClinginfo->
Init(tagnum);
6840 return TClinginfo->
IsBase(name);
6871 return TClinginfo->
IsValidMethod(method, proto,
false, offset, mode);
6879 return TClinginfo->
IsValidMethod(method, proto, objectIsConst, offset, mode);
6887 return TClinginfo->
Next();
6935 return TClinginfo->
Size();
6943 return TClinginfo->
Tagnum();
6959 TTHREAD_TLS_DECL(std::string,
output);
6969 return TClinginfo->
Name();
6977 return TClinginfo->
Title();
7014 ClassInfo_t* base)
const 7027 return TClinginfo->
Next();
7035 return TClinginfo->
Next(onlyDirect);
7043 return TClinginfo->
Offset(address, isDerivedObject);
7056 return TClinginfo->
GetBaseOffset(TClinginfoBase, address, isDerivedObject);
7072 return (ClassInfo_t *)TClinginfo->
GetBase();
7080 return TClinginfo->
Tagnum();
7088 TTHREAD_TLS_DECL(std::string,
output);
7098 return TClinginfo->
Name();
7143 const clang::Decl* decl =
reinterpret_cast<const clang::Decl*
>(declid);
7144 const clang::ValueDecl* vd = llvm::dyn_cast_or_null<clang::ValueDecl>(decl);
7177 return TClinginfo->
Next();
7185 return TClinginfo->
Offset();
7233 return TClinginfo->
Name();
7241 return TClinginfo->
Title();
7248 TTHREAD_TLS_DECL(std::string,
result);
7259 Decl* decl =
static_cast<Decl*
>(
const_cast<void*
>(declId));
7260 ASTContext &
C = decl->getASTContext();
7261 SourceRange commentRange;
7262 decl->addAttr(
new (C) AnnotateAttr( commentRange, C, attribute, 0 ) );
7273 cling::Interpreter &interp,
7276 const clang::TypeDecl* td = llvm::dyn_cast<clang::TypeDecl>(decl->getDeclContext());
7279 clang::QualType qualType(td->getTypeForDecl(),0);
7281 unsigned int level = 0;
7282 for(
size_t cursor = name.length()-1; cursor != 0; --cursor) {
7283 if (name[cursor] ==
'>') ++level;
7284 else if (name[cursor] ==
'<' && level) --level;
7285 else if (level == 0 && name[cursor] ==
':') {
7286 name.erase(0,cursor+1);
7297 if (llvm::isa<clang::CXXConstructorDecl>(decl))
7301 }
else if (llvm::isa<clang::CXXDestructorDecl>(decl))
7304 output.insert(output.begin(),
'~');
7306 llvm::raw_string_ostream stream(output);
7307 decl->getNameForDiagnostic(stream, decl->getASTContext().getPrintingPolicy(),
false);
7337 return (FuncTempInfo_t*)
const_cast<void*
>(declid);
7348 return (FuncTempInfo_t*)ft_info;
7368 if (!ft_info)
return 0;
7369 const clang::FunctionTemplateDecl *ft = (
const clang::FunctionTemplateDecl*)ft_info;
7370 return ft->getTemplateParameters()->size();
7379 if (!ft_info)
return 0;
7380 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
7381 return ft->getTemplateParameters()->getMinRequiredArguments();
7389 if (!ft_info)
return 0;
7394 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
7396 switch (ft->getAccess()) {
7397 case clang::AS_public:
7400 case clang::AS_protected:
7403 case clang::AS_private:
7406 case clang::AS_none:
7407 if (ft->getDeclContext()->isNamespace())
7415 const clang::FunctionDecl *fd = ft->getTemplatedDecl();
7416 if (
const clang::CXXMethodDecl *md =
7417 llvm::dyn_cast<clang::CXXMethodDecl>(fd)) {
7418 if (md->getTypeQualifiers() & clang::Qualifiers::Const) {
7421 if (md->isVirtual()) {
7427 if (
const clang::CXXConstructorDecl *cd =
7428 llvm::dyn_cast<clang::CXXConstructorDecl>(md)) {
7429 if (cd->isExplicit()) {
7433 else if (
const clang::CXXConversionDecl *cd =
7434 llvm::dyn_cast<clang::CXXConversionDecl>(md)) {
7435 if (cd->isExplicit()) {
7449 if (!ft_info)
return;
7450 const clang::FunctionTemplateDecl *ft = (clang::FunctionTemplateDecl*)ft_info;
7462 if (!ft_info)
return;
7463 const clang::FunctionTemplateDecl *ft = (
const clang::FunctionTemplateDecl*)ft_info;
7467 if (
const RedeclarableTemplateDecl *AnnotFD
7469 if (AnnotateAttr *
A = AnnotFD->getAttr<AnnotateAttr>()) {
7470 output =
A->getAnnotation().str();
7474 if (!ft->isFromASTFile()) {
7524 const clang::Decl* decl =
reinterpret_cast<const clang::Decl*
>(declid);
7526 const clang::FunctionDecl* fd = llvm::dyn_cast_or_null<clang::FunctionDecl>(decl);
7558 return info->
NArg();
7574 return info->
Next();
7598 return (TypeInfo_t*)info->
Type();
7606 TTHREAD_TLS_DECL(
TString, mangled_name);
7608 return mangled_name;
7651 return info->
Title();
7670 if (info && info->
IsValid()) {
7672 clang::QualType QT( typeinfo->
GetQualType().getCanonicalType() );
7673 if (QT->isEnumeralType()) {
7675 }
else if (QT->isPointerType()) {
7677 QT = llvm::cast<clang::PointerType>(QT)->getPointeeType();
7678 if ( QT->isCharType() ) {
7683 }
else if ( QT->isFloatingType() ) {
7684 int sz = typeinfo->
Size();
7685 if (sz == 4 || sz == 8) {
7691 }
else if ( QT->isIntegerType() ) {
7692 int sz = typeinfo->
Size();
7745 return (MethodArgInfo_t*)
7762 return info->
Next();
7786 return info->
Name();
7846 TClinginfo->
Init(name);
7862 return TClinginfo->
Name();
7886 return TClinginfo->
Size();
7936 const char*
name)
const 7940 TClinginfo->
Init(name);
7956 return TClinginfo->
Next();
7972 return TClinginfo->
Size();
7988 return TClinginfo->
Name();
7996 return TClinginfo->
Title();
int TCling__AutoLoadCallback(const char *className)
virtual TObject * FindObject(const TObject *obj) const
Find object using its hash value (returned by its Hash() member).
virtual MethodArgInfo_t * MethodArgInfo_Factory() const
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 Long_t MethodInfo_Property(MethodInfo_t *minfo) const
virtual Long_t ClassInfo_ClassProperty(ClassInfo_t *info) const
long TypeProperty() const
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual Int_t GetEntries() const
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual void SetTempLevel(int val) const
Create / close a scope for temporaries.
const clang::FunctionTemplateDecl * GetFunctionTemplate(const char *fname) const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
virtual void SetRcName(const char *name)
TObject * GetObjectAddress(const char *Name, void *&LookupCtx)
If the interpreter encounters Name, check whether that is an object ROOT could retrieve.
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.
virtual DeclId_t GetDataMemberAtAddr(const void *addr) const
Return pointer to cling DeclId for a data member with a given name.
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)]...
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)
const char * Name() const
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 SetRTLD_NOW() const
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 int TypedefInfo_Size(TypedefInfo_t *tinfo) const
virtual TVirtualMutex * Factory(Bool_t=kFALSE)=0
virtual void SetAllocunlockfunc(void(*)()) const
[Place holder for Mutex Unlock] Provide the interpreter with a way to release a lock used to protect ...
virtual bool ClassInfo_HasDefaultConstructor(ClassInfo_t *info) 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...
virtual CallFuncIFacePtr_t CallFunc_IFacePtr(CallFunc_t *func) const
void TCling__UpdateListsOnCommitted(const cling::Transaction &T, cling::Interpreter *)
virtual void PostLoadCheck()
Do the initialization that can only be done after the CINT dictionary has been fully populated and ca...
virtual void BaseClassInfo_Delete(BaseClassInfo_t *bcinfo) const
virtual DataMemberInfo_t * DataMemberInfo_Factory(ClassInfo_t *clinfo=0) const
virtual bool CallFunc_IsValid(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 int ClassInfo_Next(ClassInfo_t *info) const
virtual const char * WorkingDirectory()
Return working directory.
virtual const char * DataMemberInfo_TypeName(DataMemberInfo_t *dminfo) const
virtual void CallFunc_ExecWithReturn(CallFunc_t *func, void *address, void *ret) const
Namespace for new ROOT classes and functions.
std::map< SpecialObjectLookupCtx_t, SpecialObjectMap_t > fSpecialObjectMaps
virtual TypedefInfo_t * TypedefInfo_FactoryCopy(TypedefInfo_t *tinfo) const
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
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.
static void AddClassToDeclIdMap(TDictionary::DeclId_t id, TClass *cl)
static: Add a TClass* to the map of classes.
const char * Name() const
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...
R__EXTERN TClassTable * gClassTable
TClass * GetClass() const
const char * GetPrototype(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
void UpdateListsOnCommitted(const cling::Transaction &T)
TDictionary::DeclId_t DeclId_t
virtual int BaseClassInfo_Next(BaseClassInfo_t *bcinfo) const
RooArgList L(const RooAbsArg &v1)
void * llvmLazyFunctionCreator(const std::string &mangled_name)
Autoload a library provided the mangled name of a missing symbol.
TEnum * Find(DeclId_t id) const
Return the TEnum corresponding to the Decl 'id' or NULL if it does not exist.
Dictionary for function template This class describes one single function template.
double ExecDouble(void *address)
void Init(const char *name)
virtual TypeInfo_t * TypeInfo_FactoryCopy(TypeInfo_t *) const
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.
virtual void MethodInfo_CreateSignature(MethodInfo_t *minfo, TString &signature) const
static TProtoClass * GetProtoNorm(const char *cname)
Given the class normalized name returns the TClassProto object for the class.
TObject * FindObject(const char *name) const
Find object using its name.
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
int GetMethodNArg(const char *method, const char *proto, Bool_t objectIsConst, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
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...
TList * GetListOfEnums(Bool_t load=kTRUE)
Return list containing the TEnums of a class.
TString & ReplaceAll(const TString &s1, const TString &s2)
const char * Name() const
bool HasMethod(const char *name) const
void Init(const char *name)
Lookup named typedef and reset the iterator to point to it.
std::atomic< TListOfEnums * > fEnums
virtual CallFunc_t * CallFunc_FactoryCopy(CallFunc_t *func) 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.
void SetFunc(const TClingClassInfo *info, const char *method, const char *arglist, long *poffset)
void Destruct(void *arena, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Double_t distance(const TPoint2 &p1, const TPoint2 &p2)
virtual const char * MethodInfo_Title(MethodInfo_t *minfo) const
void SetArgArray(long *argArr, int narg)
virtual TList * GetListOfKeys() const
cling::MetaProcessor * fMetaProcessor
virtual int DataMemberInfo_TypeSize(DataMemberInfo_t *dminfo) const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
const char * GetFullTypeName() const
Get full type description of typedef, e,g.: "class TDirectory*".
Persistent version of a TClass.
virtual void SetRTLD_LAZY() const
Emulation of the CINT DataMemberInfo class.
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.)
TClass * GenerateTClass(const char *classname, Bool_t emulation, Bool_t silent=kFALSE)
Generate a TClass for the given class.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
void UpdateListOfGlobals()
No op: see TClingCallbacks (used to update the list of globals)
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
void UpdateListOfGlobalFunctions()
No op: see TClingCallbacks (used to update the list of global functions)
Emulation of the CINT MethodInfo class.
ptrdiff_t GetBaseOffset(TClingClassInfo *toBase, void *address, bool isDerivedObject)
virtual std::string MethodArgInfo_TypeNormalizedName(MethodArgInfo_t *marginfo) const
const char * Name() const
void SaveContext()
Save the current Cling state.
virtual MethodInfo_t * CallFunc_FactoryMethod(CallFunc_t *func) const
cling::Interpreter * fInterpreter
virtual ClassInfo_t * ClassInfo_Factory(Bool_t all=kTRUE) const
virtual const char * HomeDirectory(const char *userName=0)
Return the user's home directory.
static void RemoveClassDeclId(TDictionary::DeclId_t id)
Long_t Property() const
Set TObject::fBits and fStreamerType to cache information about the class.
virtual BaseClassInfo_t * BaseClassInfo_Factory(ClassInfo_t *info) const
const char * GetClassSharedLibs(const char *cls)
Get the list of shared libraries containing the code for class cls.
const char * GetValue() const
void TCling__DEBUG__dump(clang::DeclContext *DC)
const TClingTypeInfo * Type() const
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 void MethodInfo_Delete(MethodInfo_t *minfo) const
Interface to cling function.
virtual void CallFunc_SetArgArray(CallFunc_t *func, Long_t *paramArr, Int_t nparam) const
virtual const char * TypedefInfo_TrueName(TypedefInfo_t *tinfo) const
static const char * filename()
Bool_t IsPersistent() const
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 LoadPCM(TString pcmFileName, const char **headers, void(*triggerFunc)()) const
Tries to load a PCM; returns true on success.
virtual Bool_t IsTreatingNonAccessibleTypes()
virtual FuncTempInfo_t * FuncTempInfo_FactoryCopy(FuncTempInfo_t *) const
Construct a FuncTempInfo_t.
void FullName(std::string &output, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
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.
The TEnv class reads config files, by default named .rootrc.
std::string InsertStd(const char *tname)
clang::DeclContext * TCling__DEBUG__getDeclContext(clang::Decl *D)
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 (...
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 *)
bool HasDefaultConstructor() const
virtual TApplicationImp * GetApplicationImp()
TClingMethodInfo GetMethod(const char *fname) const
TClingTypeInfo * Type() const
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
virtual const char * MethodInfo_GetMangledName(MethodInfo_t *minfo) const
virtual UInt_t FuncTempInfo_TemplateNargs(FuncTempInfo_t *) const
Return the maximum number of template arguments of the function template described by ft_info...
virtual int DisplayIncludePath(FILE *fout) const
Interface to cling function.
std::vector< std::pair< std::string, int > > FwdDeclArgsToKeepCollection_t
void * fPrevLoadedDynLibInfo
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Each ROOT method (see TMethod) has a linked list of its arguments.
virtual const char * BaseClassInfo_Name(BaseClassInfo_t *bcinfo) const
virtual void TypeInfo_Delete(TypeInfo_t *tinfo) const
virtual Long_t CallFunc_ExecInt(CallFunc_t *func, void *address) const
Int_t DeleteVariable(const char *name)
Undeclare obj called name.
virtual int SetClassAutoparsing(int)
Enable/Disable the Autoparsing of headers.
Int_t GetEntriesFast() const
llvm::StringRef ValidArrayIndex() const
virtual int LoadFile(const char *path) const
Load a source file or library called path into the interpreter.
const char * TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Get the name of the underlying type of the current typedef.
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.
virtual void TypeInfo_Init(TypeInfo_t *tinfo, const char *funcname) const
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 ~TCling()
Destroy the interpreter interface.
virtual const char * DataMemberInfo_Title(DataMemberInfo_t *dminfo) const
virtual void LoadFunctionTemplates(TClass *cl) const
Create list of pointers to function templates for TClass cl.
virtual bool MethodArgInfo_IsValid(MethodArgInfo_t *marginfo) const
virtual bool Update(FuncTempInfo_t *info)
Update the TFunctionTemplate to reflect the new info.
virtual Long_t DataMemberInfo_Property(DataMemberInfo_t *dminfo) const
virtual Long_t TypedefInfo_Property(TypedefInfo_t *tinfo) const
virtual void * ClassInfo_New(ClassInfo_t *info) const
const clang::Type * GetType() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Emulation of the CINT CallFunc class.
virtual int DisplayClass(FILE *fout, const char *name, int base, int start) const
virtual const char * GetTopLevelMacroName() const
Return the file name of the current un-included interpreted file.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
static const TString & GetIncludeDir()
Get the include directory in the installation. Static utility function.
virtual int GetProcInfo(ProcInfo_t *info) const
Returns cpu and memory used by this process into the ProcInfo_t structure.
Bool_t R_ISREG(Int_t mode)
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 bool ClassInfo_IsValidMethod(ClassInfo_t *info, const char *method, const char *proto, Long_t *offset, ROOT::EFunctionMatchMode=ROOT::kConversionMatch) const
virtual int DataMemberInfo_MaxIndex(DataMemberInfo_t *dminfo, Int_t dim) 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.
const char * GetSharedLibDeps(const char *lib)
Get the list a libraries on which the specified lib depends.
static const char * GetMacroPath()
Get macro search path. Static utility function.
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.
std::set< size_t > fPayloads
TDictionary * Find(DeclId_t id) const
Return (after creating it if necessary) the TDataMember describing the data member corresponding to t...
const TSeqCollection * GetConstants() const
virtual Long_t GetExecByteCode() const
This routines used to return the address of the internal wrapper function (of the interpreter) that w...
virtual void MethodArgInfo_Delete(MethodArgInfo_t *marginfo) 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 int TypeInfo_RefType(TypeInfo_t *) const
const char * Data() const
void AddFriendToClass(clang::FunctionDecl *, clang::CXXRecordDecl *) const
Inject function as a friend into klass.
virtual Long_t BaseClassInfo_Offset(BaseClassInfo_t *toBaseClassInfo, void *address, bool isDerivedObject) const
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
void TCling__DEBUG__decl_dump(void *D)
Int_t UnloadLibraryMap(const char *library)
Unload library map entries coming from the specified library.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual TEnum * CreateEnum(void *VD, TClass *cl) const
virtual void GenericError(const char *error) const
Let the interpreter issue a generic error, and set its error state.
void ClearStack()
Delete existing temporary values.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual void ClassInfo_Init(ClassInfo_t *info, const char *funcname) const
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.
void CreateSignature(TString &signature) const
virtual void CallFunc_Init(CallFunc_t *func) 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...
THashTable implements a hash table to store TObject's.
const char * TCling__GetClassSharedLibs(const char *className)
clang::NamespaceDecl * TCling__DEBUG__DCtoNamespace(clang::DeclContext *DC)
void ExecuteWithArgsAndReturn(TMethod *method, void *address, const void *args[]=0, int nargs=0, void *ret=0) 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...
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
virtual TypedefInfo_t * TypedefInfo_Factory() const
virtual Long_t BaseClassInfo_Property(BaseClassInfo_t *bcinfo) 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.
virtual void CallFunc_Exec(CallFunc_t *func, void *address) const
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 UInt_t FuncTempInfo_TemplateMinReqArgs(FuncTempInfo_t *) const
Return the number of required template arguments of the function template described by ft_info...
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.
void SetObjectValidity(EObjectPointerState val)
void CreateListOfDataMembers(TClass *cl) const
Create list of pointers to data members for TClass cl.
void SetArgs(const char *args)
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...
virtual void ClassInfo_DeleteArray(ClassInfo_t *info, void *arena, bool dtorOnly) const
long ClassProperty() const
DeclId_t GetFunctionWithPrototype(ClassInfo_t *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Return pointer to cling interface function for a method of a class with a certain prototype...
void Init(TClassEdit::TInterpreterLookupHelper *helper)
virtual MethodInfo_t * MethodInfo_FactoryCopy(MethodInfo_t *minfo) const
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.
TClass * GetClass() const
void CreateListOfBaseClasses(TClass *cl) const
Create list of pointers to base class(es) for TClass cl.
virtual const char * GetDynamicPath()
Return the dynamic path (used to find shared libraries).
virtual Long_t DataMemberInfo_Offset(DataMemberInfo_t *dminfo) 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 * ClassInfo_FileName(ClassInfo_t *info) const
virtual const char * TypeInfo_Name(TypeInfo_t *) const
virtual const char * Getenv(const char *env)
Get environment variable.
virtual const char * MapCppName(const char *) const
Interface to cling function.
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.
virtual const char * GetCurrentMacroName() const
Return the file name of the currently interpreted file, included or not.
virtual int SetClassAutoloading(int) const
Enable/Disable the Autoloading of libraries.
ULong64_t fTransactionCount
const char * GetDefault() const
Get default value of method argument.
virtual bool ClassInfo_IsBase(ClassInfo_t *info, const char *name) const
char * DemangleTypeIdName(const std::type_info &ti, int &errorCode)
Demangle in a portable way the type id name.
virtual Long_t ClassInfo_GetBaseOffset(ClassInfo_t *fromDerived, ClassInfo_t *toBase, void *address, bool isDerivedObject) const
DeclId_t GetFunction(ClassInfo_t *cl, const char *funcname)
Return pointer to cling interface function for a method of a class with a certain name...
virtual int MethodInfo_NArg(MethodInfo_t *minfo) const
long Property() const
Return a bit mask of metadata about the current typedef.
virtual void Setgvp(Long_t) const
Interface to the cling global object pointer which was controlling the behavior of the wrapper around...
const char * TypeName() const
Long_t ProcessLine(const char *line, EErrorCode *error=0)
Let cling process a command line.
virtual Long_t ClassInfo_Property(ClassInfo_t *info) const
virtual bool Update(DataMemberInfo_t *info)
Update the TFunction to reflect the new info.
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.
virtual int TypedefInfo_Next(TypedefInfo_t *tinfo) const
virtual bool TypeInfo_IsValid(TypeInfo_t *tinfo) const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
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)()
TVirtualPad is an abstract base class for the Pad and Canvas classes.
DeclId_t GetDeclId(const llvm::GlobalValue *gv) const
Return pointer to cling DeclId for a global value.
const char * TypeTrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
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> (...
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.
virtual bool ClassInfo_IsEnum(const char *name) const
static void TCling__UpdateClassInfo(const NamedDecl *TD)
Update TClingClassInfo for a class (e.g. upon seeing a definition).
void TCling__DEBUG__printName(clang::Decl *D)
EComplexType GetComplexType(const char *)
long ExtraProperty() const
void GetObject(const char *namecycle, T *&ptr)
virtual Long_t DataMemberInfo_TypeProperty(DataMemberInfo_t *dminfo) const
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
virtual Bool_t IsCmdThread()
void PrintIntro()
No-op; see TRint instead.
R__EXTERN TVirtualMutex * gGlobalMutex
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 const char * TypeInfo_TrueName(TypeInfo_t *tinfo) const
virtual std::string MethodInfo_TypeNormalizedName(MethodInfo_t *minfo) const
const char * Name() const
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 void CallFunc_SetArgs(CallFunc_t *func, const char *param) const
const char * TmpltName() const
void Init(const char *name)
void function(const char *name_, T fun, const char *docstring=0)
bool TCling__TEST_isInvalidDecl(clang::Decl *D)
TClingClassInfo * GetBase() const
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...
virtual bool MethodInfo_IsValid(MethodInfo_t *minfo) const
int MaxIndex(int dim) const
void TCling__SplitAclicMode(const char *fileName, string &mode, string &args, string &io, string &fname)
const char * GetName() const
Returns name of object.
virtual Long_t TypeInfo_Property(TypeInfo_t *tinfo) const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Emulation of the CINT BaseClassInfo class.
TClingMethodInfo * FactoryMethod() const
Double_t length(const TVector2 &v)
R__EXTERN TSystem * gSystem
void * InterfaceMethod(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
virtual const char * DataMemberInfo_TypeTrueName(DataMemberInfo_t *dminfo) const
ptrdiff_t Offset(void *address=0, bool isDerivedObject=true) const
virtual void GetFunctionName(const clang::FunctionDecl *decl, std::string &name) 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)
virtual void LoadEnums(TListOfEnums &cl) const
Create list of pointers to enums for TClass cl.
std::set< TClass * > & GetModTClasses()
virtual int TypeInfo_Size(TypeInfo_t *tinfo) const
static void UpdateAllCanvases()
Update all canvases at end the terminal input command.
const clang::FunctionDecl * GetMethodDecl() const
const char * TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Return the normalized name of the type (i.e.
ClassInfo_t * GetClassInfo() const
virtual CallFunc_t * CallFunc_Factory() const
const char * DefaultValue() 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.
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)
virtual const char * DataMemberInfo_ValidArrayIndex(DataMemberInfo_t *dminfo) const
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.
virtual Long_t BaseClassInfo_Tagnum(BaseClassInfo_t *bcinfo) const
Bool_t TestBit(UInt_t f) const
virtual Bool_t IsValid()
Return true if this global object is pointing to a currently loaded global.
virtual const char * ClassInfo_Title(ClassInfo_t *info) const
void UpdateListOfLoadedSharedLibraries()
char * Form(const char *fmt,...)
virtual void CallFunc_SetFunc(CallFunc_t *func, ClassInfo_t *info, const char *method, const char *params, Long_t *Offset) const
virtual TypeInfo_t * MethodInfo_Type(MethodInfo_t *minfo) 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.
virtual const char * GetName() const
Returns name of object.
The TEnumConstant class implements the constants of the enum type.
virtual const char * Getp2f2funcname(void *receiver) const
virtual bool TypedefInfo_IsValid(TypedefInfo_t *tinfo) const
virtual Bool_t LoadText(const char *text) const
Load the declarations from text into the interpreter.
The ROOT global object gROOT contains a list of all defined classes.
virtual int MethodInfo_Next(MethodInfo_t *minfo) const
clang::QualType GetQualType() const
virtual int MethodInfo_NDefaultArg(MethodInfo_t *minfo) const
virtual int MethodArgInfo_Next(MethodArgInfo_t *marginfo) const
Global variables class (global variables are obtained from CINT).
void * LazyFunctionCreatorAutoload(const std::string &mangled_name)
Autoload a library based on a missing symbol.
Version_t GetClassVersion() const
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)
THashList * GetTable() const
virtual void CallFunc_SetFuncProto(CallFunc_t *func, ClassInfo_t *info, const char *method, const char *proto, Long_t *Offset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
Interface to cling function.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual const char * MethodInfo_GetPrototype(MethodInfo_t *minfo) const
TDictionary::DeclId_t GetDeclId() const
virtual void CallFunc_ExecWithArgsAndReturn(CallFunc_t *func, void *address, const void *args[]=0, int nargs=0, void *ret=0) const
TObject * TCling__GetObjectAddress(const char *Name, void *&LookupCtx)
virtual Bool_t FuncTempInfo_IsValid(FuncTempInfo_t *) const
Check validity of a FuncTempInfo_t.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Each class (see TClass) has a linked list of its base class(es).
const char * Name() const
Get the name of the current typedef.
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)
bool IsAutoloadingEnabled()
const char * TypeName() const
TDictionary::DeclId_t DeclId_t
#define R__LOCKGUARD2(mutex)
virtual void CallFunc_Delete(CallFunc_t *func) const
Bool_t CallShowMembers(const void *obj, TMemberInspector &insp, Bool_t isTransient=kFALSE) const
Call ShowMembers() on the obj of this class type, passing insp and parent.
std::unordered_set< const clang::NamespaceDecl * > fNSFromRootmaps
virtual const char * BaseClassInfo_FullName(BaseClassInfo_t *bcinfo) const
virtual MethodInfo_t * MethodInfo_Factory() const
void TCling__GetNormalizedContext(const ROOT::TMetaUtils::TNormalizedCtxt *&normCtxt)
int Size() const
Return the size in bytes of the underlying type of the current typedef.
virtual const void * GetValAddr() const =0
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.
std::string GetMangledName() const
TString & Remove(Ssiz_t pos)
const char * Name(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
void SetClassInfo(TClass *cl, Bool_t reload=kFALSE)
Set pointer to the TClingClassInfo in TClass.
Emulation of the CINT TypedefInfo class.
const clang::Decl * GetDecl() const
const char * TypeName() const
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
int(* AutoLoadCallBack_t)(const char *)
virtual const char * MethodArgInfo_DefaultValue(MethodArgInfo_t *marginfo) const
virtual const char * ClassInfo_Name(ClassInfo_t *info) const
virtual const char * GetIncludePath()
Get the list of include path.
virtual bool DataMemberInfo_IsValid(DataMemberInfo_t *dminfo) const
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 GetFunctionOverloads(ClassInfo_t *cl, const char *funcname, std::vector< DeclId_t > &res) const
Insert overloads of name in cl to res.
void UpdateListsOnUnloaded(const cling::Transaction &T)
virtual FuncTempInfo_t * FuncTempInfo_Factory(DeclId_t declid) const
Construct a FuncTempInfo_t.
TObjArray * fStreamerInfo
virtual void FuncTempInfo_Title(FuncTempInfo_t *, TString &name) const
Return the comments associates with this function template.
std::set< size_t > fLookedUpClasses
void UpdateListOfDataMembers(TClass *cl) const
Update the list of pointers to data members for TClass cl This is now a nop.
MyComplex< T > P(MyComplex< T > z, T c_real, T c_imag)
[MyComplex]
const char * GetParent() const
void UnloadClassMembers(TClass *cl, const clang::DeclContext *DC)
Helper function to go through the members of a class or namespace and unload them.
EState fState
cached of the streaming method to use
void TCling__LibraryLoadedRTTI(const void *dyLibHandle, const char *canonicalName)
Emulation of the CINT MethodInfo class.
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
static DictFuncPtr_t GetDict(const char *cname)
Given the class name returns the Dictionary() function of a class (uses hash of name).
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'...
TFunction * Find(DeclId_t id) const
Return the TMethod or TFunction describing the function corresponding to the Decl 'id'...
virtual const char * DataMemberInfo_Name(DataMemberInfo_t *dminfo) const
void Unload()
Mark 'all func' as being unloaded.
virtual int DataMemberInfo_ArrayDim(DataMemberInfo_t *dminfo) 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)
virtual void CallFunc_ResetArg(CallFunc_t *func) const
virtual void FuncTempInfo_Delete(FuncTempInfo_t *) const
Delete the FuncTempInfo_t.
TDictionary::DeclId_t DeclId_t
void DeleteArray(void *arena, bool dtorOnly, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
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
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...
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
virtual Long64_t CallFunc_ExecInt64(CallFunc_t *func, void *address) const
void Reset()
Pressing Ctrl+C should forward here.
Int_t LoadLibraryMap(const char *rootmapfile=0)
Load map between class and library.
void CreateListOfMethodArgs(TFunction *m) const
Create list of pointers to method arguments for TMethod m.
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
void FullName(std::string &output, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
TClingCallbacks * fClingCallbacks
Int_t AutoLoad(const char *classname, Bool_t knowDictNotLoaded=kFALSE)
Load library containing the specified class.
Emulation of the CINT ClassInfo class.
EObjectPointerState GetObjectValidity() const
virtual ~TROOT()
Clean up and free resources used by ROOT (files, network sockets, shared memory segments, etc.).
virtual int GetSecurityError() const
Interface to cling function.
#define R__LOCKGUARD(mutex)
void InspectMember(const T &obj, const char *name, Bool_t isTransient)
Int_t GetEntries() const
Return the number of objects in array (i.e.
virtual void Add(TObject *obj)=0
virtual void * MethodInfo_InterfaceMethod(MethodInfo_t *minfo) const
void SetGetline(const char *(*getlineFunc)(const char *prompt), void(*histaddFunc)(const char *line))
Set a getline function to call when input is needed.
const clang::ValueDecl * GetDataMember(const char *name) 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.
virtual void ClassInfo_Delete(ClassInfo_t *info) const
void Delete(void *arena, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) 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 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...
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...
static TClass * LoadClass(const char *requestedname, Bool_t silent)
Helper function used by TClass::GetClass().
void UpdateListOfMethods(TClass *cl) const
Update the list of pointers to method for TClass cl This is now a nop.
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
void * New(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
virtual const char * TypedefInfo_Name(TypedefInfo_t *tinfo) const
void RecursiveRemove(TObject *obj)
Delete object from cling symbol table so it can not be used anymore.
TDataMember * GetDataMember(const char *datamember) const
Return pointer to datamember object with name "datamember".
virtual int ClassInfo_Size(ClassInfo_t *info) const
void UnRegisterTClassUpdate(const TClass *oldcl)
If the dictionary is loaded, we can remove the class from the list (otherwise the class might be load...
virtual Double_t CallFunc_ExecDouble(CallFunc_t *func, void *address) const
Mother of all ROOT objects.
virtual bool ClassInfo_HasMethod(ClassInfo_t *info, const char *name) const
void TCling__LibraryUnloadedRTTI(const void *dyLibHandle, const char *canonicalName)
virtual Long_t MethodArgInfo_Property(MethodArgInfo_t *marginfo) const
void RegisterTemporary(const TInterpreterValue &value)
virtual void Inspect(TClass *cl, const char *parent, const char *name, const void *addr)
virtual Long_t Getgvp() const
Interface to the CINT global object pointer which was controlling the behavior of the wrapper around ...
TClassRef is used to implement a permanent reference to a TClass object.
void HandleNewDecl(const void *DV, bool isDeserialized, std::set< TClass * > &modifiedClasses)
typedef void((*Func_t)())
void Unload()
Mark 'all func' as being unloaded.
const char * GetDeclFileName() const
virtual bool ClassInfo_IsLoaded(ClassInfo_t *info) const
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
virtual DeclId_t GetDataMemberWithValue(const void *ptrvalue) const
NOT IMPLEMENTED.
void SetAutoloadingEnabled(bool val=true)
Bridge between cling::Value and ROOT.
virtual const char * MethodInfo_Name(MethodInfo_t *minfo) const
const char * GetUnqualifiedName(const char *name)
Return the start of the unqualified name include in 'original'.
const char * GetFullTypeName() const
Get full type description of method argument, e.g.: "class TDirectory*".
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)
TClingMethodInfo GetMethodWithArgs(const char *fname, const char *arglist, long *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch, EInheritanceMode imode=kWithInheritance) const
virtual bool ClassInfo_IsValid(ClassInfo_t *info) const
virtual Long_t ClassInfo_Tagnum(ClassInfo_t *info) const
Bool_t fHeaderParsingOnDemand
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Long_t MethodInfo_ExtraProperty(MethodInfo_t *minfo) const
Each ROOT class (see TClass) has a linked list of methods.
std::vector< std::pair< TClass *, DictFuncPtr_t > > fClassesToUpdate
virtual void CallFunc_IgnoreExtraArgs(CallFunc_t *func, bool ignore) const
virtual const char * GetSTLIncludePath() const
Return the directory containing CINT's stl cintdlls.
static void * fgSetOfSpecials
virtual const char * MethodInfo_TypeName(MethodInfo_t *minfo) const
static void SetFactory(TVirtualStreamerInfo *factory)
static function: Set the StreamerInfo factory
long ExecInt(void *address)
Int_t SetClassSharedLibs(const char *cls, const char *libs)
Register the autoloading information for a class.
Bool_t IsLoaded(const char *filename) const
Return true if the file has already been loaded by cint.
bool IsValid() const
Return true if the current iterator position is valid.
virtual void ClassInfo_Destruct(ClassInfo_t *info, void *arena) const
virtual const char * ClassInfo_FullName(ClassInfo_t *info) const
virtual void UpdateEnumConstants(TEnum *enumObj, TClass *cl) const
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
ROOT::ESTLType GetCollectionType() const
Return the 'type' of the STL the TClass is representing.
Bool_t SetSuspendAutoParsing(Bool_t value)
Suspend the Autoparsing of headers.
virtual const char * BaseClassInfo_TmpltName(BaseClassInfo_t *bcinfo) const
virtual const char * MethodArgInfo_Name(MethodArgInfo_t *marginfo) const
virtual const char * ClassInfo_TmpltName(ClassInfo_t *info) const
static bool R__InitStreamerInfoFactory()
Helper to initialize TVirtualStreamerInfo's factor early.
Bool_t IsErrorMessagesEnabled() const
If error messages are disabled, the interpreter should suppress its failures and warning messages fro...
void IgnoreExtraArgs(bool ignore)
Bool_t fIsAutoParsingSuspended
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.
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.
std::hash< std::string > fStringHashFunction
virtual void TypedefInfo_Init(TypedefInfo_t *tinfo, const char *name) const
const char * GetSharedLibs()
Return the list of shared libraries loaded into the process.
TObject * At(Int_t idx) const
bool IsBase(const char *name) const
static const char * FindLibraryName(void(*func)())
Wrapper around dladdr (and friends)
virtual EReturnType MethodInfo_MethodCallReturnType(MethodInfo_t *minfo) const
R__EXTERN TInterpreter * gCling
R__DLLEXPORT TInterpreter * CreateInterpreter(void *interpLibHandle)
virtual void * FindSym(const char *entry) const
Interface to cling function.
virtual void Compress()
Remove empty slots from array.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
bool IsValidMethod(const char *method, const char *proto, Bool_t objectIsConst, long *offset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
Long_t ProcessLineAsynch(const char *line, EErrorCode *error=0)
Let cling process a command line asynch.
static void output(int code)
virtual void DataMemberInfo_Delete(DataMemberInfo_t *dminfo) const
void TCling__TransactionRollback(const cling::Transaction &T)
virtual const char * GetTitle() const
Returns title of object.
TList * GetListOfMethods(Bool_t load=kTRUE)
Return list containing the TMethods of a class.
std::string NormalizedName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Return the normalized name of the type (i.e.
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.
virtual ClassInfo_t * BaseClassInfo_ClassInfo(BaseClassInfo_t *) const
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 EReturnType MethodCallReturnType(TFunction *func) const
static char * skip(char **buf, const char *delimiters)
void LibraryUnloaded(const void *dyLibHandle, const char *canonicalName)
void RewindDictionary()
Rewind Cling dictionary to the point where it was before executing the current macro.
virtual MethodArgInfo_t * MethodArgInfo_FactoryCopy(MethodArgInfo_t *marginfo) const
void AddIncludePath(const char *path)
Add the given path to the list of directories in which the interpreter looks for include files...
void CreateListOfMethods(TClass *cl) const
Create list of pointers to methods for TClass cl.
Int_t DeleteGlobal(void *obj)
Delete obj from Cling symbol table so it cannot be accessed anymore.
virtual TypeInfo_t * TypeInfo_Factory() const
virtual const char * MethodArgInfo_TypeName(MethodArgInfo_t *marginfo) const
TDictionary::DeclId_t GetDeclId() const
virtual void SetErrmsgcallback(void *p) const
Set a callback to receive error messages.
void ResetGlobals()
Reset in Cling the list of global variables to the state saved by the last call to TCling::SaveGlobal...
virtual const char * TypedefInfo_Title(TypedefInfo_t *tinfo) const
Int_t Size() const
Return size of object of this class.
virtual void SetAlloclockfunc(void(*)()) const
[Place holder for Mutex Lock] Provide the interpreter with a way to acquire a lock used to protect cr...
void ExecWithArgsAndReturn(void *address, const void *args[]=0, int nargs=0, void *ret=0)
virtual void CallFunc_SetArg(CallFunc_t *func, Long_t param) const
if(line.BeginsWith("/*"))
virtual Long_t FuncTempInfo_Property(FuncTempInfo_t *) const
Return the property of the function template.
DeclId_t GetDeclId() const
virtual DataMemberInfo_t * DataMemberInfo_FactoryCopy(DataMemberInfo_t *dminfo) const
void ExecWithReturn(void *address, void *ret=0)
virtual int UnloadFile(const char *path) const
virtual int DataMemberInfo_Next(DataMemberInfo_t *dminfo) 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.
virtual int ClassInfo_GetMethodNArg(ClassInfo_t *info, const char *method, const char *proto, Bool_t objectIsConst=false, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) const
TList * GetListOfFunctionTemplates(Bool_t load=kTRUE)
Return list containing the TEnums of a class.
virtual const char * GetClassSharedLibs(const char *cls)=0
long long ExecInt64(void *address)
virtual void FuncTempInfo_Name(FuncTempInfo_t *, TString &name) const
Return the name of this function template.
virtual void TypedefInfo_Delete(TypedefInfo_t *tinfo) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.