Logo ROOT  
Reference Guide
TClingUtils.h
Go to the documentation of this file.
1// @(#)root/metautils:$Id$
2// Author: Axel Naumann, Nov 2011
3
4/*************************************************************************
5 * Copyright (C) 1995-2011, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TMetaUtils
13#define ROOT_TMetaUtils
14
16
17#include <functional>
18#include <set>
19#include <string>
20#include <unordered_set>
21
22//#include <atomic>
23#include <stdlib.h>
24
25#if defined(__GNUC__) && !defined(__clang__)
26#pragma GCC diagnostic push
27#pragma GCC diagnostic ignored "-Wpragmas"
28#pragma GCC diagnostic ignored "-Wclass-memaccess"
29#endif
30
31#include "clang/Basic/Module.h"
32
33#if defined(__GNUC__) && !defined(__clang__)
34#pragma GCC diagnostic pop
35#endif
36
37namespace llvm {
38 class StringRef;
39}
40
41namespace clang {
42 class ASTContext;
43 class Attr;
44 class ClassTemplateDecl;
45 class ClassTemplateSpecializationDecl;
46 class CompilerInstance;
47 class CXXBaseSpecifier;
48 class CXXRecordDecl;
49 class Decl;
50 class DeclContext;
51 class DeclaratorDecl;
52 class FieldDecl;
53 class FunctionDecl;
54 class NamedDecl;
55 class ParmVarDecl;
56 class PresumedLoc;
57 class QualType;
58 class RecordDecl;
59 class SourceLocation;
60 class TagDecl;
61 class TemplateDecl;
62 class TemplateName;
63 class TemplateArgument;
64 class TemplateArgumentList;
65 class TemplateParameterList;
66 class Type;
67 class TypeDecl;
68 class TypedefNameDecl;
69 struct PrintingPolicy;
70}
71
72namespace cling {
73 class Interpreter;
74 class LookupHelper;
75 namespace utils {
76 namespace Transform {
77 struct Config;
78 }
79 }
80}
81
82// For ROOT::ESTLType
83#include "ESTLType.h"
84
85// for TClassEdit::TInterpreterLookupHelper
86#include "TClassEdit.h"
87
88#include "Varargs.h"
89
90namespace ROOT {
91namespace TMetaUtils {
92
93///\returns the resolved normalized absolute path possibly resolving symlinks.
94std::string GetRealPath(const std::string &path);
95
96// Forward Declarations --------------------------------------------------------
97class AnnotatedRecordDecl;
98
99// Constants, typedefs and Enums -----------------------------------------------
100
101// Convention for the ROOT relevant properties
102namespace propNames{
103 static const std::string separator("@@@");
104 static const std::string iotype("iotype");
105 static const std::string name("name");
106 static const std::string pattern("pattern");
107 static const std::string ioname("ioname");
108 static const std::string comment("comment");
109 static const std::string nArgsToKeep("nArgsToKeep");
110 static const std::string persistent("persistent");
111 static const std::string transient("transient");
112}
113
114// Get the array index information for a data member.
116
118 const cling::Interpreter &interp,
119 const TNormalizedCtxt &normCtxt,
120 std::ostream& dictStream,
121 bool isAutoStreamer);
122
123const int kInfo = 0;
124const int kNote = 500;
125const int kWarning = 1000;
126const int kError = 2000;
127const int kSysError = 3000;
128const int kFatal = 4000;
129const int kMaxLen = 1024;
130
131// Classes ---------------------------------------------------------------------
132class TNormalizedCtxtImpl;
133
134//______________________________________________________________________________
136private:
137 TNormalizedCtxtImpl* fImpl;
138public:
139 using Config_t = cling::utils::Transform::Config;
140 using TypesCont_t = std::set<const clang::Type*>;
141 using TemplPtrIntMap_t = std::map<const clang::ClassTemplateDecl*, int>;
142
143 TNormalizedCtxt(const cling::LookupHelper &lh);
144 TNormalizedCtxt(const TNormalizedCtxt& other);
146 const Config_t& GetConfig() const;
147 const TypesCont_t &GetTypeWithAlternative() const;
148
149 void AddTemplAndNargsToKeep(const clang::ClassTemplateDecl* templ, unsigned int i);
150 int GetNargsToKeep(const clang::ClassTemplateDecl* templ) const;
152 void keepTypedef(const cling::LookupHelper &lh, const char* name,
153 bool replace = false);
154};
155
156//______________________________________________________________________________
158public:
159 typedef bool (*ExistingTypeCheck_t)(const std::string &tname, std::string &result);
160 typedef bool (*AutoParse_t)(const char *name);
161
162private:
163 cling::Interpreter *fInterpreter;
168 const int *fPDebug; // debug flag, might change at runtime thus *
169 bool WantDiags() const { return fPDebug && *fPDebug > 5; }
170
171public:
172 TClingLookupHelper(cling::Interpreter &interpreter, TNormalizedCtxt &normCtxt,
173 ExistingTypeCheck_t existingTypeCheck,
174 AutoParse_t autoParse,
175 bool *shuttingDownPtr,
176 const int *pgDebug = 0);
177 virtual ~TClingLookupHelper() { /* we're not owner */ }
178
179 virtual bool ExistingTypeCheck(const std::string &tname, std::string &result);
180 virtual void GetPartiallyDesugaredName(std::string &nameLong);
181 virtual bool IsAlreadyPartiallyDesugaredName(const std::string &nondef, const std::string &nameLong);
182 virtual bool IsDeclaredScope(const std::string &base, bool &isInlined);
183 virtual bool GetPartiallyDesugaredNameWithScopeHandling(const std::string &tname, std::string &result, bool dropstd = true);
184 virtual void ShuttingDownSignal();
185};
186
187//______________________________________________________________________________
189private:
190 static std::string BuildDemangledTypeInfo(const clang::RecordDecl *rDecl,
191 const std::string &normalizedName);
193 const clang::RecordDecl* fDecl;
194 std::string fRequestedName;
195 std::string fNormalizedName;
202
203public:
209 kHasVersion = 0x08
210 };
211
212 AnnotatedRecordDecl(long index,
213 const clang::RecordDecl *decl,
214 bool rStreamerInfo,
215 bool rNoStreamer,
216 bool rRequestNoInputOperator,
217 bool rRequestOnlyTClass,
218 int rRequestedVersionNumber,
219 const cling::Interpreter &interpret,
220 const TNormalizedCtxt &normCtxt);
221
222 AnnotatedRecordDecl(long index,
223 const clang::RecordDecl *decl,
224 const char *requestName,
225 bool rStreamerInfo,
226 bool rNoStreamer,
227 bool rRequestNoInputOperator,
228 bool rRequestOnlyTClass,
229 int rRequestedVersionNumber,
230 const cling::Interpreter &interpret,
231 const TNormalizedCtxt &normCtxt);
232
233 AnnotatedRecordDecl(long index,
234 const clang::Type *requestedType,
235 const clang::RecordDecl *decl,
236 const char *requestedName,
237 bool rStreamerInfo,
238 bool rNoStreamer,
239 bool rRequestNoInputOperator,
240 bool rRequestOnlyTClass,
241 int rRequestedVersionNumber,
242 const cling::Interpreter &interpret,
243 const TNormalizedCtxt &normCtxt);
244
245 AnnotatedRecordDecl(long index,
246 const clang::Type *requestedType,
247 const clang::RecordDecl *decl,
248 const char *requestedName,
249 unsigned int nTemplateArgsToSkip,
250 bool rStreamerInfo,
251 bool rNoStreamer,
252 bool rRequestNoInputOperator,
253 bool rRequestOnlyTClass,
254 int rRequestedVersionNumber,
255 const cling::Interpreter &interpret,
256 const TNormalizedCtxt &normCtxt);
257
259 // Nothing to do we do not own the pointer;
260 }
261
262
263 long GetRuleIndex() const { return fRuleIndex; }
264
265 const char *GetRequestedName() const { return fRequestedName.c_str(); }
266 const char *GetNormalizedName() const { return fNormalizedName.c_str(); }
267 const std::string &GetDemangledTypeInfo() const { return fDemangledTypeInfo; }
268 bool HasClassVersion() const { return fRequestedVersionNumber >=0 ; }
269 bool RequestStreamerInfo() const {
270 // Equivalent to CINT's cl.RootFlag() & G__USEBYTECOUNT
272 }
274 bool RequestNoStreamer() const { return fRequestNoStreamer; }
275 bool RequestOnlyTClass() const { return fRequestOnlyTClass; }
277 int RootFlag() const {
278 // Return the request (streamerInfo, has_version, etc.) combined in a single
279 // int. See RScanner::AnnotatedRecordDecl::ERootFlag.
280 int result = 0;
281 if (fRequestNoStreamer) result = kNoStreamer;
283 if (fRequestStreamerInfo) result |= kStreamerInfo;
284 if (fRequestedVersionNumber > -1) result |= kHasVersion;
285 return result;
286 }
287 const clang::RecordDecl* GetRecordDecl() const { return fDecl; }
288
289 operator clang::RecordDecl const *() const {
290 return fDecl;
291 }
292
293 bool operator<(const AnnotatedRecordDecl& right) const
294 {
295 return fRuleIndex < right.fRuleIndex;
296 }
297
299 bool operator() (const AnnotatedRecordDecl& right, const AnnotatedRecordDecl& left) const
300 {
301 return left.fNormalizedName < right.fNormalizedName;
302 }
303 };
304};
305
306//______________________________________________________________________________
308private:
309 const std::string fArgTypeName;
310 const clang::CXXRecordDecl *fArgType;
311
312public:
313 RConstructorType(const char *type_of_arg, const cling::Interpreter&);
314
315 const char *GetName() const ;
316 const clang::CXXRecordDecl *GetType() const;
317};
318typedef std::list<RConstructorType> RConstructorTypes;
319
320// Functions -------------------------------------------------------------------
321
322//______________________________________________________________________________
323int extractAttrString(clang::Attr* attribute, std::string& attrString);
324
325//______________________________________________________________________________
326int extractPropertyNameValFromString(const std::string attributeStr,std::string& attrName, std::string& attrValue);
327
328//______________________________________________________________________________
329int extractPropertyNameVal(clang::Attr* attribute, std::string& attrName, std::string& attrValue);
330
331//______________________________________________________________________________
332bool ExtractAttrPropertyFromName(const clang::Decl& decl,
333 const std::string& propName,
334 std::string& propValue);
335
336//______________________________________________________________________________
337bool ExtractAttrIntPropertyFromName(const clang::Decl& decl,
338 const std::string& propName,
339 int& propValue);
340
341//______________________________________________________________________________
342bool RequireCompleteType(const cling::Interpreter &interp, const clang::CXXRecordDecl *cl);
343
344//______________________________________________________________________________
345bool RequireCompleteType(const cling::Interpreter &interp, clang::SourceLocation Loc, clang::QualType Type);
346
347//______________________________________________________________________________
348// Add default template parameters.
349clang::QualType AddDefaultParameters(clang::QualType instanceType,
350 const cling::Interpreter &interpret,
351 const TNormalizedCtxt &normCtxt);
352
353//______________________________________________________________________________
354llvm::StringRef DataMemberInfo__ValidArrayIndex(const clang::DeclaratorDecl &m, int *errnum = 0, llvm::StringRef *errstr = 0);
355
357
358//______________________________________________________________________________
359EIOCtorCategory CheckConstructor(const clang::CXXRecordDecl*, const RConstructorType&, const cling::Interpreter& interp);
360
361//______________________________________________________________________________
362bool CheckDefaultConstructor(const clang::CXXRecordDecl*, const cling::Interpreter& interp);
363
364//______________________________________________________________________________
365EIOCtorCategory CheckIOConstructor(const clang::CXXRecordDecl*, const char *, const clang::CXXRecordDecl *, const cling::Interpreter& interp);
366
367//______________________________________________________________________________
368const clang::FunctionDecl* ClassInfo__HasMethod(const clang::DeclContext *cl, char const*, const cling::Interpreter& interp);
369
370//______________________________________________________________________________
371void CreateNameTypeMap(clang::CXXRecordDecl const&, std::map<std::string, ROOT::Internal::TSchemaType>&);
372
373//______________________________________________________________________________
374int ElementStreamer(std::ostream& finalString,
375 const clang::NamedDecl &forcontext,
376 const clang::QualType &qti,
377 const char *t,
378 int rwmode,
379 const cling::Interpreter &interp,
380 const char *tcl=0);
381
382//______________________________________________________________________________
383bool IsBase(const clang::CXXRecordDecl *cl, const clang::CXXRecordDecl *base, const clang::CXXRecordDecl *context,const cling::Interpreter &interp);
384
385//______________________________________________________________________________
386bool IsBase(const clang::FieldDecl &m, const char* basename, const cling::Interpreter &interp);
387
388//______________________________________________________________________________
389bool HasCustomOperatorNewArrayPlacement(clang::RecordDecl const&, const cling::Interpreter &interp);
390
391//______________________________________________________________________________
392bool HasCustomOperatorNewPlacement(char const*, clang::RecordDecl const&, const cling::Interpreter&);
393
394//______________________________________________________________________________
395bool HasCustomOperatorNewPlacement(clang::RecordDecl const&, const cling::Interpreter&);
396
397//______________________________________________________________________________
398bool HasDirectoryAutoAdd(clang::CXXRecordDecl const*, const cling::Interpreter&);
399
400//______________________________________________________________________________
401bool HasIOConstructor(clang::CXXRecordDecl const*, std::string&, const RConstructorTypes&, const cling::Interpreter&);
402
403//______________________________________________________________________________
404bool HasNewMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
405
406//______________________________________________________________________________
407bool HasOldMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
408
409//______________________________________________________________________________
410bool hasOpaqueTypedef(clang::QualType instanceType, const TNormalizedCtxt &normCtxt);
411
412//______________________________________________________________________________
413bool hasOpaqueTypedef(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt);
414
415//______________________________________________________________________________
416bool HasResetAfterMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
417
418//______________________________________________________________________________
419bool NeedDestructor(clang::CXXRecordDecl const*, const cling::Interpreter&);
420
421//______________________________________________________________________________
422bool NeedTemplateKeyword(clang::CXXRecordDecl const*);
423
424//______________________________________________________________________________
425bool CheckPublicFuncWithProto(clang::CXXRecordDecl const*, char const*, char const*,
426 const cling::Interpreter&, bool diagnose);
427
428//______________________________________________________________________________
429long GetLineNumber(clang::Decl const*);
430
431//______________________________________________________________________________
432bool GetNameWithinNamespace(std::string&, std::string&, std::string&, clang::CXXRecordDecl const*);
433
434//______________________________________________________________________________
435void GetQualifiedName(std::string &qual_name, const clang::QualType &type, const clang::NamedDecl &forcontext);
436
437//----
438std::string GetQualifiedName(const clang::QualType &type, const clang::NamedDecl &forcontext);
439
440//______________________________________________________________________________
441void GetQualifiedName(std::string &qual_name, const clang::Type &type, const clang::NamedDecl &forcontext);
442
443//----
444std::string GetQualifiedName(const clang::Type &type, const clang::NamedDecl &forcontext);
445
446//______________________________________________________________________________
447void GetQualifiedName(std::string &qual_name, const clang::NamedDecl &nd);
448
449//----
450std::string GetQualifiedName(const clang::NamedDecl &nd);
451
452//______________________________________________________________________________
453void GetQualifiedName(std::string &qual_name, const AnnotatedRecordDecl &annotated);
454
455//----
456std::string GetQualifiedName(const AnnotatedRecordDecl &annotated);
457
458//______________________________________________________________________________
459void GetQualifiedName(std::string &qual_name, const clang::RecordDecl &recordDecl);
460
461//----
462std::string GetQualifiedName(const clang::RecordDecl &recordDecl);
463
464//______________________________________________________________________________
465int WriteNamespaceHeader(std::ostream&, const clang::RecordDecl *);
466
467//______________________________________________________________________________
468int WriteNamespaceHeader(std::ostream&, const clang::DeclContext *);
469
470//______________________________________________________________________________
471void WritePointersSTL(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt);
472
473//______________________________________________________________________________
474int GetClassVersion(const clang::RecordDecl *cl, const cling::Interpreter &interp);
475
476//______________________________________________________________________________
477std::pair<bool, int> GetTrivialIntegralReturnValue(const clang::FunctionDecl *funcCV, const cling::Interpreter &interp);
478
479//______________________________________________________________________________
480int IsSTLContainer(const AnnotatedRecordDecl &annotated);
481
482//______________________________________________________________________________
483ROOT::ESTLType IsSTLContainer(const clang::FieldDecl &m);
484
485//______________________________________________________________________________
486int IsSTLContainer(const clang::CXXBaseSpecifier &base);
487
488void foreachHeaderInModule(const clang::Module &module,
489 const std::function<void(const clang::Module::Header &)> &closure,
490 bool includeDirectlyUsedModules = true);
491
492//______________________________________________________________________________
493const char *ShortTypeName(const char *typeDesc);
494
495//______________________________________________________________________________
496std::string ShortTypeName(const clang::FieldDecl &m);
497
498//______________________________________________________________________________
499bool IsStreamableObject(const clang::FieldDecl &m, const cling::Interpreter& interp);
500
501//______________________________________________________________________________
502clang::RecordDecl *GetUnderlyingRecordDecl(clang::QualType type);
503
504//______________________________________________________________________________
505std::string TrueName(const clang::FieldDecl &m);
506
507//______________________________________________________________________________
508const clang::CXXRecordDecl *ScopeSearch(const char *name,
509 const cling::Interpreter &gInterp,
510 bool diagnose,
511 const clang::Type** resultType);
512
513//______________________________________________________________________________
514void WriteAuxFunctions(std::ostream& finalString,
515 const AnnotatedRecordDecl &cl,
516 const clang::CXXRecordDecl *decl,
517 const cling::Interpreter &interp,
518 const RConstructorTypes& ctorTypes,
519 const TNormalizedCtxt &normCtxt);
520
521
522//______________________________________________________________________________
523const clang::FunctionDecl *GetFuncWithProto(const clang::Decl* cinfo,
524 const char *method,
525 const char *proto,
526 const cling::Interpreter &gInterp,
527 bool diagnose);
528
529//______________________________________________________________________________
530void WriteClassCode(CallWriteStreamer_t WriteStreamerFunc,
531 const AnnotatedRecordDecl &cl,
532 const cling::Interpreter &interp,
533 const TNormalizedCtxt &normCtxt,
534 std::ostream& finalString,
535 const RConstructorTypes& ctorTypes,
536 bool isGenreflex);
537
538//______________________________________________________________________________
539void WriteClassInit(std::ostream& finalString,
540 const AnnotatedRecordDecl &cl,
541 const clang::CXXRecordDecl *decl,
542 const cling::Interpreter &interp,
543 const TNormalizedCtxt &normCtxt,
544 const RConstructorTypes& ctorTypes,
545 bool& needCollectionProxy);
546
547//______________________________________________________________________________
549 const clang::CXXRecordDecl* clxx,
550 const cling::Interpreter &interp,
551 const TNormalizedCtxt &normCtxt);
552
553//______________________________________________________________________________
555 const clang::CXXRecordDecl* clxx,
556 const cling::Interpreter &interp,
557 const TNormalizedCtxt &normCtxt);
558
559//______________________________________________________________________________
560// Return the header file to be included to declare the Decl
561llvm::StringRef GetFileName(const clang::Decl& decl,
562 const cling::Interpreter& interp);
563
564//______________________________________________________________________________
565// Return the dictionary file name for a module
566std::string GetModuleFileName(const char* moduleName);
567
568//______________________________________________________________________________
569// Return (in the argument 'output') a mangled version of the C++ symbol/type (pass as 'input')
570// that can be used in C++ as a variable name.
571void GetCppName(std::string &output, const char *input);
572
573//______________________________________________________________________________
574// Return the type with all parts fully qualified (most typedefs),
575// including template arguments, appended to name.
576void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const cling::Interpreter &interpreter);
577
578//______________________________________________________________________________
579// Return the type with all parts fully qualified (most typedefs),
580// including template arguments, appended to name, without using the interpreter
581void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const clang::ASTContext &);
582
583//______________________________________________________________________________
584// Return the type normalized for ROOT,
585// keeping only the ROOT opaque typedef (Double32_t, etc.) and
586// adding default template argument for all types except those explicitly
587// requested to be drop by the user.
588// Default template for STL collections are not yet removed by this routine.
589clang::QualType GetNormalizedType(const clang::QualType &type, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt);
590
591//______________________________________________________________________________
592// Return the type name normalized for ROOT,
593// keeping only the ROOT opaque typedef (Double32_t, etc.) and
594// adding default template argument for all types except the STL collections
595// where we remove the default template argument if any.
596void GetNormalizedName(std::string &norm_name, const clang::QualType &type, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt);
597
598//______________________________________________________________________________
599// Alternative signature
600void GetNormalizedName(std::string &norm_name,
601 const clang::TypeDecl* typeDecl,
602 const cling::Interpreter &interpreter);
603
604//______________________________________________________________________________
605// Analog to GetNameForIO but with types.
606// It uses the LookupHelper of Cling to transform the name in type.
607clang::QualType GetTypeForIO(const clang::QualType& templateInstanceType,
608 const cling::Interpreter &interpreter,
609 const TNormalizedCtxt &normCtxt,
611
612//______________________________________________________________________________
613// Get the name and the type for the IO given a certain type. In some sense the
614// combination of GetNameForIO and GetTypeForIO.
615std::pair<std::string,clang::QualType> GetNameTypeForIO(const clang::QualType& templateInstanceType,
616 const cling::Interpreter &interpreter,
617 const TNormalizedCtxt &normCtxt,
619
620//______________________________________________________________________________
621// Returns comment in a meaningful way
622llvm::StringRef GetComment(const clang::Decl &decl, clang::SourceLocation *loc = 0);
623
624//______________________________________________________________________________
625// Returns the comment of the ClassDef macro
626llvm::StringRef GetClassComment(const clang::CXXRecordDecl &decl, clang::SourceLocation *loc, const cling::Interpreter &interpreter);
627
628//______________________________________________________________________________
629// Return the base/underlying type of a chain of array or pointers type.
630const clang::Type *GetUnderlyingType(clang::QualType type);
631
632//______________________________________________________________________________
633// Scans the redeclaration chain for an annotation.
634//
635// returns 0 if no annotation was found.
636//
637template<typename T>
638const T* GetAnnotatedRedeclarable(const T* Redecl) {
639 if (!Redecl)
640 return 0;
641
642 Redecl = Redecl->getMostRecentDecl();
643 while (Redecl && !Redecl->hasAttrs())
644 Redecl = Redecl->getPreviousDecl();
645
646 return Redecl;
647}
648
649//______________________________________________________________________________
650// Overload the template for typedefs, because they don't contain
651// isThisDeclarationADefinition method. (Use inline to avoid violating ODR)
652const clang::TypedefNameDecl* GetAnnotatedRedeclarable(const clang::TypedefNameDecl* TND);
653
654//______________________________________________________________________________
655// Overload the template for tags, because we only check definitions.
656const clang::TagDecl* GetAnnotatedRedeclarable(const clang::TagDecl* TND);
657
658//______________________________________________________________________________
659// Return true if the decl is part of the std namespace.
660bool IsStdClass(const clang::RecordDecl &cl);
661
662//______________________________________________________________________________
663// Return true, if the decl is part of the std namespace and we want
664// its default parameter dropped.
665bool IsStdDropDefaultClass(const clang::RecordDecl &cl);
666
667//______________________________________________________________________________
668// See if the CXXRecordDecl matches the current of any of the previous CXXRecordDecls
669bool MatchWithDeclOrAnyOfPrevious(const clang::CXXRecordDecl &cl, const clang::CXXRecordDecl &currentCl);
670
671//______________________________________________________________________________
672// Return true if the decl is of type
673bool IsOfType(const clang::CXXRecordDecl &cl, const std::string& type, const cling::LookupHelper& lh);
674
675//______________________________________________________________________________
676// Return which kind of STL container the decl is, if any.
677ROOT::ESTLType IsSTLCont(const clang::RecordDecl &cl);
678
679//______________________________________________________________________________
680// Check if 'input' or any of its template parameter was substituted when
681// instantiating the class template instance and replace it with the
682// partially sugared type we have from 'instance'.
683clang::QualType ReSubstTemplateArg(clang::QualType input, const clang::Type *instance);
684
685//______________________________________________________________________________
686// Remove the last n template arguments from the name
687int RemoveTemplateArgsFromName(std::string& name, unsigned int);
688
689//______________________________________________________________________________
690clang::TemplateName ExtractTemplateNameFromQualType(const clang::QualType& qt);
691
692//______________________________________________________________________________
693bool QualType2Template(const clang::QualType& qt,
694 clang::ClassTemplateDecl*& ctd,
695 clang::ClassTemplateSpecializationDecl*& ctsd);
696
697//______________________________________________________________________________
698clang::ClassTemplateDecl* QualType2ClassTemplateDecl(const clang::QualType& qt);
699
700//______________________________________________________________________________
701// Extract the namespaces enclosing a DeclContext
702void ExtractCtxtEnclosingNameSpaces(const clang::DeclContext&,
703 std::list<std::pair<std::string,bool> >&);
704//______________________________________________________________________________
705void ExtractEnclosingNameSpaces(const clang::Decl&,
706 std::list<std::pair<std::string,bool> >&);
707
708//______________________________________________________________________________
709const clang::RecordDecl* ExtractEnclosingScopes(const clang::Decl& decl,
710 std::list<std::pair<std::string,unsigned int> >& enclosingSc);
711//______________________________________________________________________________
712// Kind of stl container
713ROOT::ESTLType STLKind(const llvm::StringRef type);
714
715//______________________________________________________________________________
716// Set the toolchain and the include paths for relocatability
717void SetPathsForRelocatability(std::vector<std::string>& clingArgs);
718
719//______________________________________________________________________________
720void ReplaceAll(std::string& str, const std::string& from, const std::string& to, bool recurse=false);
721
722// Functions for the printouts -------------------------------------------------
723
724//______________________________________________________________________________
725inline unsigned int &GetNumberOfErrors()
726{
727 static unsigned int gNumberOfErrors = 0;
728 return gNumberOfErrors;
729}
730
731//______________________________________________________________________________
732// True if printing a warning should increase GetNumberOfErrors
734{
735 static bool gWarningsAreErrors = false;
736 return gWarningsAreErrors;
737}
738
739//______________________________________________________________________________
740// Inclusive minimum error level a message needs to get handled
741inline int &GetErrorIgnoreLevel() {
743 return gErrorIgnoreLevel;
744}
745
746//______________________________________________________________________________
747inline void LevelPrint(bool prefix, int level, const char *location, const char *fmt, va_list ap)
748{
749 if (level < GetErrorIgnoreLevel())
750 return;
751
752 const char *type = 0;
753
754 if (level >= ROOT::TMetaUtils::kInfo)
755 type = "Info";
756 if (level >= ROOT::TMetaUtils::kNote)
757 type = "Note";
758 if (level >= ROOT::TMetaUtils::kWarning)
759 type = "Warning";
760 if (level >= ROOT::TMetaUtils::kError)
761 type = "Error";
762 if (level >= ROOT::TMetaUtils::kSysError)
763 type = "SysError";
764 if (level >= ROOT::TMetaUtils::kFatal)
765 type = "Fatal";
766
767 if (!location || !location[0]) {
768 if (prefix) fprintf(stderr, "%s: ", type);
769 vfprintf(stderr, (const char*)va_(fmt), ap);
770 } else {
771 if (prefix) fprintf(stderr, "%s in <%s>: ", type, location);
772 else fprintf(stderr, "In <%s>: ", location);
773 vfprintf(stderr, (const char*)va_(fmt), ap);
774 }
775
776 fflush(stderr);
777
778 // Keep track of the warnings/errors we printed.
781 }
782}
783
784//______________________________________________________________________________
785// Use this function in case an error occured.
786inline void Error(const char *location, const char *va_(fmt), ...)
787{
788 va_list ap;
789 va_start(ap,va_(fmt));
790 LevelPrint(true, ROOT::TMetaUtils::kError, location, va_(fmt), ap);
791 va_end(ap);
792}
793
794//______________________________________________________________________________
795// Use this function in case a system (OS or GUI) related error occured.
796inline void SysError(const char *location, const char *va_(fmt), ...)
797{
798 va_list ap;
799 va_start(ap, va_(fmt));
800 LevelPrint(true, ROOT::TMetaUtils::kSysError, location, va_(fmt), ap);
801 va_end(ap);
802}
803
804//______________________________________________________________________________
805// Use this function for informational messages.
806inline void Info(const char *location, const char *va_(fmt), ...)
807{
808 va_list ap;
809 va_start(ap,va_(fmt));
810 LevelPrint(true, ROOT::TMetaUtils::kInfo, location, va_(fmt), ap);
811 va_end(ap);
812}
813
814//______________________________________________________________________________
815// Use this function in warning situations.
816inline void Warning(const char *location, const char *va_(fmt), ...)
817{
818 va_list ap;
819 va_start(ap,va_(fmt));
820 LevelPrint(true, ROOT::TMetaUtils::kWarning, location, va_(fmt), ap);
821 va_end(ap);
822}
823
824//______________________________________________________________________________
825// Use this function in case of a fatal error. It will abort the program.
826inline void Fatal(const char *location, const char *va_(fmt), ...)
827{
828 va_list ap;
829 va_start(ap,va_(fmt));
830 LevelPrint(true, ROOT::TMetaUtils::kFatal, location, va_(fmt), ap);
831 va_end(ap);
832}
833
834//______________________________________________________________________________
835const std::string& GetPathSeparator();
836
837//______________________________________________________________________________
838bool EndsWith(const std::string &theString, const std::string &theSubstring);
839
840//______________________________________________________________________________
841bool BeginsWith(const std::string &theString, const std::string &theSubstring);
842
843//______________________________________________________________________________
844bool IsLinkdefFile(const char *filename);
845
846//______________________________________________________________________________
847bool IsHeaderName(const std::string &filename);
848
849//______________________________________________________________________________
850namespace AST2SourceTools {
851
852//______________________________________________________________________________
853const std::string Decls2FwdDecls(const std::vector<const clang::Decl*> &decls,
854 bool (*ignoreFiles)(const clang::PresumedLoc&) ,
855 const cling::Interpreter& interp);
856
857//______________________________________________________________________________
858int PrepareArgsForFwdDecl(std::string& templateArgs,
859 const clang::TemplateParameterList& tmplParamList,
860 const cling::Interpreter& interpreter);
861
862//______________________________________________________________________________
863int EncloseInNamespaces(const clang::Decl& decl, std::string& defString);
864
865//______________________________________________________________________________
866const clang::RecordDecl* EncloseInScopes(const clang::Decl& decl, std::string& defString);
867
868//______________________________________________________________________________
869int FwdDeclFromRcdDecl(const clang::RecordDecl& recordDecl,
870 const cling::Interpreter& interpreter,
871 std::string& defString,
872 bool acceptStl=false);
873
874//______________________________________________________________________________
875int FwdDeclFromTmplDecl(const clang::TemplateDecl& tmplDecl,
876 const cling::Interpreter& interpreter,
877 std::string& defString);
878//______________________________________________________________________________
879int GetDefArg(const clang::ParmVarDecl& par, std::string& valAsString, const clang::PrintingPolicy& pp);
880
881//______________________________________________________________________________
882int FwdDeclFromFcnDecl(const clang::FunctionDecl& fcnDecl,
883 const cling::Interpreter& interpreter,
884 std::string& defString);
885//______________________________________________________________________________
886int FwdDeclFromTypeDefNameDecl(const clang::TypedefNameDecl& tdnDecl,
887 const cling::Interpreter& interpreter,
888 std::string& fwdDeclString,
889 std::unordered_set<std::string>* fwdDeclSet=nullptr);
890
891} // namespace AST2SourceTools
892
893} // namespace TMetaUtils
894
895} // namespace ROOT
896
897#endif // ROOT_TMetaUtils
l unsigned short
Definition: Converters.cxx:862
cling::Interpreter * gInterp
R__EXTERN Int_t gErrorIgnoreLevel
Definition: TError.h:105
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
typedef void((*Func_t)())
#define va_(arg)
Definition: Varargs.h:41
const char * proto
Definition: civetweb.c:16604
const clang::RecordDecl * GetRecordDecl() const
Definition: TClingUtils.h:287
const clang::RecordDecl * fDecl
Definition: TClingUtils.h:193
bool operator<(const AnnotatedRecordDecl &right) const
Definition: TClingUtils.h:293
const char * GetRequestedName() const
Definition: TClingUtils.h:265
static std::string BuildDemangledTypeInfo(const clang::RecordDecl *rDecl, const std::string &normalizedName)
AnnotatedRecordDecl(long index, const clang::RecordDecl *decl, bool rStreamerInfo, bool rNoStreamer, bool rRequestNoInputOperator, bool rRequestOnlyTClass, int rRequestedVersionNumber, const cling::Interpreter &interpret, const TNormalizedCtxt &normCtxt)
There is no requested type name.
const std::string & GetDemangledTypeInfo() const
Definition: TClingUtils.h:267
const char * GetNormalizedName() const
Definition: TClingUtils.h:266
const clang::CXXRecordDecl * fArgType
Definition: TClingUtils.h:310
const clang::CXXRecordDecl * GetType() const
RConstructorType(const char *type_of_arg, const cling::Interpreter &)
virtual bool IsDeclaredScope(const std::string &base, bool &isInlined)
bool(* AutoParse_t)(const char *name)
Definition: TClingUtils.h:160
bool(* ExistingTypeCheck_t)(const std::string &tname, std::string &result)
Definition: TClingUtils.h:159
cling::Interpreter * fInterpreter
Definition: TClingUtils.h:163
TClingLookupHelper(cling::Interpreter &interpreter, TNormalizedCtxt &normCtxt, ExistingTypeCheck_t existingTypeCheck, AutoParse_t autoParse, bool *shuttingDownPtr, const int *pgDebug=0)
virtual bool GetPartiallyDesugaredNameWithScopeHandling(const std::string &tname, std::string &result, bool dropstd=true)
We assume that we have a simple type: [const] typename[*&][const].
virtual bool IsAlreadyPartiallyDesugaredName(const std::string &nondef, const std::string &nameLong)
ExistingTypeCheck_t fExistingTypeCheck
Definition: TClingUtils.h:165
virtual void GetPartiallyDesugaredName(std::string &nameLong)
virtual bool ExistingTypeCheck(const std::string &tname, std::string &result)
Helper routine to ry hard to avoid looking up in the Cling database as this could enduce an unwanted ...
void AddTemplAndNargsToKeep(const clang::ClassTemplateDecl *templ, unsigned int i)
void keepTypedef(const cling::LookupHelper &lh, const char *name, bool replace=false)
cling::utils::Transform::Config Config_t
Definition: TClingUtils.h:139
std::map< const clang::ClassTemplateDecl *, int > TemplPtrIntMap_t
Definition: TClingUtils.h:141
TNormalizedCtxt(const cling::LookupHelper &lh)
TNormalizedCtxtImpl * fImpl
Definition: TClingUtils.h:137
const TypesCont_t & GetTypeWithAlternative() const
std::set< const clang::Type * > TypesCont_t
Definition: TClingUtils.h:140
int GetNargsToKeep(const clang::ClassTemplateDecl *templ) const
const Config_t & GetConfig() const
const TemplPtrIntMap_t GetTemplNargsToKeepMap() const
Type
enumeration specifying the integration types.
double T(double x)
Definition: ChebyshevPol.h:34
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:151
int EncloseInNamespaces(const clang::Decl &decl, std::string &defString)
Take the namespaces which enclose the decl and put them around the definition string.
int FwdDeclFromTypeDefNameDecl(const clang::TypedefNameDecl &tdnDecl, const cling::Interpreter &interpreter, std::string &fwdDeclString, std::unordered_set< std::string > *fwdDeclSet=nullptr)
Extract "forward declaration" of a typedef.
int PrepareArgsForFwdDecl(std::string &templateArgs, const clang::TemplateParameterList &tmplParamList, const cling::Interpreter &interpreter)
Loop over the template parameters and build a string for template arguments using the fully qualified...
int FwdDeclFromFcnDecl(const clang::FunctionDecl &fcnDecl, const cling::Interpreter &interpreter, std::string &defString)
int FwdDeclFromTmplDecl(const clang::TemplateDecl &tmplDecl, const cling::Interpreter &interpreter, std::string &defString)
Convert a tmplt decl to its fwd decl.
const clang::RecordDecl * EncloseInScopes(const clang::Decl &decl, std::string &defString)
Take the scopes which enclose the decl and put them around the definition string.
int FwdDeclFromRcdDecl(const clang::RecordDecl &recordDecl, const cling::Interpreter &interpreter, std::string &defString, bool acceptStl=false)
Convert a rcd decl to its fwd decl If this is a template specialisation, treat in the proper way.
int GetDefArg(const clang::ParmVarDecl &par, std::string &valAsString, const clang::PrintingPolicy &pp)
Get the default value as string.
const std::string Decls2FwdDecls(const std::vector< const clang::Decl * > &decls, bool(*ignoreFiles)(const clang::PresumedLoc &), const cling::Interpreter &interp)
static const std::string iotype("iotype")
static const std::string name("name")
static const std::string transient("transient")
static const std::string separator("@@@")
static const std::string pattern("pattern")
static const std::string persistent("persistent")
static const std::string nArgsToKeep("nArgsToKeep")
static const std::string ioname("ioname")
static const std::string comment("comment")
llvm::StringRef GetClassComment(const clang::CXXRecordDecl &decl, clang::SourceLocation *loc, const cling::Interpreter &interpreter)
Return the class comment after the ClassDef: class MyClass { ... ClassDef(MyClass,...
const T * GetAnnotatedRedeclarable(const T *Redecl)
Definition: TClingUtils.h:638
int extractPropertyNameValFromString(const std::string attributeStr, std::string &attrName, std::string &attrValue)
bool hasOpaqueTypedef(clang::QualType instanceType, const TNormalizedCtxt &normCtxt)
Return true if the type is a Double32_t or Float16_t or is a instance template that depends on Double...
EIOCtorCategory CheckConstructor(const clang::CXXRecordDecl *, const RConstructorType &, const cling::Interpreter &interp)
Check if class has constructor of provided type - either default or with single argument.
clang::RecordDecl * GetUnderlyingRecordDecl(clang::QualType type)
void Info(const char *location, const char *va_(fmt),...)
Definition: TClingUtils.h:806
bool BeginsWith(const std::string &theString, const std::string &theSubstring)
const int kMaxLen
Definition: TClingUtils.h:129
llvm::StringRef DataMemberInfo__ValidArrayIndex(const clang::DeclaratorDecl &m, int *errnum=0, llvm::StringRef *errstr=0)
ValidArrayIndex return a static string (so use it or copy it immediatly, do not call GrabIndex twice ...
const clang::FunctionDecl * ClassInfo__HasMethod(const clang::DeclContext *cl, char const *, const cling::Interpreter &interp)
bool GetNameWithinNamespace(std::string &, std::string &, std::string &, clang::CXXRecordDecl const *)
Return true if one of the class' enclosing scope is a namespace and set fullname to the fully qualifi...
const clang::RecordDecl * ExtractEnclosingScopes(const clang::Decl &decl, std::list< std::pair< std::string, unsigned int > > &enclosingSc)
Extract the names and types of containing scopes.
bool HasCustomOperatorNewArrayPlacement(clang::RecordDecl const &, const cling::Interpreter &interp)
return true if we can find a custom operator new with placement
void WriteClassInit(std::ostream &finalString, const AnnotatedRecordDecl &cl, const clang::CXXRecordDecl *decl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt, const RConstructorTypes &ctorTypes, bool &needCollectionProxy)
FIXME: a function of ~300 lines!
int WriteNamespaceHeader(std::ostream &, const clang::RecordDecl *)
int GetClassVersion(const clang::RecordDecl *cl, const cling::Interpreter &interp)
Return the version number of the class or -1 if the function Class_Version does not exist.
void Error(const char *location, const char *va_(fmt),...)
Definition: TClingUtils.h:786
DataMemberInfo__ValidArrayIndex_error_code
Definition: TClingUtils.h:115
clang::QualType GetTypeForIO(const clang::QualType &templateInstanceType, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt, TClassEdit::EModType mode=TClassEdit::kNone)
int extractAttrString(clang::Attr *attribute, std::string &attrString)
Extract attr string.
void GetNormalizedName(std::string &norm_name, const clang::QualType &type, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt)
Return the type name normalized for ROOT, keeping only the ROOT opaque typedef (Double32_t,...
void WritePointersSTL(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt)
Write interface function for STL members.
bool HasNewMerge(clang::CXXRecordDecl const *, const cling::Interpreter &)
Return true if the class has a method Merge(TCollection*,TFileMergeInfo*)
bool CheckPublicFuncWithProto(clang::CXXRecordDecl const *, char const *, char const *, const cling::Interpreter &, bool diagnose)
Return true, if the function (defined by the name and prototype) exists and is public.
void Fatal(const char *location, const char *va_(fmt),...)
Definition: TClingUtils.h:826
clang::ClassTemplateDecl * QualType2ClassTemplateDecl(const clang::QualType &qt)
Extract from a qualtype the class template if this makes sense.
int IsSTLContainer(const AnnotatedRecordDecl &annotated)
Is this an STL container.
std::list< RConstructorType > RConstructorTypes
Definition: TClingUtils.h:318
int extractPropertyNameVal(clang::Attr *attribute, std::string &attrName, std::string &attrValue)
std::string GetModuleFileName(const char *moduleName)
Return the dictionary file name for a module.
const int kFatal
Definition: TClingUtils.h:128
const int kWarning
Definition: TClingUtils.h:125
const int kSysError
Definition: TClingUtils.h:127
clang::QualType ReSubstTemplateArg(clang::QualType input, const clang::Type *instance)
Check if 'input' or any of its template parameter was substituted when instantiating the class templa...
llvm::StringRef GetFileName(const clang::Decl &decl, const cling::Interpreter &interp)
Return the header file to be included to declare the Decl.
bool NeedDestructor(clang::CXXRecordDecl const *, const cling::Interpreter &)
bool EndsWith(const std::string &theString, const std::string &theSubstring)
void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const cling::Interpreter &interpreter)
void LevelPrint(bool prefix, int level, const char *location, const char *fmt, va_list ap)
Definition: TClingUtils.h:747
bool NeedTemplateKeyword(clang::CXXRecordDecl const *)
bool HasCustomConvStreamerMemberFunction(const AnnotatedRecordDecl &cl, const clang::CXXRecordDecl *clxx, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt)
Return true if the class has a custom member function streamer.
bool HasDirectoryAutoAdd(clang::CXXRecordDecl const *, const cling::Interpreter &)
Return true if the class has a method DirectoryAutoAdd(TDirectory *)
const clang::FunctionDecl * GetFuncWithProto(const clang::Decl *cinfo, const char *method, const char *proto, const cling::Interpreter &gInterp, bool diagnose)
bool MatchWithDeclOrAnyOfPrevious(const clang::CXXRecordDecl &cl, const clang::CXXRecordDecl &currentCl)
This is a recursive function.
clang::QualType GetNormalizedType(const clang::QualType &type, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt)
Return the type normalized for ROOT, keeping only the ROOT opaque typedef (Double32_t,...
bool & GetWarningsAreErrors()
Definition: TClingUtils.h:733
const char * ShortTypeName(const char *typeDesc)
Return the absolute type of typeDesc.
void GetCppName(std::string &output, const char *input)
Return (in the argument 'output') a mangled version of the C++ symbol/type (pass as 'input') that can...
bool HasCustomOperatorNewPlacement(char const *, clang::RecordDecl const &, const cling::Interpreter &)
return true if we can find a custom operator new with placement
bool IsStdClass(const clang::RecordDecl &cl)
Return true, if the decl is part of the std namespace.
void CreateNameTypeMap(clang::CXXRecordDecl const &, std::map< std::string, ROOT::Internal::TSchemaType > &)
bool HasResetAfterMerge(clang::CXXRecordDecl const *, const cling::Interpreter &)
Return true if the class has a method ResetAfterMerge(TFileMergeInfo *)
ROOT::ESTLType STLKind(const llvm::StringRef type)
Converts STL container name to number. vector -> 1, etc..
void WriteClassCode(CallWriteStreamer_t WriteStreamerFunc, const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt, std::ostream &finalString, const RConstructorTypes &ctorTypes, bool isGenreflex)
Generate the code of the class If the requestor is genreflex, request the new streamer format.
bool HasOldMerge(clang::CXXRecordDecl const *, const cling::Interpreter &)
Return true if the class has a method Merge(TCollection*)
clang::TemplateName ExtractTemplateNameFromQualType(const clang::QualType &qt)
These manipulations are necessary because a template specialisation type does not inherit from a reco...
int RemoveTemplateArgsFromName(std::string &name, unsigned int)
Remove the last n template arguments from the name.
long GetLineNumber(clang::Decl const *)
It looks like the template specialization decl actually contains less information on the location of ...
void WriteAuxFunctions(std::ostream &finalString, const AnnotatedRecordDecl &cl, const clang::CXXRecordDecl *decl, const cling::Interpreter &interp, const RConstructorTypes &ctorTypes, const TNormalizedCtxt &normCtxt)
std::string NormalizedName; GetNormalizedName(NormalizedName, decl->getASTContext()....
void foreachHeaderInModule(const clang::Module &module, const std::function< void(const clang::Module::Header &)> &closure, bool includeDirectlyUsedModules=true)
Calls the given lambda on every header in the given module.
bool IsBase(const clang::CXXRecordDecl *cl, const clang::CXXRecordDecl *base, const clang::CXXRecordDecl *context, const cling::Interpreter &interp)
void ExtractCtxtEnclosingNameSpaces(const clang::DeclContext &, std::list< std::pair< std::string, bool > > &)
Extract enclosing namespaces recursively.
std::pair< bool, int > GetTrivialIntegralReturnValue(const clang::FunctionDecl *funcCV, const cling::Interpreter &interp)
If the function contains 'just': return SomeValue; this routine will extract this value and return it...
bool HasCustomStreamerMemberFunction(const AnnotatedRecordDecl &cl, const clang::CXXRecordDecl *clxx, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt)
Return true if the class has a custom member function streamer.
std::string GetRealPath(const std::string &path)
Definition: TClingUtils.cxx:73
clang::QualType AddDefaultParameters(clang::QualType instanceType, const cling::Interpreter &interpret, const TNormalizedCtxt &normCtxt)
Add any unspecified template parameters to the class template instance, mentioned anywhere in the typ...
const int kInfo
Definition: TClingUtils.h:123
std::pair< std::string, clang::QualType > GetNameTypeForIO(const clang::QualType &templateInstanceType, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt, TClassEdit::EModType mode=TClassEdit::kNone)
void GetQualifiedName(std::string &qual_name, const clang::QualType &type, const clang::NamedDecl &forcontext)
Main implementation relying on GetFullyQualifiedTypeName All other GetQualifiedName functions leverag...
void SysError(const char *location, const char *va_(fmt),...)
Definition: TClingUtils.h:796
bool ExtractAttrIntPropertyFromName(const clang::Decl &decl, const std::string &propName, int &propValue)
This routine counts on the "propName<separator>propValue" format.
bool IsLinkdefFile(const char *filename)
unsigned int & GetNumberOfErrors()
Definition: TClingUtils.h:725
void SetPathsForRelocatability(std::vector< std::string > &clingArgs)
Organise the parameters for cling in order to guarantee relocatability It treats the gcc toolchain an...
bool IsStreamableObject(const clang::FieldDecl &m, const cling::Interpreter &interp)
void ReplaceAll(std::string &str, const std::string &from, const std::string &to, bool recurse=false)
bool QualType2Template(const clang::QualType &qt, clang::ClassTemplateDecl *&ctd, clang::ClassTemplateSpecializationDecl *&ctsd)
Get the template specialisation decl and template decl behind the qualtype Returns true if successful...
std::string TrueName(const clang::FieldDecl &m)
TrueName strips the typedefs and array dimensions.
const clang::Type * GetUnderlyingType(clang::QualType type)
Return the base/underlying type of a chain of array or pointers type.
ROOT::ESTLType IsSTLCont(const clang::RecordDecl &cl)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container abs(result):...
bool IsStdDropDefaultClass(const clang::RecordDecl &cl)
Return true, if the decl is part of the std namespace and we want its default parameter dropped.
bool RequireCompleteType(const cling::Interpreter &interp, const clang::CXXRecordDecl *cl)
bool IsHeaderName(const std::string &filename)
const int kError
Definition: TClingUtils.h:126
int ElementStreamer(std::ostream &finalString, const clang::NamedDecl &forcontext, const clang::QualType &qti, const char *t, int rwmode, const cling::Interpreter &interp, const char *tcl=0)
bool IsOfType(const clang::CXXRecordDecl &cl, const std::string &type, const cling::LookupHelper &lh)
const std::string & GetPathSeparator()
Return the separator suitable for this platform.
bool CheckDefaultConstructor(const clang::CXXRecordDecl *, const cling::Interpreter &interp)
Checks if default constructor exists and accessible.
EIOCtorCategory CheckIOConstructor(const clang::CXXRecordDecl *, const char *, const clang::CXXRecordDecl *, const cling::Interpreter &interp)
Checks IO constructor - must be public and with specified argument.
bool ExtractAttrPropertyFromName(const clang::Decl &decl, const std::string &propName, std::string &propValue)
This routine counts on the "propName<separator>propValue" format.
const int kNote
Definition: TClingUtils.h:124
void(* CallWriteStreamer_t)(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt, std::ostream &dictStream, bool isAutoStreamer)
Definition: TClingUtils.h:117
const clang::CXXRecordDecl * ScopeSearch(const char *name, const cling::Interpreter &gInterp, bool diagnose, const clang::Type **resultType)
Return the scope corresponding to 'name' or std::'name'.
void Warning(const char *location, const char *va_(fmt),...)
Definition: TClingUtils.h:816
int & GetErrorIgnoreLevel()
Definition: TClingUtils.h:741
void ExtractEnclosingNameSpaces(const clang::Decl &, std::list< std::pair< std::string, bool > > &)
Extract the immediately outer namespace and then launch the recursion.
bool HasIOConstructor(clang::CXXRecordDecl const *, std::string &, const RConstructorTypes &, const cling::Interpreter &)
return true if we can find an constructor calleable without any arguments or with one the IOCtor spec...
llvm::StringRef GetComment(const clang::Decl &decl, clang::SourceLocation *loc=0)
Returns the comment (// striped away), annotating declaration in a meaningful for ROOT IO way.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21
ESTLType
Definition: ESTLType.h:28
static Roo_reg_AGKInteg1D instance
Definition: TString.h:845
bool operator()(const AnnotatedRecordDecl &right, const AnnotatedRecordDecl &left) const
Definition: TClingUtils.h:299
auto * m
Definition: textangle.C:8
static void output(int code)
Definition: gifencode.c:226