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