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 virtual bool IsDeclaredScope(
const std::string &base,
bool &isInlined);
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,
371const clang::FunctionDecl*
ClassInfo__HasMethod(
const clang::DeclContext *cl,
char const*,
const cling::Interpreter& interp);
374void CreateNameTypeMap(clang::CXXRecordDecl
const&, std::map<std::string, ROOT::Internal::TSchemaType>&);
378 const clang::NamedDecl &forcontext,
379 const clang::QualType &qti,
382 const cling::Interpreter &interp,
386bool IsBase(
const clang::CXXRecordDecl *cl,
const clang::CXXRecordDecl *base,
const clang::CXXRecordDecl *context,
const cling::Interpreter &interp);
389bool IsBase(
const clang::FieldDecl &
m,
const char* basename,
const cling::Interpreter &interp);
407bool HasNewMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
410bool HasOldMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
422bool NeedDestructor(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
429 const cling::Interpreter&,
bool diagnose);
438void GetQualifiedName(std::string &qual_name,
const clang::QualType &
type,
const clang::NamedDecl &forcontext);
444void GetQualifiedName(std::string &qual_name,
const clang::Type &
type,
const clang::NamedDecl &forcontext);
462void GetQualifiedName(std::string &qual_name,
const clang::RecordDecl &recordDecl);
477int GetClassVersion(
const clang::RecordDecl *cl,
const cling::Interpreter &interp);
492 const std::function<
void(
const clang::Module::Header &)> &closure,
493 bool includeDirectlyUsedModules =
true);
508std::string
TrueName(
const clang::FieldDecl &
m);
512 const cling::Interpreter &
gInterp,
514 const clang::Type** resultType);
519 const clang::CXXRecordDecl *decl,
520 const cling::Interpreter &interp,
529 const cling::Interpreter &
gInterp,
535 const cling::Interpreter &interp,
537 std::ostream& finalString,
544 const clang::CXXRecordDecl *decl,
545 const cling::Interpreter &interp,
548 bool& needCollectionProxy);
552 const clang::CXXRecordDecl* clxx,
553 const cling::Interpreter &interp,
558 const clang::CXXRecordDecl* clxx,
559 const cling::Interpreter &interp,
564llvm::StringRef
GetFileName(
const clang::Decl& decl,
565 const cling::Interpreter& interp);
604 const clang::TypeDecl* typeDecl,
605 const cling::Interpreter &interpreter);
610clang::QualType
GetTypeForIO(
const clang::QualType& templateInstanceType,
611 const cling::Interpreter &interpreter,
618std::pair<std::string,clang::QualType>
GetNameTypeForIO(
const clang::QualType& templateInstanceType,
619 const cling::Interpreter &interpreter,
625llvm::StringRef
GetComment(
const clang::Decl &decl, clang::SourceLocation *loc = 0);
629llvm::StringRef
GetClassComment(
const clang::CXXRecordDecl &decl, clang::SourceLocation *loc,
const cling::Interpreter &interpreter);
645 Redecl = Redecl->getMostRecentDecl();
646 while (Redecl && !Redecl->hasAttrs())
647 Redecl = Redecl->getPreviousDecl();
676bool IsOfType(
const clang::CXXRecordDecl &cl,
const std::string&
type,
const cling::LookupHelper& lh);
686clang::QualType
ReSubstTemplateArg(clang::QualType input,
const clang::Type *instance);
697 clang::ClassTemplateDecl*& ctd,
698 clang::ClassTemplateSpecializationDecl*& ctsd);
706 std::list<std::pair<std::string,bool> >&);
709 std::list<std::pair<std::string,bool> >&);
713 std::list<std::pair<std::string,unsigned int> >& enclosingSc);
723void ReplaceAll(std::string& str,
const std::string& from,
const std::string& to,
bool recurse=
false);
730 static unsigned int gNumberOfErrors = 0;
731 return gNumberOfErrors;
738 static bool gWarningsAreErrors =
false;
739 return gWarningsAreErrors;
750inline void LevelPrint(
bool prefix,
int level,
const char *location,
const char *fmt, va_list ap)
755 const char *
type = 0;
770 if (!location || !location[0]) {
771 if (prefix) fprintf(stderr,
"%s: ",
type);
772 vfprintf(stderr, (
const char*)
va_(fmt), ap);
774 if (prefix) fprintf(stderr,
"%s in <%s>: ",
type, location);
775 else fprintf(stderr,
"In <%s>: ", location);
776 vfprintf(stderr, (
const char*)
va_(fmt), ap);
789inline void Error(
const char *location,
const char *
va_(fmt), ...)
792 va_start(ap,
va_(fmt));
799inline void SysError(
const char *location,
const char *
va_(fmt), ...)
802 va_start(ap,
va_(fmt));
809inline void Info(
const char *location,
const char *
va_(fmt), ...)
812 va_start(ap,
va_(fmt));
819inline void Warning(
const char *location,
const char *
va_(fmt), ...)
822 va_start(ap,
va_(fmt));
829inline void Fatal(
const char *location,
const char *
va_(fmt), ...)
832 va_start(ap,
va_(fmt));
841bool EndsWith(
const std::string &theString,
const std::string &theSubstring);
844bool BeginsWith(
const std::string &theString,
const std::string &theSubstring);
853namespace AST2SourceTools {
857 bool (*ignoreFiles)(
const clang::PresumedLoc&) ,
858 const cling::Interpreter& interp, std::string *logs);
862 const clang::TemplateParameterList& tmplParamList,
863 const cling::Interpreter& interpreter);
869const clang::RecordDecl*
EncloseInScopes(
const clang::Decl& decl, std::string& defString);
873 const cling::Interpreter& interpreter,
874 std::string& defString,
875 bool acceptStl=
false);
879 const cling::Interpreter& interpreter,
880 std::string& defString);
884 const cling::Interpreter& interpreter,
885 std::string& defString,
886 const std::string &normalizedName);
888int GetDefArg(
const clang::ParmVarDecl& par, std::string& valAsString,
const clang::PrintingPolicy& pp);
892 const cling::Interpreter& interpreter,
893 std::string& defString);
896 const cling::Interpreter& interpreter,
897 std::string& fwdDeclString,
898 std::unordered_set<std::string>* fwdDeclSet=
nullptr);
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
cling::Interpreter * gInterp
R__EXTERN Int_t gErrorIgnoreLevel
Type
enumeration specifying the integration types.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
static void output(int code)