12#ifndef ROOT_TMetaUtils
13#define ROOT_TMetaUtils
20#include <unordered_set>
28#if defined(__GNUC__) && !defined(__clang__)
29#pragma GCC diagnostic push
30#pragma GCC diagnostic ignored "-Wpragmas"
31#pragma GCC diagnostic ignored "-Wclass-memaccess"
34#include "clang/Basic/Module.h"
36#if defined(__GNUC__) && !defined(__clang__)
37#pragma GCC diagnostic pop
47 class ClassTemplateDecl;
48 class ClassTemplateSpecializationDecl;
49 class CompilerInstance;
50 class CXXBaseSpecifier;
66 class TemplateArgument;
67 class TemplateArgumentList;
68 class TemplateParameterList;
71 class TypedefNameDecl;
72 struct PrintingPolicy;
100class AnnotatedRecordDecl;
107 static const std::string
iotype(
"iotype");
108 static const std::string
name(
"name");
110 static const std::string
ioname(
"ioname");
121 const cling::Interpreter &interp,
123 std::ostream& dictStream,
124 bool isAutoStreamer);
156 bool replace =
false);
178 bool *shuttingDownPtr,
179 const int *pgDebug = 0);
185 bool IsDeclaredScope(
const std::string &base,
bool &isInlined)
override;
194 const std::string &normalizedName);
216 const clang::RecordDecl *decl,
219 bool rRequestNoInputOperator,
220 bool rRequestOnlyTClass,
221 int rRequestedVersionNumber,
222 const cling::Interpreter &interpret,
226 const clang::RecordDecl *decl,
227 const char *requestName,
230 bool rRequestNoInputOperator,
231 bool rRequestOnlyTClass,
232 int rRequestedVersionNumber,
233 const cling::Interpreter &interpret,
237 const clang::Type *requestedType,
238 const clang::RecordDecl *decl,
239 const char *requestedName,
242 bool rRequestNoInputOperator,
243 bool rRequestOnlyTClass,
244 int rRequestedVersionNumber,
245 const cling::Interpreter &interpret,
249 const clang::Type *requestedType,
250 const clang::RecordDecl *decl,
251 const char *requestedName,
252 unsigned int nTemplateArgsToSkip,
255 bool rRequestNoInputOperator,
256 bool rRequestOnlyTClass,
257 int rRequestedVersionNumber,
258 const cling::Interpreter &interpret,
292 operator clang::RecordDecl
const *()
const {
319 const clang::CXXRecordDecl *
GetType()
const;
336 const std::string& propName,
337 std::string& propValue);
341 const std::string& propName,
348bool RequireCompleteType(
const cling::Interpreter &interp, clang::SourceLocation Loc, clang::QualType Type);
353 const cling::Interpreter &interpret,
357llvm::StringRef
DataMemberInfo__ValidArrayIndex(
const cling::Interpreter& interp,
const clang::DeclaratorDecl &
m,
int *errnum =
nullptr, llvm::StringRef *errstr =
nullptr);
371const clang::FunctionDecl*
ClassInfo__HasMethod(
const clang::DeclContext *cl,
char const*,
const cling::Interpreter& interp);
375 const clang::NamedDecl &forcontext,
376 const clang::QualType &qti,
379 const cling::Interpreter &interp,
383bool IsBase(
const clang::CXXRecordDecl *cl,
const clang::CXXRecordDecl *base,
const clang::CXXRecordDecl *context,
const cling::Interpreter &interp);
386bool IsBase(
const clang::FieldDecl &
m,
const char* basename,
const cling::Interpreter &interp);
404bool HasNewMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
407bool HasOldMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
410bool hasOpaqueTypedef(clang::QualType instanceType,
const TNormalizedCtxt &normCtxt);
413bool hasOpaqueTypedef(
const AnnotatedRecordDecl &cl,
const cling::Interpreter &interp,
const TNormalizedCtxt &normCtxt);
419bool NeedDestructor(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
426 const cling::Interpreter&,
bool diagnose);
435void GetQualifiedName(std::string &qual_name,
const clang::QualType &
type,
const clang::NamedDecl &forcontext);
441void GetQualifiedName(std::string &qual_name,
const clang::Type &
type,
const clang::NamedDecl &forcontext);
453void GetQualifiedName(std::string &qual_name,
const AnnotatedRecordDecl &annotated);
459void GetQualifiedName(std::string &qual_name,
const clang::RecordDecl &recordDecl);
471void WritePointersSTL(
const AnnotatedRecordDecl &cl,
const cling::Interpreter &interp,
const TNormalizedCtxt &normCtxt);
474int GetClassVersion(
const clang::RecordDecl *cl,
const cling::Interpreter &interp);
489 const std::function<
void(
const clang::Module::Header &)> &closure,
490 bool includeDirectlyUsedModules =
true);
505std::string
TrueName(
const clang::FieldDecl &
m);
509 const cling::Interpreter &
gInterp,
511 const clang::Type** resultType);
515 const AnnotatedRecordDecl &cl,
516 const clang::CXXRecordDecl *decl,
517 const cling::Interpreter &interp,
519 const TNormalizedCtxt &normCtxt);
526 const cling::Interpreter &
gInterp,
531 const AnnotatedRecordDecl &cl,
532 const cling::Interpreter &interp,
533 const TNormalizedCtxt &normCtxt,
534 std::ostream& finalString,
540 const AnnotatedRecordDecl &cl,
541 const clang::CXXRecordDecl *decl,
542 const cling::Interpreter &interp,
543 const TNormalizedCtxt &normCtxt,
545 bool& needCollectionProxy);
549 const clang::CXXRecordDecl* clxx,
550 const cling::Interpreter &interp,
551 const TNormalizedCtxt &normCtxt);
555 const clang::CXXRecordDecl* clxx,
556 const cling::Interpreter &interp,
557 const TNormalizedCtxt &normCtxt);
561std::string
GetFileName(
const clang::Decl& decl,
const cling::Interpreter& interp);
576 std::string nameForDlsym =
name;
578#if defined(R__MACOSX) || defined(R__WIN32)
583 if (nameForDlsym[0] ==
'_')
584 nameForDlsym.erase(0, 1);
606clang::QualType
GetNormalizedType(
const clang::QualType &
type,
const cling::Interpreter &interpreter,
const TNormalizedCtxt &normCtxt);
613void GetNormalizedName(std::string &norm_name,
const clang::QualType &
type,
const cling::Interpreter &interpreter,
const TNormalizedCtxt &normCtxt);
618 const clang::TypeDecl* typeDecl,
619 const cling::Interpreter &interpreter);
624clang::QualType
GetTypeForIO(
const clang::QualType& templateInstanceType,
625 const cling::Interpreter &interpreter,
626 const TNormalizedCtxt &normCtxt,
632std::pair<std::string,clang::QualType>
GetNameTypeForIO(
const clang::QualType& templateInstanceType,
633 const cling::Interpreter &interpreter,
634 const TNormalizedCtxt &normCtxt,
639llvm::StringRef
GetComment(
const clang::Decl &decl, clang::SourceLocation *loc = 0);
643bool HasClassDefMacro(
const clang::Decl *decl,
const cling::Interpreter &interpreter);
647llvm::StringRef
GetClassComment(
const clang::CXXRecordDecl &decl, clang::SourceLocation *loc,
const cling::Interpreter &interpreter);
663 Redecl = Redecl->getMostRecentDecl();
664 while (Redecl && !Redecl->hasAttrs())
665 Redecl = Redecl->getPreviousDecl();
694bool IsOfType(
const clang::CXXRecordDecl &cl,
const std::string&
type,
const cling::LookupHelper& lh);
715 clang::ClassTemplateDecl*& ctd,
716 clang::ClassTemplateSpecializationDecl*& ctsd);
724 std::list<std::pair<std::string,bool> >&);
727 std::list<std::pair<std::string,bool> >&);
731 std::list<std::pair<std::string,unsigned int> >& enclosingSc);
741void ReplaceAll(std::string& str,
const std::string& from,
const std::string& to,
bool recurse=
false);
748 static unsigned int gNumberOfErrors = 0;
749 return gNumberOfErrors;
756 static bool gWarningsAreErrors =
false;
757 return gWarningsAreErrors;
768inline void LevelPrint(
bool prefix,
int level,
const char *location,
const char *fmt, va_list ap)
773 const char *
type = 0;
788 if (!location || !location[0]) {
789 if (prefix) fprintf(stderr,
"%s: ",
type);
790 vfprintf(stderr, (
const char*)
va_(fmt), ap);
792 if (prefix) fprintf(stderr,
"%s in <%s>: ",
type, location);
793 else fprintf(stderr,
"In <%s>: ", location);
794 vfprintf(stderr, (
const char*)
va_(fmt), ap);
807inline void Error(
const char *location,
const char *
va_(fmt), ...)
810 va_start(ap,
va_(fmt));
817inline void SysError(
const char *location,
const char *
va_(fmt), ...)
820 va_start(ap,
va_(fmt));
827inline void Info(
const char *location,
const char *
va_(fmt), ...)
830 va_start(ap,
va_(fmt));
837inline void Warning(
const char *location,
const char *
va_(fmt), ...)
840 va_start(ap,
va_(fmt));
847inline void Fatal(
const char *location,
const char *
va_(fmt), ...)
850 va_start(ap,
va_(fmt));
859bool EndsWith(
const std::string &theString,
const std::string &theSubstring);
862bool BeginsWith(
const std::string &theString,
const std::string &theSubstring);
871namespace AST2SourceTools {
875 bool (*ignoreFiles)(
const clang::PresumedLoc&) ,
876 const cling::Interpreter& interp, std::string *logs);
880 const clang::TemplateParameterList& tmplParamList,
881 const cling::Interpreter& interpreter);
887const clang::RecordDecl*
EncloseInScopes(
const clang::Decl& decl, std::string& defString);
891 const cling::Interpreter& interpreter,
892 std::string& defString,
893 bool acceptStl=
false);
897 const cling::Interpreter& interpreter,
898 std::string& defString);
902 const cling::Interpreter& interpreter,
903 std::string& defString,
904 const std::string &normalizedName);
906int GetDefArg(
const clang::ParmVarDecl& par, std::string& valAsString,
const clang::PrintingPolicy& pp);
910 const cling::Interpreter& interpreter,
911 std::string& defString);
914 const cling::Interpreter& interpreter,
915 std::string& fwdDeclString,
916 std::unordered_set<std::string>* fwdDeclSet=
nullptr);
cling::Interpreter * gInterp
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
Type
enumeration specifying the integration types.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.