Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
15#include <functional>
16#include <set>
17#include <string>
18#include <unordered_set>
19#include <vector>
20#include <list>
21#include <map>
22#include <utility>
23
24#include <cstdlib>
25
26#if defined(__GNUC__) && !defined(__clang__)
27#pragma GCC diagnostic push
28#pragma GCC diagnostic ignored "-Wpragmas"
29#pragma GCC diagnostic ignored "-Wclass-memaccess"
30#endif
31
32#include "clang/Basic/Module.h"
33
34#if defined(__GNUC__) && !defined(__clang__)
35#pragma GCC diagnostic pop
36#endif
37
38namespace llvm {
39 class StringRef;
40}
41
42namespace clang {
43 class ASTContext;
44 class Attr;
47 class CompilerInstance;
48 class CXXBaseSpecifier;
49 class CXXRecordDecl;
50 class Decl;
51 class DeclContext;
52 class DeclaratorDecl;
53 class FieldDecl;
54 class FunctionDecl;
55 class NamedDecl;
56 class ParmVarDecl;
57 class PresumedLoc;
58 class QualType;
59 class RecordDecl;
60 class SourceLocation;
61 class TagDecl;
62 class TemplateDecl;
63 class TemplateName;
64 class TemplateArgument;
67 class Type;
68 class TypeDecl;
69 class TypedefNameDecl;
70 struct PrintingPolicy;
71}
72
73namespace cling {
74 class Interpreter;
75 class LookupHelper;
76 namespace utils {
77 namespace Transform {
78 struct Config;
79 }
80 }
81}
82
83// For ROOT::ESTLType
84#include "ESTLType.h"
85
86// for TClassEdit::TInterpreterLookupHelper
87#include "TClassEdit.h"
88
89#include "Varargs.h"
90
91namespace ROOT {
92namespace TMetaUtils {
93
94///\returns the resolved normalized absolute path possibly resolving symlinks.
95std::string GetRealPath(const std::string &path);
96
97// Forward Declarations --------------------------------------------------------
98class AnnotatedRecordDecl;
99
100// Constants, typedefs and Enums -----------------------------------------------
101
102// Convention for the ROOT relevant properties
103namespace propNames{
104 static const std::string separator("@@@");
105 static const std::string iotype("iotype");
106 static const std::string name("name");
107 static const std::string pattern("pattern");
108 static const std::string ioname("ioname");
109 static const std::string comment("comment");
110 static const std::string nArgsToKeep("nArgsToKeep");
111 static const std::string persistent("persistent");
112 static const std::string transient("transient");
113}
114
115// Get the array index information for a data member.
117
118typedef void (*CallWriteStreamer_t)(const AnnotatedRecordDecl &cl,
119 const cling::Interpreter &interp,
121 std::ostream& dictStream,
122 bool isAutoStreamer);
123
124const int kInfo = 0;
125const int kNote = 500;
126const int kWarning = 1000;
127const int kError = 2000;
128const int kSysError = 3000;
129const int kFatal = 4000;
130const int kMaxLen = 1024;
131
132// Classes ---------------------------------------------------------------------
134
135//______________________________________________________________________________
137private:
139public:
140 using Config_t = cling::utils::Transform::Config;
141 using TypesCont_t = std::set<const clang::Type*>;
142 using TemplPtrIntMap_t = std::map<const clang::ClassTemplateDecl*, int>;
143
144 TNormalizedCtxt(const cling::LookupHelper &lh);
147 const Config_t& GetConfig() const;
148 const TypesCont_t &GetTypeWithAlternative() const;
149
150 void AddTemplAndNargsToKeep(const clang::ClassTemplateDecl* templ, unsigned int i);
151 int GetNargsToKeep(const clang::ClassTemplateDecl* templ) const;
153 void keepTypedef(const cling::LookupHelper &lh, const char* name,
154 bool replace = false);
155};
156
157//______________________________________________________________________________
159public:
160 typedef bool (*ExistingTypeCheck_t)(const std::string &tname, std::string &result);
161 typedef bool (*CheckInClassTable_t)(const std::string &tname, std::string &result);
162 typedef bool (*AutoParse_t)(const char *name);
163
164private:
165 cling::Interpreter *fInterpreter;
171 const int *fPDebug; // debug flag, might change at runtime thus *
172 bool WantDiags() const { return fPDebug && *fPDebug > 5; }
173
174public:
177 const int *pgDebug = nullptr);
178 virtual ~TClingLookupHelper() { /* we're not owner */ }
179
180 bool CheckInClassTable(const std::string &tname, std::string &result) override;
181 bool ExistingTypeCheck(const std::string &tname, std::string &result) override;
182 void GetPartiallyDesugaredName(std::string &nameLong) override;
183 bool IsAlreadyPartiallyDesugaredName(const std::string &nondef, const std::string &nameLong) override;
184 bool IsDeclaredScope(const std::string &base, bool &isInlined) override;
185 bool GetPartiallyDesugaredNameWithScopeHandling(const std::string &tname, std::string &result, bool dropstd = true) override;
186 void ShuttingDownSignal() override;
187};
188
189//______________________________________________________________________________
191private:
192 static std::string BuildDemangledTypeInfo(const clang::RecordDecl *rDecl,
193 const std::string &normalizedName);
195 const clang::RecordDecl* fDecl;
196 std::string fRequestedName;
197 std::string fNormalizedName;
199 // clang-format off
207 // clang-format on
208
209public:
210 // clang-format off
217 // kHasCustomStreamerMember = 0x10 (see TClingUtils.cxx and TClassTable.h)
220 };
221 // clang-format on
222
223 // clang-format off
225 const clang::RecordDecl *decl,
226 bool rStreamerInfo,
227 bool rNoStreamer,
232 const std::string &rRequestedRNTupleSoARecord,
233 const cling::Interpreter &interpret,
235
237 const clang::RecordDecl *decl,
238 const char *requestName,
239 bool rStreamerInfo,
240 bool rNoStreamer,
245 const std::string &rRequestedRNTupleSoARecord,
246 const cling::Interpreter &interpret,
248
250 const clang::Type *requestedType,
251 const clang::RecordDecl *decl,
252 const char *requestedName,
253 bool rStreamerInfo,
254 bool rNoStreamer,
259 const std::string &rRequestedRNTupleSoARecord,
260 const cling::Interpreter &interpret,
262
264 const clang::Type *requestedType,
265 const clang::RecordDecl *decl,
266 const char *requestedName,
267 unsigned int nTemplateArgsToSkip,
268 bool rStreamerInfo,
269 bool rNoStreamer,
274 const std::string &rRequestedRNTupleSoARecord,
275 const cling::Interpreter &interpret,
277 // clang-format on
278
280 // Nothing to do we do not own the pointer;
281 }
282
283
284 long GetRuleIndex() const { return fRuleIndex; }
285
286 const char *GetRequestedName() const { return fRequestedName.c_str(); }
287 const char *GetNormalizedName() const { return fNormalizedName.c_str(); }
288 const std::string &GetDemangledTypeInfo() const { return fDemangledTypeInfo; }
289 bool HasClassVersion() const { return fRequestedVersionNumber >=0 ; }
290 bool RequestStreamerInfo() const {
291 // Equivalent to CINT's cl.RootFlag() & G__USEBYTECOUNT
293 }
294 // clang-format off
296 bool RequestNoStreamer() const { return fRequestNoStreamer; }
297 bool RequestOnlyTClass() const { return fRequestOnlyTClass; }
300 const std::string &RequestedRNTupleSoARecord() const { return fRequestedRNTupleSoARecord; }
301 // clang-format on
302 int RootFlag() const {
303 // Return the request (streamerInfo, has_version, etc.) combined in a single
304 // int. See RScanner::AnnotatedRecordDecl::ERootFlag.
305 int result = 0;
311 case 0: break;
312 case 1: result |= kNtplForceNativeMode; break;
313 case -1: result |= kNtplForceStreamerMode; break;
314 default: assert(false && "invalid setting of fRequestedRNTupleSerializationMode");
315 }
316 return result;
317 }
318 const clang::RecordDecl* GetRecordDecl() const { return fDecl; }
319
320 operator clang::RecordDecl const *() const {
321 return fDecl;
322 }
323
324 bool operator<(const AnnotatedRecordDecl& right) const
325 {
326 return fRuleIndex < right.fRuleIndex;
327 }
328
330 bool operator() (const AnnotatedRecordDecl& right, const AnnotatedRecordDecl& left) const
331 {
332 return left.fNormalizedName < right.fNormalizedName;
333 }
334 };
335};
336
337//______________________________________________________________________________
339private:
340 const std::string fArgTypeName;
341 const clang::CXXRecordDecl *fArgType;
342
343public:
344 RConstructorType(const char *type_of_arg, const cling::Interpreter&);
345
346 const char *GetName() const ;
347 const clang::CXXRecordDecl *GetType() const;
348};
349typedef std::list<RConstructorType> RConstructorTypes;
350
351// Functions -------------------------------------------------------------------
352
353//______________________________________________________________________________
354int extractAttrString(clang::Attr* attribute, std::string& attrString);
355
356//______________________________________________________________________________
357int extractPropertyNameValFromString(const std::string attributeStr,std::string& attrName, std::string& attrValue);
358
359//______________________________________________________________________________
360int extractPropertyNameVal(clang::Attr* attribute, std::string& attrName, std::string& attrValue);
361
362//______________________________________________________________________________
363bool ExtractAttrPropertyFromName(const clang::Decl& decl,
364 const std::string& propName,
365 std::string& propValue);
366
367//______________________________________________________________________________
368bool ExtractAttrIntPropertyFromName(const clang::Decl& decl,
369 const std::string& propName,
370 int& propValue);
371
372//______________________________________________________________________________
373bool RequireCompleteType(const cling::Interpreter &interp, const clang::CXXRecordDecl *cl);
374
375//______________________________________________________________________________
376bool RequireCompleteType(const cling::Interpreter &interp, clang::SourceLocation Loc, clang::QualType Type);
377
378//______________________________________________________________________________
379// Add default template parameters.
380clang::QualType AddDefaultParameters(clang::QualType instanceType,
381 const cling::Interpreter &interpret,
383
384//______________________________________________________________________________
385llvm::StringRef DataMemberInfo__ValidArrayIndex(const cling::Interpreter& interp, const clang::DeclaratorDecl &m, int *errnum = nullptr, llvm::StringRef *errstr = nullptr);
386
388
389//______________________________________________________________________________
390EIOCtorCategory CheckConstructor(const clang::CXXRecordDecl*, const RConstructorType&, const cling::Interpreter& interp);
391
392//______________________________________________________________________________
393bool CheckDefaultConstructor(const clang::CXXRecordDecl*, const cling::Interpreter& interp);
394
395//______________________________________________________________________________
396EIOCtorCategory CheckIOConstructor(const clang::CXXRecordDecl*, const char *, const clang::CXXRecordDecl *, const cling::Interpreter& interp);
397
398//______________________________________________________________________________
399const clang::FunctionDecl* ClassInfo__HasMethod(const clang::DeclContext *cl, char const*, const cling::Interpreter& interp);
400
401//______________________________________________________________________________
402int ElementStreamer(std::ostream& finalString,
403 const clang::NamedDecl &forcontext,
404 const clang::QualType &qti,
405 const char *t,
406 int rwmode,
407 const cling::Interpreter &interp,
408 const char *tcl = nullptr);
409
410//______________________________________________________________________________
411bool IsBase(const clang::CXXRecordDecl *cl, const clang::CXXRecordDecl *base, const clang::CXXRecordDecl *context,const cling::Interpreter &interp);
412
413//______________________________________________________________________________
414bool IsBase(const clang::FieldDecl &m, const char* basename, const cling::Interpreter &interp);
415
416//______________________________________________________________________________
417bool HasCustomOperatorNewArrayPlacement(clang::RecordDecl const&, const cling::Interpreter &interp);
418
419//______________________________________________________________________________
420bool HasCustomOperatorNewPlacement(char const*, clang::RecordDecl const&, const cling::Interpreter&);
421
422//______________________________________________________________________________
423bool HasCustomOperatorNewPlacement(clang::RecordDecl const&, const cling::Interpreter&);
424
425//______________________________________________________________________________
426bool HasDirectoryAutoAdd(clang::CXXRecordDecl const*, const cling::Interpreter&);
427
428//______________________________________________________________________________
429bool HasIOConstructor(clang::CXXRecordDecl const*, std::string&, const RConstructorTypes&, const cling::Interpreter&);
430
431//______________________________________________________________________________
432bool HasNewMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
433
434//______________________________________________________________________________
435bool HasOldMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
436
437//______________________________________________________________________________
438bool hasOpaqueTypedef(clang::QualType instanceType, const TNormalizedCtxt &normCtxt);
439
440//______________________________________________________________________________
441bool hasOpaqueTypedef(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt);
442
443//______________________________________________________________________________
444bool HasResetAfterMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
445
446//______________________________________________________________________________
447bool NeedDestructor(clang::CXXRecordDecl const*, const cling::Interpreter&);
448
449//______________________________________________________________________________
450bool NeedTemplateKeyword(clang::CXXRecordDecl const*);
451
452//______________________________________________________________________________
453bool CheckPublicFuncWithProto(clang::CXXRecordDecl const*, char const*, char const*,
454 const cling::Interpreter&, bool diagnose);
455
456//______________________________________________________________________________
457long GetLineNumber(clang::Decl const*);
458
459//______________________________________________________________________________
460bool GetNameWithinNamespace(std::string&, std::string&, std::string&, clang::CXXRecordDecl const*);
461
462//______________________________________________________________________________
463void GetQualifiedName(std::string &qual_name, const clang::QualType &type, const clang::NamedDecl &forcontext);
464
465//----
466std::string GetQualifiedName(const clang::QualType &type, const clang::NamedDecl &forcontext);
467
468//______________________________________________________________________________
469void GetQualifiedName(std::string &qual_name, const clang::Type &type, const clang::NamedDecl &forcontext);
470
471//----
472std::string GetQualifiedName(const clang::Type &type, const clang::NamedDecl &forcontext);
473
474//______________________________________________________________________________
475void GetQualifiedName(std::string &qual_name, const clang::NamedDecl &nd);
476
477//----
478std::string GetQualifiedName(const clang::NamedDecl &nd);
479
480//______________________________________________________________________________
481void GetQualifiedName(std::string &qual_name, const AnnotatedRecordDecl &annotated);
482
483//----
484std::string GetQualifiedName(const AnnotatedRecordDecl &annotated);
485
486//______________________________________________________________________________
487void GetQualifiedName(std::string &qual_name, const clang::RecordDecl &recordDecl);
488
489//----
490std::string GetQualifiedName(const clang::RecordDecl &recordDecl);
491
492//______________________________________________________________________________
493int WriteNamespaceHeader(std::ostream&, const clang::RecordDecl *);
494
495//______________________________________________________________________________
496int WriteNamespaceHeader(std::ostream&, const clang::DeclContext *);
497
498//______________________________________________________________________________
499void WritePointersSTL(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt);
500
501//______________________________________________________________________________
502int GetClassVersion(const clang::RecordDecl *cl, const cling::Interpreter &interp);
503
504//______________________________________________________________________________
505std::pair<bool, int> GetTrivialIntegralReturnValue(const clang::FunctionDecl *funcCV, const cling::Interpreter &interp);
506
507//______________________________________________________________________________
508int IsSTLContainer(const AnnotatedRecordDecl &annotated);
509
510//______________________________________________________________________________
511ROOT::ESTLType IsSTLContainer(const clang::FieldDecl &m);
512
513//______________________________________________________________________________
514int IsSTLContainer(const clang::CXXBaseSpecifier &base);
515
516void foreachHeaderInModule(const clang::Module &module,
517 const std::function<void(const clang::Module::Header &)> &closure,
518 bool includeDirectlyUsedModules = true);
519
520//______________________________________________________________________________
521const char *ShortTypeName(const char *typeDesc);
522
523//______________________________________________________________________________
524std::string ShortTypeName(const clang::FieldDecl &m);
525
526//______________________________________________________________________________
527bool IsStreamableObject(const clang::FieldDecl &m, const cling::Interpreter& interp);
528
529//______________________________________________________________________________
530clang::RecordDecl *GetUnderlyingRecordDecl(clang::QualType type);
531
532//______________________________________________________________________________
533std::string TrueName(const clang::FieldDecl &m);
534
535//______________________________________________________________________________
536const clang::CXXRecordDecl *ScopeSearch(const char *name,
537 const cling::Interpreter &gInterp,
538 bool diagnose,
539 const clang::Type** resultType);
540
541//______________________________________________________________________________
542void WriteAuxFunctions(std::ostream& finalString,
543 const AnnotatedRecordDecl &cl,
544 const clang::CXXRecordDecl *decl,
545 const cling::Interpreter &interp,
547 const TNormalizedCtxt &normCtxt);
548
549
550//______________________________________________________________________________
551const clang::FunctionDecl *GetFuncWithProto(const clang::Decl* cinfo,
552 const char *method,
553 const char *proto,
554 const cling::Interpreter &gInterp,
555 bool diagnose);
556
557//______________________________________________________________________________
559 const AnnotatedRecordDecl &cl,
560 const cling::Interpreter &interp,
561 const TNormalizedCtxt &normCtxt,
562 std::ostream& finalString,
564 bool isGenreflex);
565
566//______________________________________________________________________________
567void WriteClassInit(std::ostream& finalString,
568 const AnnotatedRecordDecl &cl,
569 const clang::CXXRecordDecl *decl,
570 const cling::Interpreter &interp,
571 const TNormalizedCtxt &normCtxt,
573 bool& needCollectionProxy);
574
575//______________________________________________________________________________
576void WriteStandaloneReadRules(std::ostream &finalString, bool rawrules, std::vector<std::string> &standaloneTargets,
577 const cling::Interpreter &interp);
578
579//______________________________________________________________________________
580void WriteRulesRegistration(std::ostream &finalString, const std::string &dictName,
581 const std::vector<std::string> &standaloneTargets);
582
583//______________________________________________________________________________
584bool HasCustomStreamerMemberFunction(const AnnotatedRecordDecl &cl,
585 const clang::CXXRecordDecl* clxx,
586 const cling::Interpreter &interp,
587 const TNormalizedCtxt &normCtxt);
588
589//______________________________________________________________________________
590bool HasCustomConvStreamerMemberFunction(const AnnotatedRecordDecl &cl,
591 const clang::CXXRecordDecl* clxx,
592 const cling::Interpreter &interp,
593 const TNormalizedCtxt &normCtxt);
594
595//______________________________________________________________________________
596// Return the header file to be included to declare the Decl
597std::string GetFileName(const clang::Decl& decl, const cling::Interpreter& interp);
598
599//______________________________________________________________________________
600// Return the dictionary file name for a module
601std::string GetModuleFileName(const char* moduleName);
602
603//______________________________________________________________________________
604// Return (in the argument 'output') a mangled version of the C++ symbol/type (pass as 'input')
605// that can be used in C++ as a variable name.
606void GetCppName(std::string &output, const char *input);
607
608//______________________________________________________________________________
609// Demangle the input symbol name for dlsym.
610static inline std::string DemangleNameForDlsym(const std::string& name)
611{
612 std::string nameForDlsym = name;
613
614#if defined(R__MACOSX) || defined(R__WIN32)
615 // The JIT gives us a mangled name which has an additional leading underscore
616 // on macOS and Windows, for instance __ZN8TRandom34RndmEv. However, dlsym
617 // requires us to remove it.
618 // FIXME: get this information from the DataLayout via getGlobalPrefix()!
619 if (nameForDlsym[0] == '_')
620 nameForDlsym.erase(0, 1);
621#endif //R__MACOSX
622
623 return nameForDlsym;
624}
625
626//______________________________________________________________________________
627// Return the type with all parts fully qualified (most typedefs),
628// including template arguments, appended to name.
629void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const cling::Interpreter &interpreter);
630
631//______________________________________________________________________________
632// Return the type with all parts fully qualified (most typedefs),
633// including template arguments, appended to name, without using the interpreter
634void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const clang::ASTContext &);
635
636//______________________________________________________________________________
637// Return the type normalized for ROOT,
638// keeping only the ROOT opaque typedef (Double32_t, etc.) and
639// adding default template argument for all types except those explicitly
640// requested to be drop by the user.
641// Default template for STL collections are not yet removed by this routine.
642clang::QualType GetNormalizedType(const clang::QualType &type, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt);
643
644//______________________________________________________________________________
645// Return the type name normalized for ROOT,
646// keeping only the ROOT opaque typedef (Double32_t, etc.) and
647// adding default template argument for all types except the STL collections
648// where we remove the default template argument if any.
649void GetNormalizedName(std::string &norm_name, const clang::QualType &type, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt);
650
651//______________________________________________________________________________
652// Alternative signature
653void GetNormalizedName(std::string &norm_name,
654 const clang::TypeDecl* typeDecl,
655 const cling::Interpreter &interpreter);
656
657//______________________________________________________________________________
658// Analog to GetNameForIO but with types.
659// It uses the LookupHelper of Cling to transform the name in type.
660clang::QualType GetTypeForIO(const clang::QualType& templateInstanceType,
661 const cling::Interpreter &interpreter,
662 const TNormalizedCtxt &normCtxt,
664
665//______________________________________________________________________________
666// Get the name and the type for the IO given a certain type. In some sense the
667// combination of GetNameForIO and GetTypeForIO.
668std::pair<std::string,clang::QualType> GetNameTypeForIO(const clang::QualType& templateInstanceType,
669 const cling::Interpreter &interpreter,
670 const TNormalizedCtxt &normCtxt,
672
673//______________________________________________________________________________
674// Returns comment in a meaningful way
675llvm::StringRef GetComment(const clang::Decl &decl, clang::SourceLocation *loc = nullptr);
676
677//______________________________________________________________________________
678// Returns true if class def macro exists
679bool HasClassDefMacro(const clang::Decl *decl, const cling::Interpreter &interpreter);
680
681//______________________________________________________________________________
682// Returns the comment of the ClassDef macro
683llvm::StringRef GetClassComment(const clang::CXXRecordDecl &decl, clang::SourceLocation *loc, const cling::Interpreter &interpreter);
684
685//______________________________________________________________________________
686// Return the base/underlying type of a chain of array or pointers type.
687const clang::Type *GetUnderlyingType(clang::QualType type);
688
689//______________________________________________________________________________
690// Scans the redeclaration chain for an annotation.
691//
692// returns 0 if no annotation was found.
693//
694template<typename T>
696 if (!Redecl)
697 return 0;
698
699 Redecl = Redecl->getMostRecentDecl();
700 while (Redecl && !Redecl->hasAttrs())
701 Redecl = Redecl->getPreviousDecl();
702
703 return Redecl;
704}
705
706//______________________________________________________________________________
707// Overload the template for typedefs, because they don't contain
708// isThisDeclarationADefinition method. (Use inline to avoid violating ODR)
709const clang::TypedefNameDecl* GetAnnotatedRedeclarable(const clang::TypedefNameDecl* TND);
710
711//______________________________________________________________________________
712// Overload the template for tags, because we only check definitions.
713const clang::TagDecl* GetAnnotatedRedeclarable(const clang::TagDecl* TND);
714
715//______________________________________________________________________________
716// Return true if the DeclContext is representing an entity reacheable from the
717// global namespace
718bool IsCtxtReacheable(const clang::DeclContext &ctxt);
719
720//______________________________________________________________________________
721// Return true if the decl is representing an entity reacheable from the
722// global namespace
723bool IsDeclReacheable(const clang::Decl &decl);
724
725//______________________________________________________________________________
726// Return true if the decl is part of the std namespace.
727bool IsStdClass(const clang::RecordDecl &cl);
728
729//______________________________________________________________________________
730// Return true, if the decl is part of the std namespace and we want
731// its default parameter dropped.
732bool IsStdDropDefaultClass(const clang::RecordDecl &cl);
733
734//______________________________________________________________________________
735// See if the CXXRecordDecl matches the current of any of the previous CXXRecordDecls
736bool MatchWithDeclOrAnyOfPrevious(const clang::CXXRecordDecl &cl, const clang::CXXRecordDecl &currentCl);
737
738//______________________________________________________________________________
739// Return true if the decl is of type
740bool IsOfType(const clang::CXXRecordDecl &cl, const std::string& type, const cling::LookupHelper& lh);
741
742//______________________________________________________________________________
743// Return which kind of STL container the decl is, if any.
744ROOT::ESTLType IsSTLCont(const clang::RecordDecl &cl);
745
746//______________________________________________________________________________
747// Check if 'input' or any of its template parameter was substituted when
748// instantiating the class template instance and replace it with the
749// partially sugared type we have from 'instance'.
750clang::QualType ReSubstTemplateArg(clang::QualType input, const clang::Type *instance);
751
752//______________________________________________________________________________
753// Remove the last n template arguments from the name
754int RemoveTemplateArgsFromName(std::string& name, unsigned int);
755
756//______________________________________________________________________________
757clang::TemplateName ExtractTemplateNameFromQualType(const clang::QualType& qt);
758
759//______________________________________________________________________________
760bool QualType2Template(const clang::QualType& qt,
761 clang::ClassTemplateDecl*& ctd,
762 clang::ClassTemplateSpecializationDecl*& ctsd);
763
764//______________________________________________________________________________
765clang::ClassTemplateDecl* QualType2ClassTemplateDecl(const clang::QualType& qt);
766
767//______________________________________________________________________________
768// Extract the namespaces enclosing a DeclContext
769void ExtractCtxtEnclosingNameSpaces(const clang::DeclContext&,
770 std::list<std::pair<std::string,bool> >&);
771//______________________________________________________________________________
772void ExtractEnclosingNameSpaces(const clang::Decl&,
773 std::list<std::pair<std::string,bool> >&);
774
775//______________________________________________________________________________
776const clang::RecordDecl* ExtractEnclosingScopes(const clang::Decl& decl,
777 std::list<std::pair<std::string,unsigned int> >& enclosingSc);
778//______________________________________________________________________________
779// Kind of stl container
780ROOT::ESTLType STLKind(const llvm::StringRef type);
781
782//______________________________________________________________________________
783// Set the toolchain and the include paths for relocatability
784void SetPathsForRelocatability(std::vector<std::string>& clingArgs);
785
786//______________________________________________________________________________
787void ReplaceAll(std::string& str, const std::string& from, const std::string& to, bool recurse=false);
788
789// Functions for the printouts -------------------------------------------------
790
791//______________________________________________________________________________
792inline unsigned int &GetNumberOfErrors()
793{
794 static unsigned int gNumberOfErrors = 0;
795 return gNumberOfErrors;
796}
797
798//______________________________________________________________________________
799// True if printing a warning should increase GetNumberOfErrors
801{
802 static bool gWarningsAreErrors = false;
803 return gWarningsAreErrors;
804}
805
806//______________________________________________________________________________
807// Inclusive minimum error level a message needs to get handled
808inline int &GetErrorIgnoreLevel() {
810 return gErrorIgnoreLevel;
811}
812
813//______________________________________________________________________________
814inline void LevelPrint(bool prefix, int level, const char *location, const char *fmt, va_list ap)
815{
816 if (level < GetErrorIgnoreLevel())
817 return;
818
819 const char *type = nullptr;
820
821 if (level >= ROOT::TMetaUtils::kInfo)
822 type = "Info";
823 if (level >= ROOT::TMetaUtils::kNote)
824 type = "Note";
825 if (level >= ROOT::TMetaUtils::kWarning)
826 type = "Warning";
827 if (level >= ROOT::TMetaUtils::kError)
828 type = "Error";
829 if (level >= ROOT::TMetaUtils::kSysError)
830 type = "SysError";
831 if (level >= ROOT::TMetaUtils::kFatal)
832 type = "Fatal";
833
834 if (!location || !location[0]) {
835 if (prefix) fprintf(stderr, "%s: ", type);
836 vfprintf(stderr, (const char*)va_(fmt), ap);
837 } else {
838 if (prefix) fprintf(stderr, "%s in <%s>: ", type, location);
839 else fprintf(stderr, "In <%s>: ", location);
840 vfprintf(stderr, (const char*)va_(fmt), ap);
841 }
842
843 fflush(stderr);
844
845 // Keep track of the warnings/errors we printed.
848 }
849}
850
851//______________________________________________________________________________
852// Use this function in case an error occurred.
853inline void Error(const char *location, const char *va_(fmt), ...)
854{
855 va_list ap;
856 va_start(ap,va_(fmt));
857 LevelPrint(true, ROOT::TMetaUtils::kError, location, va_(fmt), ap);
858 va_end(ap);
859}
860
861//______________________________________________________________________________
862// Use this function in case a system (OS or GUI) related error occurred.
863inline void SysError(const char *location, const char *va_(fmt), ...)
864{
865 va_list ap;
866 va_start(ap, va_(fmt));
867 LevelPrint(true, ROOT::TMetaUtils::kSysError, location, va_(fmt), ap);
868 va_end(ap);
869}
870
871//______________________________________________________________________________
872// Use this function for informational messages.
873inline void Info(const char *location, const char *va_(fmt), ...)
874{
875 va_list ap;
876 va_start(ap,va_(fmt));
877 LevelPrint(true, ROOT::TMetaUtils::kInfo, location, va_(fmt), ap);
878 va_end(ap);
879}
880
881//______________________________________________________________________________
882// Use this function in warning situations.
883inline void Warning(const char *location, const char *va_(fmt), ...)
884{
885 va_list ap;
886 va_start(ap,va_(fmt));
887 LevelPrint(true, ROOT::TMetaUtils::kWarning, location, va_(fmt), ap);
888 va_end(ap);
889}
890
891//______________________________________________________________________________
892// Use this function in case of a fatal error. It will abort the program.
893inline void Fatal(const char *location, const char *va_(fmt), ...)
894{
895 va_list ap;
896 va_start(ap,va_(fmt));
897 LevelPrint(true, ROOT::TMetaUtils::kFatal, location, va_(fmt), ap);
898 va_end(ap);
899}
900
901//______________________________________________________________________________
902const std::string& GetPathSeparator();
903
904//______________________________________________________________________________
905bool EndsWith(const std::string &theString, const std::string &theSubstring);
906
907//______________________________________________________________________________
908bool BeginsWith(const std::string &theString, const std::string &theSubstring);
909
910//______________________________________________________________________________
911bool IsLinkdefFile(const char *filename);
912
913//______________________________________________________________________________
914bool IsHeaderName(const std::string &filename);
915
916//______________________________________________________________________________
917namespace AST2SourceTools {
918
919//______________________________________________________________________________
920const std::string Decls2FwdDecls(const std::vector<const clang::Decl*> &decls,
921 bool (*ignoreFiles)(const clang::PresumedLoc&) ,
922 const cling::Interpreter& interp, std::string *logs);
923
924//______________________________________________________________________________
925int PrepareArgsForFwdDecl(std::string& templateArgs,
926 const clang::TemplateParameterList& tmplParamList,
927 const cling::Interpreter& interpreter);
928
929//______________________________________________________________________________
930int EncloseInNamespaces(const clang::Decl& decl, std::string& defString);
931
932//______________________________________________________________________________
933const clang::RecordDecl* EncloseInScopes(const clang::Decl& decl, std::string& defString);
934
935//______________________________________________________________________________
936int FwdDeclFromRcdDecl(const clang::RecordDecl& recordDecl,
937 const cling::Interpreter& interpreter,
938 std::string& defString,
939 bool acceptStl=false);
940
941//______________________________________________________________________________
942int FwdDeclFromTmplDecl(const clang::TemplateDecl& tmplDecl,
943 const cling::Interpreter& interpreter,
944 std::string& defString);
945
946//______________________________________________________________________________
947int FwdDeclIfTmplSpec(const clang::RecordDecl& recordDecl,
948 const cling::Interpreter& interpreter,
949 std::string& defString,
950 const std::string &normalizedName);
951//______________________________________________________________________________
952int GetDefArg(const clang::ParmVarDecl& par, std::string& valAsString, const clang::PrintingPolicy& pp);
953
954//______________________________________________________________________________
955int FwdDeclFromFcnDecl(const clang::FunctionDecl& fcnDecl,
956 const cling::Interpreter& interpreter,
957 std::string& defString);
958//______________________________________________________________________________
959int FwdDeclFromTypeDefNameDecl(const clang::TypedefNameDecl& tdnDecl,
960 const cling::Interpreter& interpreter,
961 std::string& fwdDeclString,
962 std::unordered_set<std::string>* fwdDeclSet=nullptr);
963
964} // namespace AST2SourceTools
965
966} // namespace TMetaUtils
967
968} // namespace ROOT
969
970#endif // ROOT_TMetaUtils
static Roo_reg_AGKInteg1D instance
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Int_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
Definition TError.cxx:33
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:157
#define va_(arg)
Definition Varargs.h:35
const char * proto
Definition civetweb.c:18822
const clang::RecordDecl * GetRecordDecl() const
AnnotatedRecordDecl(long index, const clang::RecordDecl *decl, bool rStreamerInfo, bool rNoStreamer, bool rRequestNoInputOperator, bool rRequestOnlyTClass, int rRequestedVersionNumber, int rRequestedRNTupleSerializationMode, const std::string &rRequestedRNTupleSoARecord, const cling::Interpreter &interpret, const TNormalizedCtxt &normCtxt)
There is no requested type name.
const clang::RecordDecl * fDecl
const std::string & RequestedRNTupleSoARecord() const
bool operator<(const AnnotatedRecordDecl &right) const
const char * GetRequestedName() const
static std::string BuildDemangledTypeInfo(const clang::RecordDecl *rDecl, const std::string &normalizedName)
const std::string & GetDemangledTypeInfo() const
const char * GetNormalizedName() const
const clang::CXXRecordDecl * fArgType
const clang::CXXRecordDecl * GetType() const
RConstructorType(const char *type_of_arg, const cling::Interpreter &)
bool IsDeclaredScope(const std::string &base, bool &isInlined) override
bool IsAlreadyPartiallyDesugaredName(const std::string &nondef, const std::string &nameLong) override
bool(* AutoParse_t)(const char *name)
bool(* ExistingTypeCheck_t)(const std::string &tname, std::string &result)
TClingLookupHelper(cling::Interpreter &interpreter, TNormalizedCtxt &normCtxt, ExistingTypeCheck_t existingTypeCheck, CheckInClassTable_t CheckInClassTable, AutoParse_t autoParse, bool *shuttingDownPtr, const int *pgDebug=nullptr)
ExistingTypeCheck_t fExistingTypeCheck
CheckInClassTable_t fCheckInClassTable
bool(* CheckInClassTable_t)(const std::string &tname, std::string &result)
bool GetPartiallyDesugaredNameWithScopeHandling(const std::string &tname, std::string &result, bool dropstd=true) override
We assume that we have a simple type: [const] typename[*&][const].
bool CheckInClassTable(const std::string &tname, std::string &result) override
void GetPartiallyDesugaredName(std::string &nameLong) override
bool ExistingTypeCheck(const std::string &tname, std::string &result) override
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
std::map< const clang::ClassTemplateDecl *, int > TemplPtrIntMap_t
TNormalizedCtxt(const cling::LookupHelper &lh)
TNormalizedCtxtImpl * fImpl
const TypesCont_t & GetTypeWithAlternative() const
std::set< const clang::Type * > TypesCont_t
int GetNargsToKeep(const clang::ClassTemplateDecl *templ) const
const Config_t & GetConfig() const
const TemplPtrIntMap_t GetTemplNargsToKeepMap() const
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.
int FwdDeclIfTmplSpec(const clang::RecordDecl &recordDecl, const cling::Interpreter &interpreter, std::string &defString, const std::string &normalizedName)
Convert a tmplt decl to its fwd decl.
const std::string Decls2FwdDecls(const std::vector< const clang::Decl * > &decls, bool(*ignoreFiles)(const clang::PresumedLoc &), const cling::Interpreter &interp, std::string *logs)
static const std::string iotype("iotype")
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")
bool HasClassDefMacro(const clang::Decl *decl, const cling::Interpreter &interpreter)
Return true if class has any of class declarations like ClassDef, ClassDefNV, ClassDefOverride.
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)
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)
bool BeginsWith(const std::string &theString, const std::string &theSubstring)
const int kMaxLen
bool IsDeclReacheable(const clang::Decl &decl)
Return true if the decl is representing an entity reacheable from the global namespace.
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 Error(const char *location, const char *fmt,...)
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 450+ lines!
void Info(const char *location, const char *fmt,...)
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.
DataMemberInfo__ValidArrayIndex_error_code
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.
std::string GetFileName(const clang::Decl &decl, const cling::Interpreter &interp)
Return the header file to be included to declare the Decl.
void WriteStandaloneReadRules(std::ostream &finalString, bool rawrules, std::vector< std::string > &standaloneTargets, const cling::Interpreter &interp)
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.
void Fatal(const char *location, const char *fmt,...)
std::list< RConstructorType > RConstructorTypes
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 kWarning
const int kSysError
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...
bool NeedDestructor(clang::CXXRecordDecl const *, const cling::Interpreter &)
bool EndsWith(const std::string &theString, const std::string &theSubstring)
static std::string DemangleNameForDlsym(const std::string &name)
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)
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)
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=nullptr)
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()
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 valid name of the C++ symbol/type (pass as 'input') that can be u...
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.
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)
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...
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...
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()
void WriteRulesRegistration(std::ostream &finalString, const std::string &dictName, const std::vector< std::string > &standaloneTargets)
llvm::StringRef GetComment(const clang::Decl &decl, clang::SourceLocation *loc=nullptr)
Returns the comment (// striped away), annotating declaration in a meaningful for ROOT IO way.
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)
void SysError(const char *location, const char *fmt,...)
bool IsHeaderName(const std::string &filename)
void Warning(const char *location, const char *fmt,...)
bool IsCtxtReacheable(const clang::DeclContext &ctxt)
Return true if the DeclContext is representing an entity reacheable from the global namespace.
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.
void(* CallWriteStreamer_t)(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt, std::ostream &dictStream, bool isAutoStreamer)
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'.
int & GetErrorIgnoreLevel()
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 DataMemberInfo__ValidArrayIndex(const cling::Interpreter &interp, const clang::DeclaratorDecl &m, int *errnum=nullptr, llvm::StringRef *errstr=nullptr)
ValidArrayIndex return a static string (so use it or copy it immediatly, do not call GrabIndex twice ...
ESTLType
Definition ESTLType.h:28
bool operator()(const AnnotatedRecordDecl &right, const AnnotatedRecordDecl &left) const
TMarker m
Definition textangle.C:8
static void output()