Logo ROOT   6.08/07
Reference Guide
TMetaUtils.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 "RConversionRuleParser.h"
16 
17 #include <set>
18 #include <string>
19 #include <unordered_set>
20 
21 //#include <atomic>
22 #include <stdlib.h>
23 
24 namespace llvm {
25  class StringRef;
26 }
27 
28 namespace clang {
29  class ASTContext;
30  class Attr;
31  class ClassTemplateDecl;
32  class ClassTemplateSpecializationDecl;
33  class CompilerInstance;
34  class CXXBaseSpecifier;
35  class CXXRecordDecl;
36  class Decl;
37  class DeclContext;
38  class DeclaratorDecl;
39  class FieldDecl;
40  class FunctionDecl;
41  class Module;
42  class NamedDecl;
43  class ParmVarDecl;
44  class PresumedLoc;
45  class QualType;
46  class RecordDecl;
47  class SourceLocation;
48  class TagDecl;
49  class TemplateDecl;
50  class TemplateName;
51  class TemplateArgument;
52  class TemplateArgumentList;
53  class TemplateParameterList;
54  class Type;
55  class TypeDecl;
56  class TypedefNameDecl;
57  struct PrintingPolicy;
58 }
59 
60 namespace cling {
61  class Interpreter;
62  class LookupHelper;
63  namespace utils {
64  namespace Transform {
65  struct Config;
66  }
67  }
68 }
69 
70 // For ROOT::ESTLType
71 #include "ESTLType.h"
72 
73 // for TClassEdit::TInterpreterLookupHelper
74 #include "TClassEdit.h"
75 
76 #ifndef ROOT_Varargs
77 #include "Varargs.h"
78 #endif
79 
80 namespace ROOT {
81  namespace TMetaUtils {
82 
83 // Forward Declarations --------------------------------------------------------
84 class AnnotatedRecordDecl;
85 
86 // Constants, typedefs and Enums -----------------------------------------------
87 
88 // Convention for the ROOT relevant properties
89 namespace propNames{
90  static const std::string separator("@@@");
91  static const std::string iotype("iotype");
92  static const std::string name("name");
93  static const std::string pattern("pattern");
94  static const std::string ioname("ioname");
95  static const std::string comment("comment");
96  static const std::string nArgsToKeep("nArgsToKeep");
97  static const std::string persistent("persistent");
98  static const std::string transient("transient");
99 }
100 
101 // Get the array index information for a data member.
103 
105  const cling::Interpreter &interp,
106  const TNormalizedCtxt &normCtxt,
107  std::ostream& dictStream,
108  bool isAutoStreamer);
109 
110 const int kInfo = 0;
111 const int kNote = 500;
112 const int kThrowOnWarning = 999;
113 const int kWarning = 1000;
114 const int kError = 2000;
115 const int kSysError = 3000;
116 const int kFatal = 4000;
117 const int kMaxLen = 1024;
118 
119 // Classes ---------------------------------------------------------------------
120 class TNormalizedCtxtImpl;
121 
122 //______________________________________________________________________________
124 private:
125  TNormalizedCtxtImpl* fImpl;
126 public:
127  using Config_t = cling::utils::Transform::Config;
128  using TypesCont_t = std::set<const clang::Type*>;
129  using TemplPtrIntMap_t = std::map<const clang::ClassTemplateDecl*, int>;
130 
131  TNormalizedCtxt(const cling::LookupHelper &lh);
132  TNormalizedCtxt(const TNormalizedCtxt& other);
133  ~TNormalizedCtxt();
134  const Config_t& GetConfig() const;
135  const TypesCont_t &GetTypeWithAlternative() const;
136 
137  void AddTemplAndNargsToKeep(const clang::ClassTemplateDecl* templ, unsigned int i);
138  int GetNargsToKeep(const clang::ClassTemplateDecl* templ) const;
139  const TemplPtrIntMap_t GetTemplNargsToKeepMap() const;
140  void keepTypedef(const cling::LookupHelper &lh, const char* name,
141  bool replace = false);
142 };
143 
144 //______________________________________________________________________________
146 public:
147  typedef bool (*ExistingTypeCheck_t)(const std::string &tname, std::string &result);
148  typedef bool (*AutoParse_t)(const char *name);
149 
150 private:
151  cling::Interpreter *fInterpreter;
153  ExistingTypeCheck_t fExistingTypeCheck;
154  AutoParse_t fAutoParse;
155  const int *fPDebug; // debug flag, might change at runtime thus *
156  bool WantDiags() const { return fPDebug && *fPDebug > 5; }
157 
158 public:
159  TClingLookupHelper(cling::Interpreter &interpreter, TNormalizedCtxt &normCtxt,
160  ExistingTypeCheck_t existingTypeCheck,
161  AutoParse_t autoParse,
162  const int *pgDebug = 0);
163  virtual ~TClingLookupHelper() { /* we're not owner */ }
164 
165  virtual bool ExistingTypeCheck(const std::string &tname, std::string &result);
166  virtual void GetPartiallyDesugaredName(std::string &nameLong);
167  virtual bool IsAlreadyPartiallyDesugaredName(const std::string &nondef, const std::string &nameLong);
168  virtual bool IsDeclaredScope(const std::string &base, bool &isInlined);
169  virtual bool GetPartiallyDesugaredNameWithScopeHandling(const std::string &tname, std::string &result);
170 };
171 
172 //______________________________________________________________________________
174 private:
176  const clang::RecordDecl* fDecl;
177  std::string fRequestedName;
178  std::string fNormalizedName;
184 
185 public:
186  enum ERootFlag {
187  kNoStreamer = 0x01,
188  kNoInputOperator = 0x02,
189  kUseByteCount = 0x04,
190  kStreamerInfo = 0x04,
191  kHasVersion = 0x08
192  };
193 
194  AnnotatedRecordDecl(long index,
195  const clang::RecordDecl *decl,
196  bool rStreamerInfo,
197  bool rNoStreamer,
198  bool rRequestNoInputOperator,
199  bool rRequestOnlyTClass,
200  int rRequestedVersionNumber,
201  const cling::Interpreter &interpret,
202  const TNormalizedCtxt &normCtxt);
203 
204  AnnotatedRecordDecl(long index,
205  const clang::RecordDecl *decl,
206  const char *requestName,
207  bool rStreamerInfo,
208  bool rNoStreamer,
209  bool rRequestNoInputOperator,
210  bool rRequestOnlyTClass,
211  int rRequestedVersionNumber,
212  const cling::Interpreter &interpret,
213  const TNormalizedCtxt &normCtxt);
214 
215  AnnotatedRecordDecl(long index,
216  const clang::Type *requestedType,
217  const clang::RecordDecl *decl,
218  const char *requestedName,
219  bool rStreamerInfo,
220  bool rNoStreamer,
221  bool rRequestNoInputOperator,
222  bool rRequestOnlyTClass,
223  int rRequestedVersionNumber,
224  const cling::Interpreter &interpret,
225  const TNormalizedCtxt &normCtxt);
226 
227  AnnotatedRecordDecl(long index,
228  const clang::Type *requestedType,
229  const clang::RecordDecl *decl,
230  const char *requestedName,
231  unsigned int nTemplateArgsToSkip,
232  bool rStreamerInfo,
233  bool rNoStreamer,
234  bool rRequestNoInputOperator,
235  bool rRequestOnlyTClass,
236  int rRequestedVersionNumber,
237  const cling::Interpreter &interpret,
238  const TNormalizedCtxt &normCtxt);
239 
241  // Nothing to do we do not own the pointer;
242  }
243 
244 
245  long GetRuleIndex() const { return fRuleIndex; }
246 
247  const char *GetRequestedName() const { return fRequestedName.c_str(); }
248  const char *GetNormalizedName() const { return fNormalizedName.c_str(); }
249  bool HasClassVersion() const { return fRequestedVersionNumber >=0 ; }
250  bool RequestStreamerInfo() const {
251  // Equivalent to CINT's cl.RootFlag() & G__USEBYTECOUNT
252  return fRequestStreamerInfo;
253  }
254  bool RequestNoInputOperator() const { return fRequestNoInputOperator; }
255  bool RequestNoStreamer() const { return fRequestNoStreamer; }
256  bool RequestOnlyTClass() const { return fRequestOnlyTClass; }
257  int RequestedVersionNumber() const { return fRequestedVersionNumber; }
258  int RootFlag() const {
259  // Return the request (streamerInfo, has_version, etc.) combined in a single
260  // int. See RScanner::AnnotatedRecordDecl::ERootFlag.
261  int result = 0;
262  if (fRequestNoStreamer) result = kNoStreamer;
263  if (fRequestNoInputOperator) result |= kNoInputOperator;
264  if (fRequestStreamerInfo) result |= kStreamerInfo;
265  if (fRequestedVersionNumber > -1) result |= kHasVersion;
266  return result;
267  }
268  const clang::RecordDecl* GetRecordDecl() const { return fDecl; }
269 
270  operator clang::RecordDecl const *() const {
271  return fDecl;
272  }
273 
274  bool operator<(const AnnotatedRecordDecl& right) const
275  {
276  return fRuleIndex < right.fRuleIndex;
277  }
278 
279  struct CompareByName {
280  bool operator() (const AnnotatedRecordDecl& right, const AnnotatedRecordDecl& left)
281  {
282  return left.fNormalizedName < right.fNormalizedName;
283  }
284  };
285 };
286 
287 //______________________________________________________________________________
289 private:
290  const std::string fArgTypeName;
291  const clang::CXXRecordDecl *fArgType;
292 
293 public:
294  RConstructorType(const char *type_of_arg, const cling::Interpreter&);
295 
296  const char *GetName() const ;
297  const clang::CXXRecordDecl *GetType() const;
298 };
299 typedef std::list<RConstructorType> RConstructorTypes;
300 
301 // Functions -------------------------------------------------------------------
302 
303 //______________________________________________________________________________
304 int extractAttrString(clang::Attr* attribute, std::string& attrString);
305 
306 //______________________________________________________________________________
307 int extractPropertyNameValFromString(const std::string attributeStr,std::string& attrName, std::string& attrValue);
308 
309 //______________________________________________________________________________
310 int extractPropertyNameVal(clang::Attr* attribute, std::string& attrName, std::string& attrValue);
311 
312 //______________________________________________________________________________
313 bool ExtractAttrPropertyFromName(const clang::Decl& decl,
314  const std::string& propName,
315  std::string& propValue);
316 
317 //______________________________________________________________________________
318 bool ExtractAttrIntPropertyFromName(const clang::Decl& decl,
319  const std::string& propName,
320  int& propValue);
321 
322 //______________________________________________________________________________
323 bool RequireCompleteType(const cling::Interpreter &interp, const clang::CXXRecordDecl *cl);
324 
325 //______________________________________________________________________________
326 bool RequireCompleteType(const cling::Interpreter &interp, clang::SourceLocation Loc, clang::QualType Type);
327 
328 //______________________________________________________________________________
329 // Add default template parameters.
330 clang::QualType AddDefaultParameters(clang::QualType instanceType,
331  const cling::Interpreter &interpret,
332  const TNormalizedCtxt &normCtxt);
333 
334 //______________________________________________________________________________
335 llvm::StringRef DataMemberInfo__ValidArrayIndex(const clang::DeclaratorDecl &m, int *errnum = 0, llvm::StringRef *errstr = 0);
336 
337 //______________________________________________________________________________
338 // Return the ROOT include directory
339 std::string GetROOTIncludeDir(bool rootbuild);
340 
341 enum class EIOCtorCategory : short {kAbsent, kDefault, kIOPtrType, kIORefType};
342 
343 //______________________________________________________________________________
344 EIOCtorCategory CheckConstructor(const clang::CXXRecordDecl*, const RConstructorType&, const cling::Interpreter& interp);
345 
346 //______________________________________________________________________________
347 const clang::FunctionDecl* ClassInfo__HasMethod(const clang::DeclContext *cl, char const*, const cling::Interpreter& interp);
348 
349 //______________________________________________________________________________
350 void CreateNameTypeMap(clang::CXXRecordDecl const&, std::map<std::string, ROOT::Internal::TSchemaType, std::less<std::string>, std::allocator<std::pair<std::string const, ROOT::Internal::TSchemaType> > >&);
351 
352 //______________________________________________________________________________
353 int ElementStreamer(std::ostream& finalString,
354  const clang::NamedDecl &forcontext,
355  const clang::QualType &qti,
356  const char *t,
357  int rwmode,
358  const cling::Interpreter &interp,
359  const char *tcl=0);
360 
361 //______________________________________________________________________________
362 bool IsBase(const clang::CXXRecordDecl *cl, const clang::CXXRecordDecl *base, const clang::CXXRecordDecl *context,const cling::Interpreter &interp);
363 
364 //______________________________________________________________________________
365 bool IsBase(const clang::FieldDecl &m, const char* basename, const cling::Interpreter &interp);
366 
367 //______________________________________________________________________________
368 bool HasCustomOperatorNewArrayPlacement(clang::RecordDecl const&, const cling::Interpreter &interp);
369 
370 //______________________________________________________________________________
371 bool HasCustomOperatorNewPlacement(char const*, clang::RecordDecl const&, const cling::Interpreter&);
372 
373 //______________________________________________________________________________
374 bool HasCustomOperatorNewPlacement(clang::RecordDecl const&, const cling::Interpreter&);
375 
376 //______________________________________________________________________________
377 bool HasDirectoryAutoAdd(clang::CXXRecordDecl const*, const cling::Interpreter&);
378 
379 //______________________________________________________________________________
380 bool HasIOConstructor(clang::CXXRecordDecl const*, std::string&, const RConstructorTypes&, const cling::Interpreter&);
381 
382 //______________________________________________________________________________
383 bool HasNewMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
384 
385 //______________________________________________________________________________
386 bool HasOldMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
387 
388 //______________________________________________________________________________
389 bool hasOpaqueTypedef(clang::QualType instanceType, const TNormalizedCtxt &normCtxt);
390 
391 //______________________________________________________________________________
392 bool hasOpaqueTypedef(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt);
393 
394 //______________________________________________________________________________
395 bool HasResetAfterMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
396 
397 //______________________________________________________________________________
398 bool NeedDestructor(clang::CXXRecordDecl const*);
399 
400 //______________________________________________________________________________
401 bool NeedTemplateKeyword(clang::CXXRecordDecl const*);
402 
403 //______________________________________________________________________________
404 bool CheckPublicFuncWithProto(clang::CXXRecordDecl const*, char const*, char const*,
405  const cling::Interpreter&, bool diagnose);
406 
407 //______________________________________________________________________________
408 long GetLineNumber(clang::Decl const*);
409 
410 //______________________________________________________________________________
411 bool GetNameWithinNamespace(std::string&, std::string&, std::string&, clang::CXXRecordDecl const*);
412 
413 //______________________________________________________________________________
414 void GetQualifiedName(std::string &qual_name, const clang::QualType &type, const clang::NamedDecl &forcontext);
415 
416 //----
417 std::string GetQualifiedName(const clang::QualType &type, const clang::NamedDecl &forcontext);
418 
419 //______________________________________________________________________________
420 void GetQualifiedName(std::string &qual_name, const clang::Type &type, const clang::NamedDecl &forcontext);
421 
422 //----
423 std::string GetQualifiedName(const clang::Type &type, const clang::NamedDecl &forcontext);
424 
425 //______________________________________________________________________________
426 void GetQualifiedName(std::string &qual_name, const clang::NamedDecl &nd);
427 
428 //----
429 std::string GetQualifiedName(const clang::NamedDecl &nd);
430 
431 //______________________________________________________________________________
432 void GetQualifiedName(std::string &qual_name, const AnnotatedRecordDecl &annotated);
433 
434 //----
435 std::string GetQualifiedName(const AnnotatedRecordDecl &annotated);
436 
437 //______________________________________________________________________________
438 void GetQualifiedName(std::string &qual_name, const clang::RecordDecl &recordDecl);
439 
440 //----
441 std::string GetQualifiedName(const clang::RecordDecl &recordDecl);
442 
443 //______________________________________________________________________________
444 int WriteNamespaceHeader(std::ostream&, const clang::RecordDecl *);
445 
446 //______________________________________________________________________________
447 int WriteNamespaceHeader(std::ostream&, const clang::DeclContext *);
448 
449 //______________________________________________________________________________
450 void WritePointersSTL(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt);
451 
452 //______________________________________________________________________________
453 int GetClassVersion(const clang::RecordDecl *cl, const cling::Interpreter &interp);
454 
455 //______________________________________________________________________________
456 int IsSTLContainer(const AnnotatedRecordDecl &annotated);
457 
458 //______________________________________________________________________________
459 ROOT::ESTLType IsSTLContainer(const clang::FieldDecl &m);
460 
461 //______________________________________________________________________________
462 int IsSTLContainer(const clang::CXXBaseSpecifier &base);
463 
464 //______________________________________________________________________________
465 const char *ShortTypeName(const char *typeDesc);
466 
467 //______________________________________________________________________________
468 std::string ShortTypeName(const clang::FieldDecl &m);
469 
470 //______________________________________________________________________________
471 bool IsStreamableObject(const clang::FieldDecl &m, const cling::Interpreter& interp);
472 
473 //______________________________________________________________________________
474 clang::RecordDecl *GetUnderlyingRecordDecl(clang::QualType type);
475 
476 //______________________________________________________________________________
477 std::string TrueName(const clang::FieldDecl &m);
478 
479 //______________________________________________________________________________
480 const clang::CXXRecordDecl *ScopeSearch(const char *name,
481  const cling::Interpreter &gInterp,
482  bool diagnose,
483  const clang::Type** resultType);
484 
485 //______________________________________________________________________________
486 void WriteAuxFunctions(std::ostream& finalString,
487  const AnnotatedRecordDecl &cl,
488  const clang::CXXRecordDecl *decl,
489  const cling::Interpreter &interp,
490  const RConstructorTypes& ctorTypes,
491  const TNormalizedCtxt &normCtxt);
492 
493 
494 //______________________________________________________________________________
495 const clang::FunctionDecl *GetFuncWithProto(const clang::Decl* cinfo,
496  const char *method,
497  const char *proto,
498  const cling::Interpreter &gInterp,
499  bool diagnose);
500 
501 //______________________________________________________________________________
502 void WriteClassCode(CallWriteStreamer_t WriteStreamerFunc,
503  const AnnotatedRecordDecl &cl,
504  const cling::Interpreter &interp,
505  const TNormalizedCtxt &normCtxt,
506  std::ostream& finalString,
507  const RConstructorTypes& ctorTypes,
508  bool isGenreflex);
509 
510 //______________________________________________________________________________
511 void WriteClassInit(std::ostream& finalString,
512  const AnnotatedRecordDecl &cl,
513  const clang::CXXRecordDecl *decl,
514  const cling::Interpreter &interp,
515  const TNormalizedCtxt &normCtxt,
516  const RConstructorTypes& ctorTypes,
517  bool& needCollectionProxy);
518 
519 //______________________________________________________________________________
521  const clang::CXXRecordDecl* clxx,
522  const cling::Interpreter &interp,
523  const TNormalizedCtxt &normCtxt);
524 
525 //______________________________________________________________________________
527  const clang::CXXRecordDecl* clxx,
528  const cling::Interpreter &interp,
529  const TNormalizedCtxt &normCtxt);
530 
531 //______________________________________________________________________________
532 // Return the header file to be included to declare the Decl
533 llvm::StringRef GetFileName(const clang::Decl& decl,
534  const cling::Interpreter& interp);
535 
536 //______________________________________________________________________________
537 // Return the dictionary file name for a module
538 std::string GetModuleFileName(const char* moduleName);
539 
540 //______________________________________________________________________________
541 // Declare a virtual module.map to clang. Returns Module on success.
542 clang::Module* declareModuleMap(clang::CompilerInstance* CI,
543  const char* moduleFileName,
544  const char* headers[]);
545 
546 //______________________________________________________________________________
547 // Return the -I needed to find RuntimeUniverse.h
548 std::string GetInterpreterExtraIncludePath(bool rootbuild);
549 
550 //______________________________________________________________________________
551 // Return the LLVM / clang resource directory
552 std::string GetLLVMResourceDir(bool rootbuild);
553 
554 //______________________________________________________________________________
555 // Return the ROOT include directory
556 std::string GetROOTIncludeDir(bool rootbuild);
557 
558 //______________________________________________________________________________
559 // Return (in the argument 'output') a mangled version of the C++ symbol/type (pass as 'input')
560 // that can be used in C++ as a variable name.
561 void GetCppName(std::string &output, const char *input);
562 
563 //______________________________________________________________________________
564 // Return the type with all parts fully qualified (most typedefs),
565 // including template arguments, appended to name.
566 void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const cling::Interpreter &interpreter);
567 
568 //______________________________________________________________________________
569 // Return the type with all parts fully qualified (most typedefs),
570 // including template arguments, appended to name, without using the interpreter
571 void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const clang::ASTContext &);
572 
573 //______________________________________________________________________________
574 // Return the type normalized for ROOT,
575 // keeping only the ROOT opaque typedef (Double32_t, etc.) and
576 // adding default template argument for all types except those explicitly
577 // requested to be drop by the user.
578 // Default template for STL collections are not yet removed by this routine.
579 clang::QualType GetNormalizedType(const clang::QualType &type, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt);
580 
581 //______________________________________________________________________________
582 // Return the type name normalized for ROOT,
583 // keeping only the ROOT opaque typedef (Double32_t, etc.) and
584 // adding default template argument for all types except the STL collections
585 // where we remove the default template argument if any.
586 void GetNormalizedName(std::string &norm_name, const clang::QualType &type, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt);
587 
588 //______________________________________________________________________________
589 // Alternative signature
590 void GetNormalizedName(std::string &norm_name,
591  const clang::TypeDecl* typeDecl,
592  const cling::Interpreter &interpreter);
593 
594 //______________________________________________________________________________
595 // Analog to GetNameForIO but with types.
596 // It uses the LookupHelper of Cling to transform the name in type.
597 clang::QualType GetTypeForIO(const clang::QualType& templateInstanceType,
598  const cling::Interpreter &interpreter,
599  const TNormalizedCtxt &normCtxt,
601 
602 //______________________________________________________________________________
603 // Get the name and the type for the IO given a certain type. In some sense the
604 // combination of GetNameForIO and GetTypeForIO.
605 std::pair<std::string,clang::QualType> GetNameTypeForIO(const clang::QualType& templateInstanceType,
606  const cling::Interpreter &interpreter,
607  const TNormalizedCtxt &normCtxt,
609 
610 //______________________________________________________________________________
611 // Returns comment in a meaningful way
612 llvm::StringRef GetComment(const clang::Decl &decl, clang::SourceLocation *loc = 0);
613 
614 //______________________________________________________________________________
615 // Returns the comment of the ClassDef macro
616 llvm::StringRef GetClassComment(const clang::CXXRecordDecl &decl, clang::SourceLocation *loc, const cling::Interpreter &interpreter);
617 
618 //______________________________________________________________________________
619 // Return the base/underlying type of a chain of array or pointers type.
620 const clang::Type *GetUnderlyingType(clang::QualType type);
621 
622 //______________________________________________________________________________
623 // Scans the redeclaration chain for an annotation.
624 //
625 // returns 0 if no annotation was found.
626 //
627 template<typename T>
628 const T* GetAnnotatedRedeclarable(const T* Redecl) {
629  if (!Redecl)
630  return 0;
631 
632  Redecl = Redecl->getMostRecentDecl();
633  while (Redecl && !Redecl->hasAttrs())
634  Redecl = Redecl->getPreviousDecl();
635 
636  return Redecl;
637 }
638 
639 //______________________________________________________________________________
640 // Overload the template for typedefs, because they don't contain
641 // isThisDeclarationADefinition method. (Use inline to avoid violating ODR)
642 const clang::TypedefNameDecl* GetAnnotatedRedeclarable(const clang::TypedefNameDecl* TND);
643 
644 //______________________________________________________________________________
645 // Overload the template for tags, because we only check definitions.
646 const clang::TagDecl* GetAnnotatedRedeclarable(const clang::TagDecl* TND);
647 
648 //______________________________________________________________________________
649 // Return true if the decl is part of the std namespace.
650 bool IsStdClass(const clang::RecordDecl &cl);
651 
652 //______________________________________________________________________________
653 // Return true, if the decl is part of the std namespace and we want
654 // its default parameter dropped.
655 bool IsStdDropDefaultClass(const clang::RecordDecl &cl);
656 
657 //______________________________________________________________________________
658 // See if the CXXRecordDecl matches the current of any of the previous CXXRecordDecls
659 bool MatchWithDeclOrAnyOfPrevious(const clang::CXXRecordDecl &cl, const clang::CXXRecordDecl &currentCl);
660 
661 //______________________________________________________________________________
662 // Return true if the decl is of type
663 bool IsOfType(const clang::CXXRecordDecl &cl, const std::string& type, const cling::LookupHelper& lh);
664 
665 //______________________________________________________________________________
666 // Return which kind of STL container the decl is, if any.
667 ROOT::ESTLType IsSTLCont(const clang::RecordDecl &cl);
668 
669 //______________________________________________________________________________
670 // Check if 'input' or any of its template parameter was substituted when
671 // instantiating the class template instance and replace it with the
672 // partially sugared type we have from 'instance'.
673 clang::QualType ReSubstTemplateArg(clang::QualType input, const clang::Type *instance);
674 
675 //______________________________________________________________________________
676 // Remove the last n template arguments from the name
677 int RemoveTemplateArgsFromName(std::string& name, unsigned int);
678 
679 //______________________________________________________________________________
680 clang::TemplateName ExtractTemplateNameFromQualType(const clang::QualType& qt);
681 
682 //______________________________________________________________________________
683 bool QualType2Template(const clang::QualType& qt,
684  clang::ClassTemplateDecl*& ctd,
685  clang::ClassTemplateSpecializationDecl*& ctsd);
686 
687 //______________________________________________________________________________
688 clang::ClassTemplateDecl* QualType2ClassTemplateDecl(const clang::QualType& qt);
689 
690 //______________________________________________________________________________
691 // Extract the namespaces enclosing a DeclContext
692 void ExtractCtxtEnclosingNameSpaces(const clang::DeclContext&,
693  std::list<std::pair<std::string,bool> >&);
694 //______________________________________________________________________________
695 void ExtractEnclosingNameSpaces(const clang::Decl&,
696  std::list<std::pair<std::string,bool> >&);
697 
698 //______________________________________________________________________________
699 const clang::RecordDecl* ExtractEnclosingScopes(const clang::Decl& decl,
700  std::list<std::pair<std::string,unsigned int> >& enclosingSc);
701 //______________________________________________________________________________
702 // Kind of stl container
703 ROOT::ESTLType STLKind(const llvm::StringRef type);
704 
705 //______________________________________________________________________________
706 // Set the toolchain and the include paths for relocatability
707 void SetPathsForRelocatability(std::vector<std::string>& clingArgs);
708 
709 //______________________________________________________________________________
710 void ReplaceAll(std::string& str, const std::string& from, const std::string& to, bool recurse=false);
711 
712 // Functions for the printouts -------------------------------------------------
713 
714 //______________________________________________________________________________
715 inline unsigned int &GetNumberOfWarningsAndErrors(){
716  static unsigned int gNumberOfWarningsAndErrors = 0;
717  return gNumberOfWarningsAndErrors;
718 }
719 
720 //______________________________________________________________________________
721 inline int &GetErrorIgnoreLevel() {
723  return gErrorIgnoreLevel;
724 }
725 
726 //______________________________________________________________________________
727 inline void LevelPrint(bool prefix, int level, const char *location, const char *fmt, va_list ap)
728 {
729  if (level < GetErrorIgnoreLevel())
730  return;
731 
732  const char *type = 0;
733 
734  if (level >= ROOT::TMetaUtils::kInfo)
735  type = "Info";
736  if (level >= ROOT::TMetaUtils::kNote)
737  type = "Note";
739  type = "Warning";
740  if (level >= ROOT::TMetaUtils::kError)
741  type = "Error";
742  if (level >= ROOT::TMetaUtils::kSysError)
743  type = "SysError";
744  if (level >= ROOT::TMetaUtils::kFatal)
745  type = "Fatal";
746 
747  if (!location || !location[0]) {
748  if (prefix) fprintf(stderr, "%s: ", type);
749  vfprintf(stderr, (const char*)va_(fmt), ap);
750  } else {
751  if (prefix) fprintf(stderr, "%s in <%s>: ", type, location);
752  else fprintf(stderr, "In <%s>: ", location);
753  vfprintf(stderr, (const char*)va_(fmt), ap);
754  }
755 
756  fflush(stderr);
757 
761  }
762 
763 }
764 
765 //______________________________________________________________________________
766 // Use this function in case an error occured.
767 inline void Error(const char *location, const char *va_(fmt), ...)
768 {
769  va_list ap;
770  va_start(ap,va_(fmt));
771  LevelPrint(true, ROOT::TMetaUtils::kError, location, va_(fmt), ap);
772  va_end(ap);
773 }
774 
775 //______________________________________________________________________________
776 // Use this function in case a system (OS or GUI) related error occured.
777 inline void SysError(const char *location, const char *va_(fmt), ...)
778 {
779  va_list ap;
780  va_start(ap, va_(fmt));
781  LevelPrint(true, ROOT::TMetaUtils::kSysError, location, va_(fmt), ap);
782  va_end(ap);
783 }
784 
785 //______________________________________________________________________________
786 // Use this function for informational messages.
787 inline void Info(const char *location, const char *va_(fmt), ...)
788 {
789  va_list ap;
790  va_start(ap,va_(fmt));
791  LevelPrint(true, ROOT::TMetaUtils::kInfo, location, va_(fmt), ap);
792  va_end(ap);
793 }
794 
795 //______________________________________________________________________________
796 // Use this function in warning situations.
797 inline void Warning(const char *location, const char *va_(fmt), ...)
798 {
799  va_list ap;
800  va_start(ap,va_(fmt));
801  LevelPrint(true, ROOT::TMetaUtils::kWarning, location, va_(fmt), ap);
802  va_end(ap);
803 }
804 
805 //______________________________________________________________________________
806 // Use this function in case of a fatal error. It will abort the program.
807 inline void Fatal(const char *location, const char *va_(fmt), ...)
808 {
809  va_list ap;
810  va_start(ap,va_(fmt));
811  LevelPrint(true, ROOT::TMetaUtils::kFatal, location, va_(fmt), ap);
812  va_end(ap);
813 }
814 
815 //______________________________________________________________________________
816 const std::string& GetPathSeparator();
817 
818 //______________________________________________________________________________
819 bool EndsWith(const std::string &theString, const std::string &theSubstring);
820 
821 //______________________________________________________________________________
822 bool BeginsWith(const std::string &theString, const std::string &theSubstring);
823 
824 //______________________________________________________________________________
825 namespace AST2SourceTools {
826 
827 //______________________________________________________________________________
828 const std::string Decls2FwdDecls(const std::vector<const clang::Decl*> &decls,
829  bool (*ignoreFiles)(const clang::PresumedLoc&) ,
830  const cling::Interpreter& interp);
831 
832 //______________________________________________________________________________
833 int PrepareArgsForFwdDecl(std::string& templateArgs,
834  const clang::TemplateParameterList& tmplParamList,
835  const cling::Interpreter& interpreter);
836 
837 //______________________________________________________________________________
838 int EncloseInNamespaces(const clang::Decl& decl, std::string& defString);
839 
840 //______________________________________________________________________________
841 const clang::RecordDecl* EncloseInScopes(const clang::Decl& decl, std::string& defString);
842 
843 //______________________________________________________________________________
844 int FwdDeclFromRcdDecl(const clang::RecordDecl& recordDecl,
845  const cling::Interpreter& interpreter,
846  std::string& defString,
847  bool acceptStl=false);
848 
849 //______________________________________________________________________________
850 int FwdDeclFromTmplDecl(const clang::TemplateDecl& tmplDecl,
851  const cling::Interpreter& interpreter,
852  std::string& defString);
853 //______________________________________________________________________________
854 int GetDefArg(const clang::ParmVarDecl& par, std::string& valAsString, const clang::PrintingPolicy& pp);
855 
856 //______________________________________________________________________________
857 int FwdDeclFromFcnDecl(const clang::FunctionDecl& fcnDecl,
858  const cling::Interpreter& interpreter,
859  std::string& defString);
860 //______________________________________________________________________________
861 int FwdDeclFromTypeDefNameDecl(const clang::TypedefNameDecl& tdnDecl,
862  const cling::Interpreter& interpreter,
863  std::string& fwdDeclString,
864  std::unordered_set<std::string>* fwdDeclSet=nullptr);
865 
866 } // namespace AST2SourceTools
867 
868 } // namespace TMetaUtils
869 
870 } // namespace ROOT
871 
872 #endif // ROOT_TMetaUtils
bool NeedTemplateKeyword(clang::CXXRecordDecl const *)
std::string GetName(const std::string &scope_name)
Definition: Cppyy.cxx:140
void CreateNameTypeMap(clang::CXXRecordDecl const &, std::map< std::string, ROOT::Internal::TSchemaType, std::less< std::string >, std::allocator< std::pair< std::string const, ROOT::Internal::TSchemaType > > > &)
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.
double par[1]
Definition: unuranDistr.cxx:38
int extractPropertyNameValFromString(const std::string attributeStr, std::string &attrName, std::string &attrValue)
static const std::string nArgsToKeep("nArgsToKeep")
clang::QualType GetTypeForIO(const clang::QualType &templateInstanceType, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt, TClassEdit::EModType mode=TClassEdit::kNone)
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...
ESTLType
Definition: ESTLType.h:28
bool IsStreamableObject(const clang::FieldDecl &m, const cling::Interpreter &interp)
bool IsBase(const clang::FieldDecl &m, const char *basename, const cling::Interpreter &interp)
Definition: TMetaUtils.cxx:766
int GetDefArg(const clang::ParmVarDecl &par, std::string &valAsString, const clang::PrintingPolicy &pp)
Get the default value as string.
Definition: TString.h:780
const int kNote
Definition: TMetaUtils.h:111
bool hasOpaqueTypedef(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt)
Return true if any of the argument is or contains a double32.
R__EXTERN Int_t gErrorIgnoreLevel
Definition: TError.h:107
llvm::StringRef GetFileName(const clang::Decl &decl, const cling::Interpreter &interp)
Return the header file to be included to declare the Decl.
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
cling::Interpreter * gInterp
cling::Interpreter * fInterpreter
Definition: TMetaUtils.h:151
long GetLineNumber(clang::Decl const *)
It looks like the template specialization decl actually contains less information on the location of ...
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.
static const std::string comment("comment")
void Error(const char *location, const char *va_(fmt),...)
Definition: TMetaUtils.h:767
double T(double x)
Definition: ChebyshevPol.h:34
const clang::TagDecl * GetAnnotatedRedeclarable(const clang::TagDecl *TND)
std::map< const clang::ClassTemplateDecl *, int > TemplPtrIntMap_t
Definition: TMetaUtils.h:129
clang::RecordDecl * GetUnderlyingRecordDecl(clang::QualType type)
std::string GetLLVMResourceDir(bool rootbuild)
Return the LLVM / clang resource directory.
clang::QualType ReSubstTemplateArg(clang::QualType input, const clang::Type *instance)
Check if &#39;input&#39; or any of its template parameter was substituted when instantiating the class templa...
llvm::StringRef DataMemberInfo__ValidArrayIndex(const clang::DeclaratorDecl &m, int *errnum=0, llvm::StringRef *errstr=0)
ValidArrayIndex return a static string (so use it or copy it immediatly, do not call GrabIndex twice ...
const char * GetRequestedName() const
Definition: TMetaUtils.h:247
static const std::string iotype("iotype")
Type GetType(const std::string &Name)
Definition: Systematics.cxx:34
void GetCppName(std::string &output, const char *input)
Return (in the argument &#39;output&#39;) a mangled version of the C++ symbol/type (pass as &#39;input&#39;) that can...
std::pair< std::string, clang::QualType > GetNameTypeForIO(const clang::QualType &templateInstanceType, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt, TClassEdit::EModType mode=TClassEdit::kNone)
bool ExtractAttrPropertyFromName(const clang::Decl &decl, const std::string &propName, std::string &propValue)
This routine counts on the "propName<separator>propValue" format.
int RemoveTemplateArgsFromName(std::string &name, unsigned int)
Remove the last n template arguments from the name.
DataMemberInfo__ValidArrayIndex_error_code
Definition: TMetaUtils.h:102
int extractAttrString(clang::Attr *attribute, std::string &attrString)
Extract attr string.
ExistingTypeCheck_t fExistingTypeCheck
Definition: TMetaUtils.h:153
bool HasDirectoryAutoAdd(clang::CXXRecordDecl const *, const cling::Interpreter &)
Return true if the class has a method DirectoryAutoAdd(TDirectory *)
const clang::Type * GetUnderlyingType(clang::QualType type)
Return the base/underlying type of a chain of array or pointers type.
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.
const Int_t kSysError
Definition: TError.h:43
static const std::string separator("@@@")
bool MatchWithDeclOrAnyOfPrevious(const clang::CXXRecordDecl &cl, const clang::CXXRecordDecl &currentCl)
This is a recursive function.
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.
const int kThrowOnWarning
Definition: TMetaUtils.h:112
const Int_t kFatal
Definition: TError.h:44
bool BeginsWith(const std::string &theString, const std::string &theSubstring)
bool IsStdDropDefaultClass(const clang::RecordDecl &cl)
Return true, if the decl is part of the std namespace and we want its default parameter dropped...
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...
static const std::string pattern("pattern")
#define va_(arg)
Definition: Varargs.h:41
std::string GetQualifiedName(const clang::RecordDecl &recordDecl)
int IsSTLContainer(const clang::CXXBaseSpecifier &base)
Is this an STL container?
bool HasNewMerge(clang::CXXRecordDecl const *, const cling::Interpreter &)
Return true if the class has a method Merge(TCollection*,TFileMergeInfo*)
bool IsStdClass(const clang::RecordDecl &cl)
Return true, if the decl is part of the std namespace.
const char * GetNormalizedName() const
Definition: TMetaUtils.h:248
std::string GetModuleFileName(const char *moduleName)
Return the dictionary file name for a module.
std::string GetInterpreterExtraIncludePath(bool rootbuild)
Return the -I needed to find RuntimeUniverse.h.
int EncloseInNamespaces(const clang::Decl &decl, std::string &defString)
Take the namespaces which enclose the decl and put them around the definition string.
bool RequireCompleteType(const cling::Interpreter &interp, clang::SourceLocation Loc, clang::QualType Type)
Definition: TMetaUtils.cxx:731
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 ~300 lines!
const int kError
Definition: TMetaUtils.h:114
void WritePointersSTL(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt)
Write interface function for STL members.
void Info(const char *location, const char *va_(fmt),...)
Definition: TMetaUtils.h:787
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().getTypeDeclType(decl), interp, normCtxt);
bool operator<(const AnnotatedRecordDecl &right) const
Definition: TMetaUtils.h:274
int extractPropertyNameVal(clang::Attr *attribute, std::string &attrName, std::string &attrValue)
const clang::FunctionDecl * GetFuncWithProto(const clang::Decl *cinfo, const char *method, const char *proto, const cling::Interpreter &gInterp, bool diagnose)
bool HasOldMerge(clang::CXXRecordDecl const *, const cling::Interpreter &)
Return true if the class has a method Merge(TCollection*)
void(* CallWriteStreamer_t)(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt, std::ostream &dictStream, bool isAutoStreamer)
Definition: TMetaUtils.h:104
int FwdDeclFromTmplDecl(const clang::TemplateDecl &tmplDecl, const cling::Interpreter &interpreter, std::string &defString)
Convert a tmplt decl to its fwd decl.
bool ExtractAttrIntPropertyFromName(const clang::Decl &decl, const std::string &propName, int &propValue)
This routine counts on the "propName<separator>propValue" format.
std::list< RConstructorType > RConstructorTypes
Definition: TMetaUtils.h:299
const std::string & GetPathSeparator()
Return the separator suitable for this platform.
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...
const std::string Decls2FwdDecls(const std::vector< const clang::Decl *> &decls, bool(*ignoreFiles)(const clang::PresumedLoc &), const cling::Interpreter &interp)
const Int_t kInfo
Definition: TError.h:39
std::string TrueName(const clang::FieldDecl &m)
TrueName strips the typedefs and array dimensions.
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. ...
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.
ROOT::ESTLType STLKind(const llvm::StringRef type)
Converts STL container name to number. vector -> 1, etc..
const clang::CXXRecordDecl * ScopeSearch(const char *name, const cling::Interpreter &gInterp, bool diagnose, const clang::Type **resultType)
Return the scope corresponding to &#39;name&#39; or std::&#39;name&#39;.
Definition: TMetaUtils.cxx:700
TMarker * m
Definition: textangle.C:8
const int kMaxLen
Definition: TMetaUtils.h:117
ROOT::ESTLType IsSTLCont(const clang::RecordDecl &cl)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container abs(result):...
const clang::FunctionDecl * ClassInfo__HasMethod(const clang::DeclContext *cl, char const *, const cling::Interpreter &interp)
Definition: TMetaUtils.cxx:686
std::set< const clang::Type * > TypesCont_t
Definition: TMetaUtils.h:128
const Int_t kWarning
Definition: TError.h:40
const int kInfo
Definition: TMetaUtils.h:110
void SetPathsForRelocatability(std::vector< std::string > &clingArgs)
Organise the parameters for cling in order to guarantee relocatability It treats the gcc toolchain an...
Type
enumeration specifying the integration types.
bool NeedDestructor(clang::CXXRecordDecl const *)
const clang::RecordDecl * fDecl
Definition: TMetaUtils.h:176
const clang::RecordDecl * GetRecordDecl() const
Definition: TMetaUtils.h:268
const int kSysError
Definition: TMetaUtils.h:115
void ExtractCtxtEnclosingNameSpaces(const clang::DeclContext &, std::list< std::pair< std::string, bool > > &)
Extract enclosing namespaces recusrively.
bool HasCustomOperatorNewPlacement(clang::RecordDecl const &, const cling::Interpreter &)
return true if we can find a custom operator new with placement
Definition: TCling.h:48
static const std::string persistent("persistent")
EIOCtorCategory CheckConstructor(const clang::CXXRecordDecl *, const RConstructorType &, const cling::Interpreter &interp)
Definition: TMetaUtils.cxx:963
int type
Definition: TGX11.cxx:120
Print a TSeq at the prompt:
Definition: TDatime.h:114
std::string ShortTypeName(const clang::FieldDecl &m)
Return the absolute type of typeDesc.
llvm::StringRef GetClassComment(const clang::CXXRecordDecl &decl, clang::SourceLocation *loc, const cling::Interpreter &interpreter)
Return the class comment after the ClassDef: class MyClass { ...
int FwdDeclFromFcnDecl(const clang::FunctionDecl &fcnDecl, const cling::Interpreter &interpreter, std::string &defString)
void Warning(const char *location, const char *va_(fmt),...)
Definition: TMetaUtils.h:797
bool GetNameWithinNamespace(std::string &, std::string &, std::string &, clang::CXXRecordDecl const *)
Return true if one of the class&#39; enclosing scope is a namespace and set fullname to the fully qualifi...
int & GetErrorIgnoreLevel()
Definition: TMetaUtils.h:721
void SysError(const char *location, const char *va_(fmt),...)
Definition: TMetaUtils.h:777
bool EndsWith(const std::string &theString, const std::string &theSubstring)
void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const clang::ASTContext &)
cling::utils::Transform::Config Config_t
Definition: TMetaUtils.h:127
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)
Definition: TMetaUtils.cxx:785
void LevelPrint(bool prefix, int level, const char *location, const char *fmt, va_list ap)
Definition: TMetaUtils.h:727
typedef void((*Func_t)())
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...
clang::Module * declareModuleMap(clang::CompilerInstance *CI, const char *moduleFileName, const char *headers[])
Declare a virtual module.map to clang. Returns Module on success.
const int kFatal
Definition: TMetaUtils.h:116
void ReplaceAll(std::string &str, const std::string &from, const std::string &to, bool recurse=false)
std::string GetROOTIncludeDir(bool rootbuild)
void GetNormalizedName(std::string &norm_name, const clang::TypeDecl *typeDecl, const cling::Interpreter &interpreter)
unsigned int & GetNumberOfWarningsAndErrors()
Definition: TMetaUtils.h:715
const int kWarning
Definition: TMetaUtils.h:113
const Int_t kError
Definition: TError.h:41
clang::TemplateName ExtractTemplateNameFromQualType(const clang::QualType &qt)
These manipulations are necessary because a template specialisation type does not inherit from a reco...
const char * proto
Definition: civetweb.c:11652
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...
int WriteNamespaceHeader(std::ostream &, const clang::DeclContext *)
Write all the necessary opening part of the namespace and return the number of closing brackets neede...
static const std::string ioname("ioname")
bool HasCustomOperatorNewArrayPlacement(clang::RecordDecl const &, const cling::Interpreter &interp)
return true if we can find a custom operator new with placement
double result[121]
bool IsOfType(const clang::CXXRecordDecl &cl, const std::string &type, const cling::LookupHelper &lh)
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...
const clang::CXXRecordDecl * fArgType
Definition: TMetaUtils.h:291
bool HasResetAfterMerge(clang::CXXRecordDecl const *, const cling::Interpreter &)
Return true if the class has a method ResetAfterMerge(TFileMergeInfo *)
clang::ClassTemplateDecl * QualType2ClassTemplateDecl(const clang::QualType &qt)
Extract from a qualtype the class template if this makes sense.
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...
char name[80]
Definition: TGX11.cxx:109
void ExtractEnclosingNameSpaces(const clang::Decl &, std::list< std::pair< std::string, bool > > &)
Extract the immediately outer namespace and then launch the recursion.
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, etc.) and adding default template argument for all types except those explicitly requested to be drop by the user.
void Fatal(const char *location, const char *va_(fmt),...)
Definition: TMetaUtils.h:807
TNormalizedCtxtImpl * fImpl
Definition: TMetaUtils.h:125
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...