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