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 enum class ElaboratedTypeKeyword;
71 struct PrintingPolicy;
97class AnnotatedRecordDecl;
104 static const std::string
iotype(
"iotype");
105 static const std::string
name(
"name");
107 static const std::string
ioname(
"ioname");
118 const cling::Interpreter &interp,
120 std::ostream& dictStream,
121 bool isAutoStreamer);
153 bool replace =
false);
176 const int *pgDebug =
nullptr);
183 bool IsDeclaredScope(
const std::string &base,
bool &isInlined)
override;
192 const std::string &normalizedName);
224 const clang::RecordDecl *decl,
227 bool rRequestNoInputOperator,
228 bool rRequestOnlyTClass,
229 int rRequestedVersionNumber,
230 int rRequestedRNTupleSerializationMode,
231 const std::string &rRequestedRNTupleSoARecord,
232 const cling::Interpreter &interpret,
236 const clang::RecordDecl *decl,
237 const char *requestName,
240 bool rRequestNoInputOperator,
241 bool rRequestOnlyTClass,
242 int rRequestedVersionNumber,
243 int rRequestedRNTupleSerializationMode,
244 const std::string &rRequestedRNTupleSoARecord,
245 const cling::Interpreter &interpret,
249 const clang::Type *requestedType,
250 const clang::RecordDecl *decl,
251 const char *requestedName,
254 bool rRequestNoInputOperator,
255 bool rRequestOnlyTClass,
256 int rRequestedVersionNumber,
257 int rRequestedRNTupleSerializationMode,
258 const std::string &rRequestedRNTupleSoARecord,
259 const cling::Interpreter &interpret,
263 const clang::Type *requestedType,
264 const clang::RecordDecl *decl,
265 const char *requestedName,
266 unsigned int nTemplateArgsToSkip,
269 bool rRequestNoInputOperator,
270 bool rRequestOnlyTClass,
271 int rRequestedVersionNumber,
272 int rRequestedRNTupleSerializationMode,
273 const std::string &rRequestedRNTupleSoARecord,
274 const cling::Interpreter &interpret,
313 default: assert(
false &&
"invalid setting of fRequestedRNTupleSerializationMode");
319 operator clang::RecordDecl
const *()
const {
346 const clang::CXXRecordDecl *
GetType()
const;
363 const std::string& propName,
364 std::string& propValue);
368 const std::string& propName,
375bool RequireCompleteType(
const cling::Interpreter &interp, clang::SourceLocation Loc, clang::QualType Type);
380 const cling::Interpreter &interpret,
384llvm::StringRef
DataMemberInfo__ValidArrayIndex(
const cling::Interpreter& interp,
const clang::DeclaratorDecl &
m,
int *errnum =
nullptr, llvm::StringRef *errstr =
nullptr);
398const clang::FunctionDecl*
ClassInfo__HasMethod(
const clang::DeclContext *cl,
char const*,
const cling::Interpreter& interp);
402 const clang::NamedDecl &forcontext,
403 const clang::QualType &qti,
406 const cling::Interpreter &interp,
407 const char *tcl =
nullptr);
410bool IsBase(
const clang::CXXRecordDecl *cl,
const clang::CXXRecordDecl *base,
const clang::CXXRecordDecl *context,
const cling::Interpreter &interp);
413bool IsBase(
const clang::FieldDecl &
m,
const char* basename,
const cling::Interpreter &interp);
431bool HasNewMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
434bool HasOldMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
437bool hasOpaqueTypedef(clang::QualType instanceType,
const TNormalizedCtxt &normCtxt);
440bool hasOpaqueTypedef(
const AnnotatedRecordDecl &cl,
const cling::Interpreter &interp,
const TNormalizedCtxt &normCtxt);
446bool NeedDestructor(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
453 const cling::Interpreter&,
bool diagnose);
462void GetQualifiedName(std::string &qual_name,
const clang::QualType &
type,
const clang::NamedDecl &forcontext);
468void GetQualifiedName(std::string &qual_name,
const clang::Type &
type,
const clang::NamedDecl &forcontext);
480void GetQualifiedName(std::string &qual_name,
const AnnotatedRecordDecl &annotated);
486void GetQualifiedName(std::string &qual_name,
const clang::RecordDecl &recordDecl);
498void WritePointersSTL(
const AnnotatedRecordDecl &cl,
const cling::Interpreter &interp,
const TNormalizedCtxt &normCtxt);
501int GetClassVersion(
const clang::RecordDecl *cl,
const cling::Interpreter &interp);
516 const std::function<
void(
const clang::Module::Header &)> &closure,
517 bool includeDirectlyUsedModules =
true);
532std::string
TrueName(
const clang::FieldDecl &
m);
536 const cling::Interpreter &gInterp,
538 const clang::Type** resultType);
542 const AnnotatedRecordDecl &cl,
543 const clang::CXXRecordDecl *decl,
544 const cling::Interpreter &interp,
546 const TNormalizedCtxt &normCtxt);
553 const cling::Interpreter &gInterp,
558 const AnnotatedRecordDecl &cl,
559 const cling::Interpreter &interp,
560 const TNormalizedCtxt &normCtxt,
561 std::ostream& finalString,
567 const AnnotatedRecordDecl &cl,
568 const clang::CXXRecordDecl *decl,
569 const cling::Interpreter &interp,
570 const TNormalizedCtxt &normCtxt,
572 bool& needCollectionProxy);
576 const cling::Interpreter &interp);
580 const std::vector<std::string> &standaloneTargets);
584 const clang::CXXRecordDecl* clxx,
585 const cling::Interpreter &interp,
586 const TNormalizedCtxt &normCtxt);
590 const clang::CXXRecordDecl* clxx,
591 const cling::Interpreter &interp,
592 const TNormalizedCtxt &normCtxt);
596std::string
GetFileName(
const clang::Decl& decl,
const cling::Interpreter& interp);
611 std::string nameForDlsym =
name;
613#if defined(R__MACOSX) || defined(R__WIN32)
618 if (nameForDlsym[0] ==
'_')
619 nameForDlsym.erase(0, 1);
641clang::QualType
GetNormalizedType(
const clang::QualType &
type,
const cling::Interpreter &interpreter,
const TNormalizedCtxt &normCtxt);
648void GetNormalizedName(std::string &norm_name,
const clang::QualType &
type,
const cling::Interpreter &interpreter,
const TNormalizedCtxt &normCtxt);
653 const clang::TypeDecl* typeDecl,
654 const cling::Interpreter &interpreter);
659clang::QualType
GetTypeForIO(
const clang::QualType& templateInstanceType,
660 const cling::Interpreter &interpreter,
661 const TNormalizedCtxt &normCtxt,
667std::pair<std::string,clang::QualType>
GetNameTypeForIO(
const clang::QualType& templateInstanceType,
668 const cling::Interpreter &interpreter,
669 const TNormalizedCtxt &normCtxt,
674llvm::StringRef
GetComment(
const clang::Decl &decl, clang::SourceLocation *loc =
nullptr);
678bool HasClassDefMacro(
const clang::Decl *decl,
const cling::Interpreter &interpreter);
682llvm::StringRef
GetClassComment(
const clang::CXXRecordDecl &decl, clang::SourceLocation *loc,
const cling::Interpreter &interpreter);
698 Redecl = Redecl->getMostRecentDecl();
699 while (Redecl && !Redecl->hasAttrs())
700 Redecl = Redecl->getPreviousDecl();
739bool IsOfType(
const clang::CXXRecordDecl &cl,
const std::string&
type,
const cling::LookupHelper& lh);
760 clang::ClassTemplateDecl*& ctd,
761 clang::ClassTemplateSpecializationDecl*& ctsd);
769 std::list<std::pair<std::string,bool> >&);
772 std::list<std::pair<std::string,bool> >&);
776 std::list<std::pair<std::string,unsigned int> >& enclosingSc);
786void ReplaceAll(std::string& str,
const std::string& from,
const std::string& to,
bool recurse=
false);
793 static unsigned int gNumberOfErrors = 0;
794 return gNumberOfErrors;
801 static bool gWarningsAreErrors =
false;
802 return gWarningsAreErrors;
813inline void LevelPrint(
bool prefix,
int level,
const char *location,
const char *fmt, va_list ap)
818 const char *
type =
nullptr;
833 if (!location || !location[0]) {
834 if (prefix) fprintf(stderr,
"%s: ",
type);
835 vfprintf(stderr, (
const char *)fmt, ap);
837 if (prefix) fprintf(stderr,
"%s in <%s>: ",
type, location);
838 else fprintf(stderr,
"In <%s>: ", location);
839 vfprintf(stderr, (
const char *)fmt, ap);
852inline void Error(
const char *location,
const char *fmt, ...)
862inline void SysError(
const char *location,
const char *fmt, ...)
872inline void Info(
const char *location,
const char *fmt, ...)
882inline void Warning(
const char *location,
const char *fmt, ...)
892inline void Fatal(
const char *location,
const char *fmt, ...)
904bool EndsWith(
const std::string &theString,
const std::string &theSubstring);
907bool BeginsWith(
const std::string &theString,
const std::string &theSubstring);
916namespace AST2SourceTools {
920 bool (*ignoreFiles)(
const clang::PresumedLoc&) ,
921 const cling::Interpreter& interp, std::string *logs);
925 const clang::TemplateParameterList& tmplParamList,
926 const cling::Interpreter& interpreter);
932const clang::RecordDecl*
EncloseInScopes(
const clang::Decl& decl, std::string& defString);
936 const cling::Interpreter& interpreter,
937 std::string& defString,
938 bool acceptStl=
false);
942 const cling::Interpreter& interpreter,
943 std::string& defString);
947 const cling::Interpreter& interpreter,
948 std::string& defString,
949 const std::string &normalizedName);
951int GetDefArg(
const clang::ParmVarDecl& par, std::string& valAsString,
const clang::PrintingPolicy& pp);
955 const cling::Interpreter& interpreter,
956 std::string& defString);
959 const cling::Interpreter& interpreter,
960 std::string& fwdDeclString,
961 std::unordered_set<std::string>* fwdDeclSet=
nullptr);
static Roo_reg_AGKInteg1D instance
Int_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type