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);
122 class TNormalizedCtxtImpl;
139 void AddTemplAndNargsToKeep(
const clang::ClassTemplateDecl* templ,
unsigned int i);
140 int GetNargsToKeep(
const clang::ClassTemplateDecl* templ)
const;
142 void keepTypedef(
const cling::LookupHelper &lh,
const char*
name,
143 bool replace =
false);
149 typedef bool (*ExistingTypeCheck_t)(
const std::string &tname, std::string &
result);
150 typedef bool (*AutoParse_t)(
const char *
name);
158 bool WantDiags()
const {
return fPDebug && *fPDebug > 5; }
162 ExistingTypeCheck_t existingTypeCheck,
163 AutoParse_t autoParse,
164 const int *pgDebug = 0);
167 virtual bool ExistingTypeCheck(
const std::string &tname, std::string &
result);
168 virtual void GetPartiallyDesugaredName(std::string &nameLong);
169 virtual bool IsAlreadyPartiallyDesugaredName(
const std::string &nondef,
const std::string &nameLong);
170 virtual bool IsDeclaredScope(
const std::string &base,
bool &isInlined);
171 virtual bool GetPartiallyDesugaredNameWithScopeHandling(
const std::string &tname, std::string &result);
190 kNoInputOperator = 0x02,
191 kUseByteCount = 0x04,
192 kStreamerInfo = 0x04,
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,
254 return fRequestStreamerInfo;
264 if (fRequestNoStreamer) result = kNoStreamer;
265 if (fRequestNoInputOperator) result |= kNoInputOperator;
266 if (fRequestStreamerInfo) result |= kStreamerInfo;
267 if (fRequestedVersionNumber > -1) result |= kHasVersion;
272 operator clang::RecordDecl
const *()
const {
298 const char *GetName()
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,
348 const clang::FunctionDecl*
ClassInfo__HasMethod(
const clang::DeclContext *cl,
char const*,
const cling::Interpreter& interp);
355 const clang::NamedDecl &forcontext,
356 const clang::QualType &qti,
359 const cling::Interpreter &interp,
363 bool IsBase(
const clang::CXXRecordDecl *cl,
const clang::CXXRecordDecl *base,
const clang::CXXRecordDecl *context,
const cling::Interpreter &interp);
366 bool IsBase(
const clang::FieldDecl &
m,
const char* basename,
const cling::Interpreter &interp);
381 bool HasIOConstructor(clang::CXXRecordDecl
const*, std::string&,
const RConstructorTypes&,
const cling::Interpreter&);
384 bool HasNewMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
387 bool HasOldMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
406 const cling::Interpreter&,
bool diagnose);
415 void GetQualifiedName(std::string &qual_name,
const clang::QualType &
type,
const clang::NamedDecl &forcontext);
418 std::string
GetQualifiedName(
const clang::QualType &type,
const clang::NamedDecl &forcontext);
439 void GetQualifiedName(std::string &qual_name,
const clang::RecordDecl &recordDecl);
454 int GetClassVersion(
const clang::RecordDecl *cl,
const cling::Interpreter &interp);
478 std::string
TrueName(
const clang::FieldDecl &m);
482 const cling::Interpreter &
gInterp,
489 const clang::CXXRecordDecl *decl,
490 const cling::Interpreter &interp,
491 const RConstructorTypes& ctorTypes,
499 const cling::Interpreter &gInterp,
505 const cling::Interpreter &interp,
507 std::ostream& finalString,
508 const RConstructorTypes& ctorTypes,
514 const clang::CXXRecordDecl *decl,
515 const cling::Interpreter &interp,
517 const RConstructorTypes& ctorTypes,
518 bool& needCollectionProxy);
522 const clang::CXXRecordDecl* clxx,
523 const cling::Interpreter &interp,
528 const clang::CXXRecordDecl* clxx,
529 const cling::Interpreter &interp,
534 llvm::StringRef
GetFileName(
const clang::Decl& decl,
535 const cling::Interpreter& interp);
544 const char* moduleFileName,
545 const char* headers[]);
580 const clang::TypeDecl* typeDecl,
581 const cling::Interpreter &interpreter);
585 llvm::StringRef
GetComment(
const clang::Decl &decl, clang::SourceLocation *loc = 0);
589 llvm::StringRef
GetClassComment(
const clang::CXXRecordDecl &decl, clang::SourceLocation *loc,
const cling::Interpreter &interpreter);
605 Redecl = Redecl->getMostRecentDecl();
606 while (Redecl && !Redecl->hasAttrs())
607 Redecl = Redecl->getPreviousDecl();
636 bool IsOfType(
const clang::CXXRecordDecl &cl,
const std::string& type,
const cling::LookupHelper& lh);
657 clang::ClassTemplateDecl*& ctd,
658 clang::ClassTemplateSpecializationDecl*& ctsd);
666 std::list<std::pair<std::string,bool> >&);
669 std::list<std::pair<std::string,bool> >&);
673 std::list<std::pair<std::string,unsigned int> >& enclosingSc);
683 void ReplaceAll(std::string& str,
const std::string& from,
const std::string& to,
bool recurse=
false);
688 void LevelPrint(
bool prefix,
int level,
const char *location,
const char *fmt, va_list ap);
691 void Error(
const char *location,
const char *
va_(fmt), ...);
694 void SysError(
const char *location,
const char *
va_(fmt), ...);
697 void Info(
const char *location,
const char *
va_(fmt), ...);
700 void Warning(
const char *location,
const char *
va_(fmt), ...);
703 void Fatal(
const char *location,
const char *
va_(fmt), ...);
709 bool EndsWith(
const std::string &theString,
const std::string &theSubstring);
712 bool BeginsWith(
const std::string &theString,
const std::string &theSubstring);
715 namespace AST2SourceTools {
718 const std::string
Decls2FwdDecls(
const std::vector<const clang::Decl*> &decls,
719 bool (*ignoreFiles)(
const clang::PresumedLoc&) ,
720 const cling::Interpreter& interp);
724 const clang::TemplateParameterList& tmplParamList,
725 const cling::Interpreter& interpreter);
731 const clang::RecordDecl*
EncloseInScopes(
const clang::Decl& decl, std::string& defString);
735 const cling::Interpreter& interpreter,
736 std::string& defString,
737 bool acceptStl=
false);
741 const cling::Interpreter& interpreter,
742 std::string& defString);
744 int GetDefArg(
const clang::ParmVarDecl&
par, std::string& valAsString,
const clang::PrintingPolicy& pp);
748 const cling::Interpreter& interpreter,
749 std::string& defString);
752 const cling::Interpreter& interpreter,
753 std::string& fwdDeclString,
754 std::unordered_set<std::string>* fwdDeclSet=
nullptr);
762 #endif // ROOT_TMetaUtils
Namespace for new ROOT classes and functions.
cling::Interpreter * gInterp
Type GetType(const std::string &Name)
TRObject operator()(const T1 &t1) const
Type
enumeration specifying the integration types.
typedef void((*Func_t)())
static void output(int code)