12 #ifndef ROOT_TMetaUtils
13 #define ROOT_TMetaUtils
19 #include <unordered_set>
31 class ClassTemplateDecl;
32 class ClassTemplateSpecializationDecl;
33 class CompilerInstance;
34 class CXXBaseSpecifier;
51 class TemplateArgument;
52 class TemplateArgumentList;
53 class TemplateParameterList;
56 class TypedefNameDecl;
57 struct PrintingPolicy;
81 namespace TMetaUtils {
84 class AnnotatedRecordDecl;
90 static const std::string
separator(
"@@@");
91 static const std::string
iotype(
"iotype");
92 static const std::string
name(
"name");
93 static const std::string
pattern(
"pattern");
94 static const std::string
ioname(
"ioname");
95 static const std::string
comment(
"comment");
96 static const std::string
nArgsToKeep(
"nArgsToKeep");
97 static const std::string
persistent(
"persistent");
98 static const std::string
transient(
"transient");
107 const cling::Interpreter &interp,
109 std::ostream& dictStream,
110 bool isAutoStreamer);
113 const int kNote = 500;
114 const int kThrowOnWarning = 999;
115 const int kWarning = 1000;
116 const int kError = 2000;
117 const int kSysError = 3000;
118 const int kFatal = 4000;
119 const int kMaxLen = 1024;
122 class TNormalizedCtxtImpl;
143 bool replace =
false);
158 bool WantDiags()
const {
return fPDebug && *fPDebug > 5; }
164 const int *pgDebug = 0);
170 virtual bool IsDeclaredScope(
const std::string &base,
bool &isInlined);
197 const clang::RecordDecl *decl,
200 bool rRequestNoInputOperator,
201 bool rRequestOnlyTClass,
202 int rRequestedVersionNumber,
203 const cling::Interpreter &interpret,
207 const clang::RecordDecl *decl,
208 const char *requestName,
211 bool rRequestNoInputOperator,
212 bool rRequestOnlyTClass,
213 int rRequestedVersionNumber,
214 const cling::Interpreter &interpret,
219 const clang::RecordDecl *decl,
220 const char *requestedName,
223 bool rRequestNoInputOperator,
224 bool rRequestOnlyTClass,
225 int rRequestedVersionNumber,
226 const cling::Interpreter &interpret,
231 const clang::RecordDecl *decl,
232 const char *requestedName,
233 unsigned int nTemplateArgsToSkip,
236 bool rRequestNoInputOperator,
237 bool rRequestOnlyTClass,
238 int rRequestedVersionNumber,
239 const cling::Interpreter &interpret,
267 if (fRequestedVersionNumber > -1) result |=
kHasVersion;
272 operator clang::RecordDecl
const *()
const {
299 const clang::CXXRecordDecl *
GetType()
const;
319 const std::string& propName,
320 std::string& propValue);
324 const std::string& propName,
328 bool RequireCompleteType(
const cling::Interpreter &interp,
const clang::CXXRecordDecl *cl);
336 const cling::Interpreter &interpret,
352 const clang::FunctionDecl*
ClassInfo__HasMethod(
const clang::DeclContext *cl,
char const*,
const cling::Interpreter& interp);
359 const clang::NamedDecl &forcontext,
360 const clang::QualType &qti,
363 const cling::Interpreter &interp,
367 bool IsBase(
const clang::CXXRecordDecl *cl,
const clang::CXXRecordDecl *base,
const clang::CXXRecordDecl *context,
const cling::Interpreter &interp);
370 bool IsBase(
const clang::FieldDecl &
m,
const char* basename,
const cling::Interpreter &interp);
385 bool HasIOConstructor(clang::CXXRecordDecl
const*, std::string&,
const RConstructorTypes&,
const cling::Interpreter&);
388 bool HasNewMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
391 bool HasOldMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
394 bool hasOpaqueTypedef(clang::QualType instanceType,
const TNormalizedCtxt &normCtxt);
397 bool hasOpaqueTypedef(
const AnnotatedRecordDecl &cl,
const cling::Interpreter &interp,
const TNormalizedCtxt &normCtxt);
410 const cling::Interpreter&,
bool diagnose);
419 void GetQualifiedName(std::string &qual_name,
const clang::QualType &
type,
const clang::NamedDecl &forcontext);
437 void GetQualifiedName(std::string &qual_name,
const AnnotatedRecordDecl &annotated);
443 void GetQualifiedName(std::string &qual_name,
const clang::RecordDecl &recordDecl);
455 void WritePointersSTL(
const AnnotatedRecordDecl &cl,
const cling::Interpreter &interp,
const TNormalizedCtxt &normCtxt);
458 int GetClassVersion(
const clang::RecordDecl *cl,
const cling::Interpreter &interp);
482 std::string
TrueName(
const clang::FieldDecl &
m);
486 const cling::Interpreter &
gInterp,
492 const AnnotatedRecordDecl &cl,
493 const clang::CXXRecordDecl *decl,
494 const cling::Interpreter &interp,
495 const RConstructorTypes& ctorTypes,
496 const TNormalizedCtxt &normCtxt);
503 const cling::Interpreter &
gInterp,
508 const AnnotatedRecordDecl &cl,
509 const cling::Interpreter &interp,
510 const TNormalizedCtxt &normCtxt,
511 std::ostream& finalString,
512 const RConstructorTypes& ctorTypes,
517 const AnnotatedRecordDecl &cl,
518 const clang::CXXRecordDecl *decl,
519 const cling::Interpreter &interp,
520 const TNormalizedCtxt &normCtxt,
521 const RConstructorTypes& ctorTypes,
522 bool& needCollectionProxy);
526 const clang::CXXRecordDecl* clxx,
527 const cling::Interpreter &interp,
528 const TNormalizedCtxt &normCtxt);
532 const clang::CXXRecordDecl* clxx,
533 const cling::Interpreter &interp,
534 const TNormalizedCtxt &normCtxt);
538 llvm::StringRef
GetFileName(
const clang::Decl& decl,
539 const cling::Interpreter& interp);
548 const char* moduleFileName,
549 const char* headers[]);
584 clang::QualType
GetNormalizedType(
const clang::QualType &
type,
const cling::Interpreter &interpreter,
const TNormalizedCtxt &normCtxt);
591 void GetNormalizedName(std::string &norm_name,
const clang::QualType &
type,
const cling::Interpreter &interpreter,
const TNormalizedCtxt &normCtxt);
596 const clang::TypeDecl* typeDecl,
597 const cling::Interpreter &interpreter);
601 llvm::StringRef
GetComment(
const clang::Decl &decl, clang::SourceLocation *loc = 0);
605 llvm::StringRef
GetClassComment(
const clang::CXXRecordDecl &decl, clang::SourceLocation *loc,
const cling::Interpreter &interpreter);
621 Redecl = Redecl->getMostRecentDecl();
622 while (Redecl && !Redecl->hasAttrs())
623 Redecl = Redecl->getPreviousDecl();
652 bool IsOfType(
const clang::CXXRecordDecl &cl,
const std::string&
type,
const cling::LookupHelper& lh);
673 clang::ClassTemplateDecl*& ctd,
674 clang::ClassTemplateSpecializationDecl*& ctsd);
682 std::list<std::pair<std::string,bool> >&);
685 std::list<std::pair<std::string,bool> >&);
689 std::list<std::pair<std::string,unsigned int> >& enclosingSc);
699 void ReplaceAll(std::string& str,
const std::string& from,
const std::string& to,
bool recurse=
false);
704 void LevelPrint(
bool prefix,
int level,
const char *location,
const char *fmt, va_list ap);
707 void Error(
const char *location,
const char *
va_(fmt), ...);
710 void SysError(
const char *location,
const char *
va_(fmt), ...);
713 void Info(
const char *location,
const char *
va_(fmt), ...);
716 void Warning(
const char *location,
const char *
va_(fmt), ...);
719 void Fatal(
const char *location,
const char *
va_(fmt), ...);
725 bool EndsWith(
const std::string &theString,
const std::string &theSubstring);
728 bool BeginsWith(
const std::string &theString,
const std::string &theSubstring);
731 namespace AST2SourceTools {
734 const std::string
Decls2FwdDecls(
const std::vector<const clang::Decl*> &decls,
735 bool (*ignoreFiles)(
const clang::PresumedLoc&) ,
736 const cling::Interpreter& interp);
740 const clang::TemplateParameterList& tmplParamList,
741 const cling::Interpreter& interpreter);
747 const clang::RecordDecl*
EncloseInScopes(
const clang::Decl& decl, std::string& defString);
751 const cling::Interpreter& interpreter,
752 std::string& defString,
753 bool acceptStl=
false);
757 const cling::Interpreter& interpreter,
758 std::string& defString);
760 int GetDefArg(
const clang::ParmVarDecl&
par, std::string& valAsString,
const clang::PrintingPolicy& pp);
764 const cling::Interpreter& interpreter,
765 std::string& defString);
768 const cling::Interpreter& interpreter,
769 std::string& fwdDeclString,
770 std::unordered_set<std::string>* fwdDeclSet=
nullptr);
778 #endif // ROOT_TMetaUtils
Namespace for new ROOT classes and functions.
cling::Interpreter * gInterp
Type
enumeration specifying the integration types.
typedef void((*Func_t)())
static void output(int code)