12#ifndef ROOT_TMetaUtils
13#define ROOT_TMetaUtils
18#include <unordered_set>
26#if defined(__GNUC__) && !defined(__clang__)
27#pragma GCC diagnostic push
28#pragma GCC diagnostic ignored "-Wpragmas"
29#pragma GCC diagnostic ignored "-Wclass-memaccess"
32#include "clang/Basic/Module.h"
34#if defined(__GNUC__) && !defined(__clang__)
35#pragma GCC diagnostic pop
45 class ClassTemplateDecl;
46 class ClassTemplateSpecializationDecl;
47 class CompilerInstance;
48 class CXXBaseSpecifier;
64 class TemplateArgument;
65 class TemplateArgumentList;
66 class TemplateParameterList;
69 class TypedefNameDecl;
70 struct PrintingPolicy;
105 static const std::string
iotype(
"iotype");
106 static const std::string
name(
"name");
108 static const std::string
ioname(
"ioname");
119 const cling::Interpreter &interp,
121 std::ostream& dictStream,
122 bool isAutoStreamer);
154 bool replace =
false);
177 const int *pgDebug =
nullptr);
184 bool IsDeclaredScope(
const std::string &base,
bool &isInlined)
override;
193 const std::string &normalizedName);
225 const clang::RecordDecl *decl,
228 bool rRequestNoInputOperator,
229 bool rRequestOnlyTClass,
230 int rRequestedVersionNumber,
231 int rRequestedRNTupleSerializationMode,
232 const std::string &rRequestedRNTupleSoARecord,
233 const cling::Interpreter &interpret,
237 const clang::RecordDecl *decl,
238 const char *requestName,
241 bool rRequestNoInputOperator,
242 bool rRequestOnlyTClass,
243 int rRequestedVersionNumber,
244 int rRequestedRNTupleSerializationMode,
245 const std::string &rRequestedRNTupleSoARecord,
246 const cling::Interpreter &interpret,
250 const clang::Type *requestedType,
251 const clang::RecordDecl *decl,
252 const char *requestedName,
255 bool rRequestNoInputOperator,
256 bool rRequestOnlyTClass,
257 int rRequestedVersionNumber,
258 int rRequestedRNTupleSerializationMode,
259 const std::string &rRequestedRNTupleSoARecord,
260 const cling::Interpreter &interpret,
264 const clang::Type *requestedType,
265 const clang::RecordDecl *decl,
266 const char *requestedName,
267 unsigned int nTemplateArgsToSkip,
270 bool rRequestNoInputOperator,
271 bool rRequestOnlyTClass,
272 int rRequestedVersionNumber,
273 int rRequestedRNTupleSerializationMode,
274 const std::string &rRequestedRNTupleSoARecord,
275 const cling::Interpreter &interpret,
314 default: assert(
false &&
"invalid setting of fRequestedRNTupleSerializationMode");
320 operator clang::RecordDecl
const *()
const {
347 const clang::CXXRecordDecl *
GetType()
const;
364 const std::string& propName,
365 std::string& propValue);
369 const std::string& propName,
376bool RequireCompleteType(
const cling::Interpreter &interp, clang::SourceLocation Loc, clang::QualType Type);
381 const cling::Interpreter &interpret,
385llvm::StringRef
DataMemberInfo__ValidArrayIndex(
const cling::Interpreter& interp,
const clang::DeclaratorDecl &
m,
int *errnum =
nullptr, llvm::StringRef *errstr =
nullptr);
399const clang::FunctionDecl*
ClassInfo__HasMethod(
const clang::DeclContext *cl,
char const*,
const cling::Interpreter& interp);
403 const clang::NamedDecl &forcontext,
404 const clang::QualType &qti,
407 const cling::Interpreter &interp,
408 const char *tcl =
nullptr);
411bool IsBase(
const clang::CXXRecordDecl *cl,
const clang::CXXRecordDecl *base,
const clang::CXXRecordDecl *context,
const cling::Interpreter &interp);
414bool IsBase(
const clang::FieldDecl &
m,
const char* basename,
const cling::Interpreter &interp);
432bool HasNewMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
435bool HasOldMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
438bool hasOpaqueTypedef(clang::QualType instanceType,
const TNormalizedCtxt &normCtxt);
441bool hasOpaqueTypedef(
const AnnotatedRecordDecl &cl,
const cling::Interpreter &interp,
const TNormalizedCtxt &normCtxt);
447bool NeedDestructor(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
454 const cling::Interpreter&,
bool diagnose);
463void GetQualifiedName(std::string &qual_name,
const clang::QualType &
type,
const clang::NamedDecl &forcontext);
469void GetQualifiedName(std::string &qual_name,
const clang::Type &
type,
const clang::NamedDecl &forcontext);
481void GetQualifiedName(std::string &qual_name,
const AnnotatedRecordDecl &annotated);
487void GetQualifiedName(std::string &qual_name,
const clang::RecordDecl &recordDecl);
499void WritePointersSTL(
const AnnotatedRecordDecl &cl,
const cling::Interpreter &interp,
const TNormalizedCtxt &normCtxt);
502int GetClassVersion(
const clang::RecordDecl *cl,
const cling::Interpreter &interp);
517 const std::function<
void(
const clang::Module::Header &)> &closure,
518 bool includeDirectlyUsedModules =
true);
533std::string
TrueName(
const clang::FieldDecl &
m);
537 const cling::Interpreter &gInterp,
539 const clang::Type** resultType);
543 const AnnotatedRecordDecl &cl,
544 const clang::CXXRecordDecl *decl,
545 const cling::Interpreter &interp,
547 const TNormalizedCtxt &normCtxt);
554 const cling::Interpreter &gInterp,
559 const AnnotatedRecordDecl &cl,
560 const cling::Interpreter &interp,
561 const TNormalizedCtxt &normCtxt,
562 std::ostream& finalString,
568 const AnnotatedRecordDecl &cl,
569 const clang::CXXRecordDecl *decl,
570 const cling::Interpreter &interp,
571 const TNormalizedCtxt &normCtxt,
573 bool& needCollectionProxy);
577 const cling::Interpreter &interp);
581 const std::vector<std::string> &standaloneTargets);
585 const clang::CXXRecordDecl* clxx,
586 const cling::Interpreter &interp,
587 const TNormalizedCtxt &normCtxt);
591 const clang::CXXRecordDecl* clxx,
592 const cling::Interpreter &interp,
593 const TNormalizedCtxt &normCtxt);
597std::string
GetFileName(
const clang::Decl& decl,
const cling::Interpreter& interp);
606void GetCppName(std::string &output,
const char *input);
612 std::string nameForDlsym =
name;
614#if defined(R__MACOSX) || defined(R__WIN32)
619 if (nameForDlsym[0] ==
'_')
620 nameForDlsym.erase(0, 1);
642clang::QualType
GetNormalizedType(
const clang::QualType &
type,
const cling::Interpreter &interpreter,
const TNormalizedCtxt &normCtxt);
649void GetNormalizedName(std::string &norm_name,
const clang::QualType &
type,
const cling::Interpreter &interpreter,
const TNormalizedCtxt &normCtxt);
654 const clang::TypeDecl* typeDecl,
655 const cling::Interpreter &interpreter);
660clang::QualType
GetTypeForIO(
const clang::QualType& templateInstanceType,
661 const cling::Interpreter &interpreter,
662 const TNormalizedCtxt &normCtxt,
668std::pair<std::string,clang::QualType>
GetNameTypeForIO(
const clang::QualType& templateInstanceType,
669 const cling::Interpreter &interpreter,
670 const TNormalizedCtxt &normCtxt,
675llvm::StringRef
GetComment(
const clang::Decl &decl, clang::SourceLocation *loc =
nullptr);
679bool HasClassDefMacro(
const clang::Decl *decl,
const cling::Interpreter &interpreter);
683llvm::StringRef
GetClassComment(
const clang::CXXRecordDecl &decl, clang::SourceLocation *loc,
const cling::Interpreter &interpreter);
699 Redecl = Redecl->getMostRecentDecl();
700 while (Redecl && !Redecl->hasAttrs())
701 Redecl = Redecl->getPreviousDecl();
740bool IsOfType(
const clang::CXXRecordDecl &cl,
const std::string&
type,
const cling::LookupHelper& lh);
761 clang::ClassTemplateDecl*& ctd,
762 clang::ClassTemplateSpecializationDecl*& ctsd);
770 std::list<std::pair<std::string,bool> >&);
773 std::list<std::pair<std::string,bool> >&);
777 std::list<std::pair<std::string,unsigned int> >& enclosingSc);
787void ReplaceAll(std::string& str,
const std::string& from,
const std::string& to,
bool recurse=
false);
794 static unsigned int gNumberOfErrors = 0;
795 return gNumberOfErrors;
802 static bool gWarningsAreErrors =
false;
803 return gWarningsAreErrors;
814inline void LevelPrint(
bool prefix,
int level,
const char *location,
const char *fmt, va_list ap)
819 const char *
type =
nullptr;
834 if (!location || !location[0]) {
835 if (prefix) fprintf(stderr,
"%s: ",
type);
836 vfprintf(stderr, (
const char*)
va_(fmt), ap);
838 if (prefix) fprintf(stderr,
"%s in <%s>: ",
type, location);
839 else fprintf(stderr,
"In <%s>: ", location);
840 vfprintf(stderr, (
const char*)
va_(fmt), ap);
853inline void Error(
const char *location,
const char *
va_(fmt), ...)
856 va_start(ap,
va_(fmt));
863inline void SysError(
const char *location,
const char *
va_(fmt), ...)
866 va_start(ap,
va_(fmt));
873inline void Info(
const char *location,
const char *
va_(fmt), ...)
876 va_start(ap,
va_(fmt));
883inline void Warning(
const char *location,
const char *
va_(fmt), ...)
886 va_start(ap,
va_(fmt));
893inline void Fatal(
const char *location,
const char *
va_(fmt), ...)
896 va_start(ap,
va_(fmt));
905bool EndsWith(
const std::string &theString,
const std::string &theSubstring);
908bool BeginsWith(
const std::string &theString,
const std::string &theSubstring);
921 bool (*ignoreFiles)(
const clang::PresumedLoc&) ,
922 const cling::Interpreter& interp, std::string *logs);
926 const clang::TemplateParameterList& tmplParamList,
927 const cling::Interpreter& interpreter);
933const clang::RecordDecl*
EncloseInScopes(
const clang::Decl& decl, std::string& defString);
937 const cling::Interpreter& interpreter,
938 std::string& defString,
939 bool acceptStl=
false);
943 const cling::Interpreter& interpreter,
944 std::string& defString);
948 const cling::Interpreter& interpreter,
949 std::string& defString,
950 const std::string &normalizedName);
952int GetDefArg(
const clang::ParmVarDecl& par, std::string& valAsString,
const clang::PrintingPolicy& pp);
956 const cling::Interpreter& interpreter,
957 std::string& defString);
960 const cling::Interpreter& interpreter,
961 std::string& fwdDeclString,
962 std::unordered_set<std::string>* fwdDeclSet=
nullptr);
static Roo_reg_AGKInteg1D instance
externInt_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
Type
enumeration specifying the integration types.