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