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");
105 const cling::Interpreter &interp,
107 std::ostream& dictStream,
108 bool isAutoStreamer);
120 class TNormalizedCtxtImpl;
137 void AddTemplAndNargsToKeep(
const clang::ClassTemplateDecl* templ,
unsigned int i);
138 int GetNargsToKeep(
const clang::ClassTemplateDecl* templ)
const;
140 void keepTypedef(
const cling::LookupHelper &lh,
const char*
name,
141 bool replace =
false);
147 typedef bool (*ExistingTypeCheck_t)(
const std::string &tname, std::string &
result);
148 typedef bool (*AutoParse_t)(
const char *
name);
156 bool WantDiags()
const {
return fPDebug && *fPDebug > 5; }
160 ExistingTypeCheck_t existingTypeCheck,
161 AutoParse_t autoParse,
162 const int *pgDebug = 0);
165 virtual bool ExistingTypeCheck(
const std::string &tname, std::string &
result);
166 virtual void GetPartiallyDesugaredName(std::string &nameLong);
167 virtual bool IsAlreadyPartiallyDesugaredName(
const std::string &nondef,
const std::string &nameLong);
168 virtual bool IsDeclaredScope(
const std::string &base,
bool &isInlined);
169 virtual bool GetPartiallyDesugaredNameWithScopeHandling(
const std::string &tname, std::string &result);
188 kNoInputOperator = 0x02,
189 kUseByteCount = 0x04,
190 kStreamerInfo = 0x04,
195 const clang::RecordDecl *decl,
198 bool rRequestNoInputOperator,
199 bool rRequestOnlyTClass,
200 int rRequestedVersionNumber,
201 const cling::Interpreter &interpret,
205 const clang::RecordDecl *decl,
206 const char *requestName,
209 bool rRequestNoInputOperator,
210 bool rRequestOnlyTClass,
211 int rRequestedVersionNumber,
212 const cling::Interpreter &interpret,
217 const clang::RecordDecl *decl,
218 const char *requestedName,
221 bool rRequestNoInputOperator,
222 bool rRequestOnlyTClass,
223 int rRequestedVersionNumber,
224 const cling::Interpreter &interpret,
229 const clang::RecordDecl *decl,
230 const char *requestedName,
231 unsigned int nTemplateArgsToSkip,
234 bool rRequestNoInputOperator,
235 bool rRequestOnlyTClass,
236 int rRequestedVersionNumber,
237 const cling::Interpreter &interpret,
252 return fRequestStreamerInfo;
262 if (fRequestNoStreamer) result = kNoStreamer;
263 if (fRequestNoInputOperator) result |= kNoInputOperator;
264 if (fRequestStreamerInfo) result |= kStreamerInfo;
265 if (fRequestedVersionNumber > -1) result |= kHasVersion;
270 operator clang::RecordDecl
const *()
const {
297 const clang::CXXRecordDecl *
GetType()
const;
314 const std::string& propName,
315 std::string& propValue);
319 const std::string& propName,
323 bool RequireCompleteType(
const cling::Interpreter &interp,
const clang::CXXRecordDecl *cl);
331 const cling::Interpreter &interpret,
347 const clang::FunctionDecl*
ClassInfo__HasMethod(
const clang::DeclContext *cl,
char const*,
const cling::Interpreter& interp);
354 const clang::NamedDecl &forcontext,
355 const clang::QualType &qti,
358 const cling::Interpreter &interp,
362 bool IsBase(
const clang::CXXRecordDecl *cl,
const clang::CXXRecordDecl *base,
const clang::CXXRecordDecl *context,
const cling::Interpreter &interp);
365 bool IsBase(
const clang::FieldDecl &
m,
const char* basename,
const cling::Interpreter &interp);
380 bool HasIOConstructor(clang::CXXRecordDecl
const*, std::string&,
const RConstructorTypes&,
const cling::Interpreter&);
383 bool HasNewMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
386 bool HasOldMerge(clang::CXXRecordDecl
const*,
const cling::Interpreter&);
405 const cling::Interpreter&,
bool diagnose);
414 void GetQualifiedName(std::string &qual_name,
const clang::QualType &
type,
const clang::NamedDecl &forcontext);
417 std::string
GetQualifiedName(
const clang::QualType &type,
const clang::NamedDecl &forcontext);
438 void GetQualifiedName(std::string &qual_name,
const clang::RecordDecl &recordDecl);
453 int GetClassVersion(
const clang::RecordDecl *cl,
const cling::Interpreter &interp);
477 std::string
TrueName(
const clang::FieldDecl &m);
481 const cling::Interpreter &
gInterp,
488 const clang::CXXRecordDecl *decl,
489 const cling::Interpreter &interp,
490 const RConstructorTypes& ctorTypes,
498 const cling::Interpreter &gInterp,
504 const cling::Interpreter &interp,
506 std::ostream& finalString,
507 const RConstructorTypes& ctorTypes,
513 const clang::CXXRecordDecl *decl,
514 const cling::Interpreter &interp,
516 const RConstructorTypes& ctorTypes,
517 bool& needCollectionProxy);
521 const clang::CXXRecordDecl* clxx,
522 const cling::Interpreter &interp,
527 const clang::CXXRecordDecl* clxx,
528 const cling::Interpreter &interp,
533 llvm::StringRef
GetFileName(
const clang::Decl& decl,
534 const cling::Interpreter& interp);
543 const char* moduleFileName,
544 const char* headers[]);
591 const clang::TypeDecl* typeDecl,
592 const cling::Interpreter &interpreter);
597 clang::QualType
GetTypeForIO(
const clang::QualType& templateInstanceType,
598 const cling::Interpreter &interpreter,
605 std::pair<std::string,clang::QualType>
GetNameTypeForIO(
const clang::QualType& templateInstanceType,
606 const cling::Interpreter &interpreter,
612 llvm::StringRef
GetComment(
const clang::Decl &decl, clang::SourceLocation *loc = 0);
616 llvm::StringRef
GetClassComment(
const clang::CXXRecordDecl &decl, clang::SourceLocation *loc,
const cling::Interpreter &interpreter);
632 Redecl = Redecl->getMostRecentDecl();
633 while (Redecl && !Redecl->hasAttrs())
634 Redecl = Redecl->getPreviousDecl();
663 bool IsOfType(
const clang::CXXRecordDecl &cl,
const std::string& type,
const cling::LookupHelper& lh);
684 clang::ClassTemplateDecl*& ctd,
685 clang::ClassTemplateSpecializationDecl*& ctsd);
693 std::list<std::pair<std::string,bool> >&);
696 std::list<std::pair<std::string,bool> >&);
700 std::list<std::pair<std::string,unsigned int> >& enclosingSc);
710 void ReplaceAll(std::string& str,
const std::string& from,
const std::string& to,
bool recurse=
false);
716 static unsigned int gNumberOfWarningsAndErrors = 0;
717 return gNumberOfWarningsAndErrors;
727 inline void LevelPrint(
bool prefix,
int level,
const char *location,
const char *fmt, va_list ap)
732 const char *type = 0;
747 if (!location || !location[0]) {
748 if (prefix) fprintf(stderr,
"%s: ", type);
749 vfprintf(stderr, (
const char*)
va_(fmt), ap);
751 if (prefix) fprintf(stderr,
"%s in <%s>: ", type, location);
752 else fprintf(stderr,
"In <%s>: ", location);
753 vfprintf(stderr, (
const char*)
va_(fmt), ap);
767 inline void Error(
const char *location,
const char *
va_(fmt), ...)
770 va_start(ap,
va_(fmt));
777 inline void SysError(
const char *location,
const char *
va_(fmt), ...)
780 va_start(ap,
va_(fmt));
787 inline void Info(
const char *location,
const char *
va_(fmt), ...)
790 va_start(ap,
va_(fmt));
797 inline void Warning(
const char *location,
const char *
va_(fmt), ...)
800 va_start(ap,
va_(fmt));
807 inline void Fatal(
const char *location,
const char *
va_(fmt), ...)
810 va_start(ap,
va_(fmt));
819 bool EndsWith(
const std::string &theString,
const std::string &theSubstring);
822 bool BeginsWith(
const std::string &theString,
const std::string &theSubstring);
825 namespace AST2SourceTools {
828 const std::string
Decls2FwdDecls(
const std::vector<const clang::Decl*> &decls,
829 bool (*ignoreFiles)(
const clang::PresumedLoc&) ,
830 const cling::Interpreter& interp);
834 const clang::TemplateParameterList& tmplParamList,
835 const cling::Interpreter& interpreter);
841 const clang::RecordDecl*
EncloseInScopes(
const clang::Decl& decl, std::string& defString);
845 const cling::Interpreter& interpreter,
846 std::string& defString,
847 bool acceptStl=
false);
851 const cling::Interpreter& interpreter,
852 std::string& defString);
854 int GetDefArg(
const clang::ParmVarDecl&
par, std::string& valAsString,
const clang::PrintingPolicy& pp);
858 const cling::Interpreter& interpreter,
859 std::string& defString);
862 const cling::Interpreter& interpreter,
863 std::string& fwdDeclString,
864 std::unordered_set<std::string>* fwdDeclSet=
nullptr);
872 #endif // ROOT_TMetaUtils
std::string GetName(const std::string &scope_name)
R__EXTERN Int_t gErrorIgnoreLevel
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
cling::Interpreter * gInterp
Type GetType(const std::string &Name)
Type
enumeration specifying the integration types.
Print a TSeq at the prompt:
typedef void((*Func_t)())