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