Logo ROOT   6.08/02
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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);
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;
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;
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,
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  }
255  bool RequestNoStreamer() const { return fRequestNoStreamer; }
256  bool RequestOnlyTClass() const { return fRequestOnlyTClass; }
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;
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 
338 
339 //______________________________________________________________________________
340 EIOCtorCategory CheckConstructor(const clang::CXXRecordDecl*, const RConstructorType&, const cling::Interpreter& interp);
341 
342 //______________________________________________________________________________
343 const clang::FunctionDecl* ClassInfo__HasMethod(const clang::DeclContext *cl, char const*, const cling::Interpreter& interp);
344 
345 //______________________________________________________________________________
346 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> > >&);
347 
348 //______________________________________________________________________________
349 int ElementStreamer(std::ostream& finalString,
350  const clang::NamedDecl &forcontext,
351  const clang::QualType &qti,
352  const char *t,
353  int rwmode,
354  const cling::Interpreter &interp,
355  const char *tcl=0);
356 
357 //______________________________________________________________________________
358 bool IsBase(const clang::CXXRecordDecl *cl, const clang::CXXRecordDecl *base, const clang::CXXRecordDecl *context,const cling::Interpreter &interp);
359 
360 //______________________________________________________________________________
361 bool IsBase(const clang::FieldDecl &m, const char* basename, const cling::Interpreter &interp);
362 
363 //______________________________________________________________________________
364 bool HasCustomOperatorNewArrayPlacement(clang::RecordDecl const&, const cling::Interpreter &interp);
365 
366 //______________________________________________________________________________
367 bool HasCustomOperatorNewPlacement(char const*, clang::RecordDecl const&, const cling::Interpreter&);
368 
369 //______________________________________________________________________________
370 bool HasCustomOperatorNewPlacement(clang::RecordDecl const&, const cling::Interpreter&);
371 
372 //______________________________________________________________________________
373 bool HasDirectoryAutoAdd(clang::CXXRecordDecl const*, const cling::Interpreter&);
374 
375 //______________________________________________________________________________
376 bool HasIOConstructor(clang::CXXRecordDecl const*, std::string&, const RConstructorTypes&, const cling::Interpreter&);
377 
378 //______________________________________________________________________________
379 bool HasNewMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
380 
381 //______________________________________________________________________________
382 bool HasOldMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
383 
384 //______________________________________________________________________________
385 bool hasOpaqueTypedef(clang::QualType instanceType, const TNormalizedCtxt &normCtxt);
386 
387 //______________________________________________________________________________
388 bool hasOpaqueTypedef(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt);
389 
390 //______________________________________________________________________________
391 bool HasResetAfterMerge(clang::CXXRecordDecl const*, const cling::Interpreter&);
392 
393 //______________________________________________________________________________
394 bool NeedDestructor(clang::CXXRecordDecl const*);
395 
396 //______________________________________________________________________________
397 bool NeedTemplateKeyword(clang::CXXRecordDecl const*);
398 
399 //______________________________________________________________________________
400 bool CheckPublicFuncWithProto(clang::CXXRecordDecl const*, char const*, char const*,
401  const cling::Interpreter&, bool diagnose);
402 
403 //______________________________________________________________________________
404 long GetLineNumber(clang::Decl const*);
405 
406 //______________________________________________________________________________
407 bool GetNameWithinNamespace(std::string&, std::string&, std::string&, clang::CXXRecordDecl const*);
408 
409 //______________________________________________________________________________
410 void GetQualifiedName(std::string &qual_name, const clang::QualType &type, const clang::NamedDecl &forcontext);
411 
412 //----
413 std::string GetQualifiedName(const clang::QualType &type, const clang::NamedDecl &forcontext);
414 
415 //______________________________________________________________________________
416 void GetQualifiedName(std::string &qual_name, const clang::Type &type, const clang::NamedDecl &forcontext);
417 
418 //----
419 std::string GetQualifiedName(const clang::Type &type, const clang::NamedDecl &forcontext);
420 
421 //______________________________________________________________________________
422 void GetQualifiedName(std::string &qual_name, const clang::NamedDecl &nd);
423 
424 //----
425 std::string GetQualifiedName(const clang::NamedDecl &nd);
426 
427 //______________________________________________________________________________
428 void GetQualifiedName(std::string &qual_name, const AnnotatedRecordDecl &annotated);
429 
430 //----
431 std::string GetQualifiedName(const AnnotatedRecordDecl &annotated);
432 
433 //______________________________________________________________________________
434 void GetQualifiedName(std::string &qual_name, const clang::RecordDecl &recordDecl);
435 
436 //----
437 std::string GetQualifiedName(const clang::RecordDecl &recordDecl);
438 
439 //______________________________________________________________________________
440 int WriteNamespaceHeader(std::ostream&, const clang::RecordDecl *);
441 
442 //______________________________________________________________________________
443 int WriteNamespaceHeader(std::ostream&, const clang::DeclContext *);
444 
445 //______________________________________________________________________________
446 void WritePointersSTL(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt);
447 
448 //______________________________________________________________________________
449 int GetClassVersion(const clang::RecordDecl *cl, const cling::Interpreter &interp);
450 
451 //______________________________________________________________________________
452 int IsSTLContainer(const AnnotatedRecordDecl &annotated);
453 
454 //______________________________________________________________________________
455 ROOT::ESTLType IsSTLContainer(const clang::FieldDecl &m);
456 
457 //______________________________________________________________________________
458 int IsSTLContainer(const clang::CXXBaseSpecifier &base);
459 
460 //______________________________________________________________________________
461 const char *ShortTypeName(const char *typeDesc);
462 
463 //______________________________________________________________________________
464 std::string ShortTypeName(const clang::FieldDecl &m);
465 
466 //______________________________________________________________________________
467 bool IsStreamableObject(const clang::FieldDecl &m, const cling::Interpreter& interp);
468 
469 //______________________________________________________________________________
470 clang::RecordDecl *GetUnderlyingRecordDecl(clang::QualType type);
471 
472 //______________________________________________________________________________
473 std::string TrueName(const clang::FieldDecl &m);
474 
475 //______________________________________________________________________________
476 const clang::CXXRecordDecl *ScopeSearch(const char *name,
477  const cling::Interpreter &gInterp,
478  bool diagnose,
479  const clang::Type** resultType);
480 
481 //______________________________________________________________________________
482 void WriteAuxFunctions(std::ostream& finalString,
483  const AnnotatedRecordDecl &cl,
484  const clang::CXXRecordDecl *decl,
485  const cling::Interpreter &interp,
486  const RConstructorTypes& ctorTypes,
487  const TNormalizedCtxt &normCtxt);
488 
489 
490 //______________________________________________________________________________
491 const clang::FunctionDecl *GetFuncWithProto(const clang::Decl* cinfo,
492  const char *method,
493  const char *proto,
494  const cling::Interpreter &gInterp,
495  bool diagnose);
496 
497 //______________________________________________________________________________
498 void WriteClassCode(CallWriteStreamer_t WriteStreamerFunc,
499  const AnnotatedRecordDecl &cl,
500  const cling::Interpreter &interp,
501  const TNormalizedCtxt &normCtxt,
502  std::ostream& finalString,
503  const RConstructorTypes& ctorTypes,
504  bool isGenreflex);
505 
506 //______________________________________________________________________________
507 void WriteClassInit(std::ostream& finalString,
508  const AnnotatedRecordDecl &cl,
509  const clang::CXXRecordDecl *decl,
510  const cling::Interpreter &interp,
511  const TNormalizedCtxt &normCtxt,
512  const RConstructorTypes& ctorTypes,
513  bool& needCollectionProxy);
514 
515 //______________________________________________________________________________
516 bool HasCustomStreamerMemberFunction(const AnnotatedRecordDecl &cl,
517  const clang::CXXRecordDecl* clxx,
518  const cling::Interpreter &interp,
519  const TNormalizedCtxt &normCtxt);
520 
521 //______________________________________________________________________________
522 bool HasCustomConvStreamerMemberFunction(const AnnotatedRecordDecl &cl,
523  const clang::CXXRecordDecl* clxx,
524  const cling::Interpreter &interp,
525  const TNormalizedCtxt &normCtxt);
526 
527 //______________________________________________________________________________
528 // Return the header file to be included to declare the Decl
529 llvm::StringRef GetFileName(const clang::Decl& decl,
530  const cling::Interpreter& interp);
531 
532 //______________________________________________________________________________
533 // Return the dictionary file name for a module
534 std::string GetModuleFileName(const char* moduleName);
535 
536 //______________________________________________________________________________
537 // Declare a virtual module.map to clang. Returns Module on success.
538 clang::Module* declareModuleMap(clang::CompilerInstance* CI,
539  const char* moduleFileName,
540  const char* headers[]);
541 
542 //______________________________________________________________________________
543 // Return (in the argument 'output') a mangled version of the C++ symbol/type (pass as 'input')
544 // that can be used in C++ as a variable name.
545 void GetCppName(std::string &output, const char *input);
546 
547 //______________________________________________________________________________
548 // Return the type with all parts fully qualified (most typedefs),
549 // including template arguments, appended to name.
550 void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const cling::Interpreter &interpreter);
551 
552 //______________________________________________________________________________
553 // Return the type with all parts fully qualified (most typedefs),
554 // including template arguments, appended to name, without using the interpreter
555 void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const clang::ASTContext &);
556 
557 //______________________________________________________________________________
558 // Return the type normalized for ROOT,
559 // keeping only the ROOT opaque typedef (Double32_t, etc.) and
560 // adding default template argument for all types except those explicitly
561 // requested to be drop by the user.
562 // Default template for STL collections are not yet removed by this routine.
563 clang::QualType GetNormalizedType(const clang::QualType &type, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt);
564 
565 //______________________________________________________________________________
566 // Return the type name normalized for ROOT,
567 // keeping only the ROOT opaque typedef (Double32_t, etc.) and
568 // adding default template argument for all types except the STL collections
569 // where we remove the default template argument if any.
570 void GetNormalizedName(std::string &norm_name, const clang::QualType &type, const cling::Interpreter &interpreter, const TNormalizedCtxt &normCtxt);
571 
572 //______________________________________________________________________________
573 // Alternative signature
574 void GetNormalizedName(std::string &norm_name,
575  const clang::TypeDecl* typeDecl,
576  const cling::Interpreter &interpreter);
577 
578 //______________________________________________________________________________
579 // Analog to GetNameForIO but with types.
580 // It uses the LookupHelper of Cling to transform the name in type.
581 clang::QualType GetTypeForIO(const clang::QualType& templateInstanceType,
582  const cling::Interpreter &interpreter,
583  const TNormalizedCtxt &normCtxt,
585 
586 //______________________________________________________________________________
587 // Get the name and the type for the IO given a certain type. In some sense the
588 // combination of GetNameForIO and GetTypeForIO.
589 std::pair<std::string,clang::QualType> GetNameTypeForIO(const clang::QualType& templateInstanceType,
590  const cling::Interpreter &interpreter,
591  const TNormalizedCtxt &normCtxt,
593 
594 //______________________________________________________________________________
595 // Returns comment in a meaningful way
596 llvm::StringRef GetComment(const clang::Decl &decl, clang::SourceLocation *loc = 0);
597 
598 //______________________________________________________________________________
599 // Returns the comment of the ClassDef macro
600 llvm::StringRef GetClassComment(const clang::CXXRecordDecl &decl, clang::SourceLocation *loc, const cling::Interpreter &interpreter);
601 
602 //______________________________________________________________________________
603 // Return the base/underlying type of a chain of array or pointers type.
604 const clang::Type *GetUnderlyingType(clang::QualType type);
605 
606 //______________________________________________________________________________
607 // Scans the redeclaration chain for an annotation.
608 //
609 // returns 0 if no annotation was found.
610 //
611 template<typename T>
612 const T* GetAnnotatedRedeclarable(const T* Redecl) {
613  if (!Redecl)
614  return 0;
615 
616  Redecl = Redecl->getMostRecentDecl();
617  while (Redecl && !Redecl->hasAttrs())
618  Redecl = Redecl->getPreviousDecl();
619 
620  return Redecl;
621 }
622 
623 //______________________________________________________________________________
624 // Overload the template for typedefs, because they don't contain
625 // isThisDeclarationADefinition method. (Use inline to avoid violating ODR)
626 const clang::TypedefNameDecl* GetAnnotatedRedeclarable(const clang::TypedefNameDecl* TND);
627 
628 //______________________________________________________________________________
629 // Overload the template for tags, because we only check definitions.
630 const clang::TagDecl* GetAnnotatedRedeclarable(const clang::TagDecl* TND);
631 
632 //______________________________________________________________________________
633 // Return true if the decl is part of the std namespace.
634 bool IsStdClass(const clang::RecordDecl &cl);
635 
636 //______________________________________________________________________________
637 // Return true, if the decl is part of the std namespace and we want
638 // its default parameter dropped.
639 bool IsStdDropDefaultClass(const clang::RecordDecl &cl);
640 
641 //______________________________________________________________________________
642 // See if the CXXRecordDecl matches the current of any of the previous CXXRecordDecls
643 bool MatchWithDeclOrAnyOfPrevious(const clang::CXXRecordDecl &cl, const clang::CXXRecordDecl &currentCl);
644 
645 //______________________________________________________________________________
646 // Return true if the decl is of type
647 bool IsOfType(const clang::CXXRecordDecl &cl, const std::string& type, const cling::LookupHelper& lh);
648 
649 //______________________________________________________________________________
650 // Return which kind of STL container the decl is, if any.
651 ROOT::ESTLType IsSTLCont(const clang::RecordDecl &cl);
652 
653 //______________________________________________________________________________
654 // Check if 'input' or any of its template parameter was substituted when
655 // instantiating the class template instance and replace it with the
656 // partially sugared type we have from 'instance'.
657 clang::QualType ReSubstTemplateArg(clang::QualType input, const clang::Type *instance);
658 
659 //______________________________________________________________________________
660 // Remove the last n template arguments from the name
661 int RemoveTemplateArgsFromName(std::string& name, unsigned int);
662 
663 //______________________________________________________________________________
664 clang::TemplateName ExtractTemplateNameFromQualType(const clang::QualType& qt);
665 
666 //______________________________________________________________________________
667 bool QualType2Template(const clang::QualType& qt,
668  clang::ClassTemplateDecl*& ctd,
669  clang::ClassTemplateSpecializationDecl*& ctsd);
670 
671 //______________________________________________________________________________
672 clang::ClassTemplateDecl* QualType2ClassTemplateDecl(const clang::QualType& qt);
673 
674 //______________________________________________________________________________
675 // Extract the namespaces enclosing a DeclContext
676 void ExtractCtxtEnclosingNameSpaces(const clang::DeclContext&,
677  std::list<std::pair<std::string,bool> >&);
678 //______________________________________________________________________________
679 void ExtractEnclosingNameSpaces(const clang::Decl&,
680  std::list<std::pair<std::string,bool> >&);
681 
682 //______________________________________________________________________________
683 const clang::RecordDecl* ExtractEnclosingScopes(const clang::Decl& decl,
684  std::list<std::pair<std::string,unsigned int> >& enclosingSc);
685 //______________________________________________________________________________
686 // Kind of stl container
687 ROOT::ESTLType STLKind(const llvm::StringRef type);
688 
689 //______________________________________________________________________________
690 // Set the toolchain and the include paths for relocatability
691 void SetPathsForRelocatability(std::vector<std::string>& clingArgs);
692 
693 //______________________________________________________________________________
694 void ReplaceAll(std::string& str, const std::string& from, const std::string& to, bool recurse=false);
695 
696 // Functions for the printouts -------------------------------------------------
697 
698 //______________________________________________________________________________
699 inline unsigned int &GetNumberOfWarningsAndErrors(){
700  static unsigned int gNumberOfWarningsAndErrors = 0;
701  return gNumberOfWarningsAndErrors;
702 }
703 
704 //______________________________________________________________________________
705 inline int &GetErrorIgnoreLevel() {
707  return gErrorIgnoreLevel;
708 }
709 
710 //______________________________________________________________________________
711 inline void LevelPrint(bool prefix, int level, const char *location, const char *fmt, va_list ap)
712 {
713  if (level < GetErrorIgnoreLevel())
714  return;
715 
716  const char *type = 0;
717 
718  if (level >= ROOT::TMetaUtils::kInfo)
719  type = "Info";
720  if (level >= ROOT::TMetaUtils::kNote)
721  type = "Note";
723  type = "Warning";
724  if (level >= ROOT::TMetaUtils::kError)
725  type = "Error";
726  if (level >= ROOT::TMetaUtils::kSysError)
727  type = "SysError";
728  if (level >= ROOT::TMetaUtils::kFatal)
729  type = "Fatal";
730 
731  if (!location || !location[0]) {
732  if (prefix) fprintf(stderr, "%s: ", type);
733  vfprintf(stderr, (const char*)va_(fmt), ap);
734  } else {
735  if (prefix) fprintf(stderr, "%s in <%s>: ", type, location);
736  else fprintf(stderr, "In <%s>: ", location);
737  vfprintf(stderr, (const char*)va_(fmt), ap);
738  }
739 
740  fflush(stderr);
741 
745  }
746 
747 }
748 
749 //______________________________________________________________________________
750 // Use this function in case an error occured.
751 inline void Error(const char *location, const char *va_(fmt), ...)
752 {
753  va_list ap;
754  va_start(ap,va_(fmt));
755  LevelPrint(true, ROOT::TMetaUtils::kError, location, va_(fmt), ap);
756  va_end(ap);
757 }
758 
759 //______________________________________________________________________________
760 // Use this function in case a system (OS or GUI) related error occured.
761 inline void SysError(const char *location, const char *va_(fmt), ...)
762 {
763  va_list ap;
764  va_start(ap, va_(fmt));
765  LevelPrint(true, ROOT::TMetaUtils::kSysError, location, va_(fmt), ap);
766  va_end(ap);
767 }
768 
769 //______________________________________________________________________________
770 // Use this function for informational messages.
771 inline void Info(const char *location, const char *va_(fmt), ...)
772 {
773  va_list ap;
774  va_start(ap,va_(fmt));
775  LevelPrint(true, ROOT::TMetaUtils::kInfo, location, va_(fmt), ap);
776  va_end(ap);
777 }
778 
779 //______________________________________________________________________________
780 // Use this function in warning situations.
781 inline void Warning(const char *location, const char *va_(fmt), ...)
782 {
783  va_list ap;
784  va_start(ap,va_(fmt));
785  LevelPrint(true, ROOT::TMetaUtils::kWarning, location, va_(fmt), ap);
786  va_end(ap);
787 }
788 
789 //______________________________________________________________________________
790 // Use this function in case of a fatal error. It will abort the program.
791 inline void Fatal(const char *location, const char *va_(fmt), ...)
792 {
793  va_list ap;
794  va_start(ap,va_(fmt));
795  LevelPrint(true, ROOT::TMetaUtils::kFatal, location, va_(fmt), ap);
796  va_end(ap);
797 }
798 
799 //______________________________________________________________________________
800 const std::string& GetPathSeparator();
801 
802 //______________________________________________________________________________
803 bool EndsWith(const std::string &theString, const std::string &theSubstring);
804 
805 //______________________________________________________________________________
806 bool BeginsWith(const std::string &theString, const std::string &theSubstring);
807 
808 //______________________________________________________________________________
809 namespace AST2SourceTools {
810 
811 //______________________________________________________________________________
812 const std::string Decls2FwdDecls(const std::vector<const clang::Decl*> &decls,
813  bool (*ignoreFiles)(const clang::PresumedLoc&) ,
814  const cling::Interpreter& interp);
815 
816 //______________________________________________________________________________
817 int PrepareArgsForFwdDecl(std::string& templateArgs,
818  const clang::TemplateParameterList& tmplParamList,
819  const cling::Interpreter& interpreter);
820 
821 //______________________________________________________________________________
822 int EncloseInNamespaces(const clang::Decl& decl, std::string& defString);
823 
824 //______________________________________________________________________________
825 const clang::RecordDecl* EncloseInScopes(const clang::Decl& decl, std::string& defString);
826 
827 //______________________________________________________________________________
828 int FwdDeclFromRcdDecl(const clang::RecordDecl& recordDecl,
829  const cling::Interpreter& interpreter,
830  std::string& defString,
831  bool acceptStl=false);
832 
833 //______________________________________________________________________________
834 int FwdDeclFromTmplDecl(const clang::TemplateDecl& tmplDecl,
835  const cling::Interpreter& interpreter,
836  std::string& defString);
837 //______________________________________________________________________________
838 int GetDefArg(const clang::ParmVarDecl& par, std::string& valAsString, const clang::PrintingPolicy& pp);
839 
840 //______________________________________________________________________________
841 int FwdDeclFromFcnDecl(const clang::FunctionDecl& fcnDecl,
842  const cling::Interpreter& interpreter,
843  std::string& defString);
844 //______________________________________________________________________________
845 int FwdDeclFromTypeDefNameDecl(const clang::TypedefNameDecl& tdnDecl,
846  const cling::Interpreter& interpreter,
847  std::string& fwdDeclString,
848  std::unordered_set<std::string>* fwdDeclSet=nullptr);
849 
850 } // namespace AST2SourceTools
851 
852 } // namespace TMetaUtils
853 
854 } // namespace ROOT
855 
856 #endif // ROOT_TMetaUtils
bool NeedTemplateKeyword(clang::CXXRecordDecl const *)
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)
int GetDefArg(const clang::ParmVarDecl &par, std::string &valAsString, const clang::PrintingPolicy &pp)
Get the default value as string.
void AddTemplAndNargsToKeep(const clang::ClassTemplateDecl *templ, unsigned int i)
Definition: TMetaUtils.cxx:333
const int kNote
Definition: TMetaUtils.h:111
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.
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")
const char * ShortTypeName(const char *typeDesc)
Return the absolute type of typeDesc.
void Error(const char *location, const char *va_(fmt),...)
Definition: TMetaUtils.h:751
double T(double x)
Definition: ChebyshevPol.h:34
void(* CallWriteStreamer_t)(const AnnotatedRecordDecl &cl, const cling::Interpreter &interp, const TNormalizedCtxt &normCtxt, std::ostream &dictStream, bool isAutoStreamer)
Definition: TMetaUtils.h:104
std::map< const clang::ClassTemplateDecl *, int > TemplPtrIntMap_t
Definition: TMetaUtils.h:129
clang::RecordDecl * GetUnderlyingRecordDecl(clang::QualType type)
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 ...
static const std::string iotype("iotype")
TNormalizedCtxt(const cling::LookupHelper &lh)
Definition: TMetaUtils.cxx:316
void GetFullyQualifiedTypeName(std::string &name, const clang::QualType &type, const cling::Interpreter &interpreter)
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...
bool operator()(const AnnotatedRecordDecl &right, const AnnotatedRecordDecl &left)
Definition: TMetaUtils.h:280
void GetQualifiedName(std::string &qual_name, const clang::QualType &type, const clang::NamedDecl &forcontext)
Main implementation relying on GetFullyQualifiedTypeName All other GetQualifiedName functions leverag...
int GetNargsToKeep(const clang::ClassTemplateDecl *templ) const
Definition: TMetaUtils.cxx:337
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 &quot;propName&lt;separator&gt;propValue&quot; 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
TClingLookupHelper(cling::Interpreter &interpreter, TNormalizedCtxt &normCtxt, ExistingTypeCheck_t existingTypeCheck, AutoParse_t autoParse, const int *pgDebug=0)
Definition: TMetaUtils.cxx:461
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 TypesCont_t & GetTypeWithAlternative() const
Definition: TMetaUtils.cxx:330
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...
const clang::Type * GetUnderlyingType(clang::QualType type)
Return the base/underlying type of a chain of array or pointers type.
virtual bool ExistingTypeCheck(const std::string &tname, std::string &result)
Helper routine to ry hard to avoid looking up in the Cling database as this could enduce an unwanted ...
Definition: TMetaUtils.cxx:476
const Config_t & GetConfig() const
Definition: TMetaUtils.cxx:327
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.
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 &quot;forward declaration&quot; of a typedef.
const int kThrowOnWarning
Definition: TMetaUtils.h:112
virtual void GetPartiallyDesugaredName(std::string &nameLong)
Definition: TMetaUtils.cxx:487
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...
bool(* ExistingTypeCheck_t)(const std::string &tname, std::string &result)
Definition: TMetaUtils.h:147
const TemplPtrIntMap_t GetTemplNargsToKeepMap() const
Definition: TMetaUtils.cxx:341
static const std::string pattern("pattern")
#define va_(arg)
Definition: Varargs.h:41
bool(* AutoParse_t)(const char *name)
Definition: TMetaUtils.h:148
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.
std::string GetModuleFileName(const char *moduleName)
Return the dictionary file name for a module.
int EncloseInNamespaces(const clang::Decl &decl, std::string &defString)
Take the namespaces which enclose the decl and put them around the definition string.
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:771
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-&gt;getASTContext().getTypeDeclType(decl), interp, normCtxt);
int WriteNamespaceHeader(std::ostream &, const clang::RecordDecl *)
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*)
const clang::RecordDecl * GetRecordDecl() const
Definition: TMetaUtils.h:268
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, etc.) and adding default template argument for all types except the STL collections where we remove the default template argument if any.
int FwdDeclFromTmplDecl(const clang::TemplateDecl &tmplDecl, const cling::Interpreter &interpreter, std::string &defString)
Convert a tmplt decl to its fwd decl.
virtual bool IsAlreadyPartiallyDesugaredName(const std::string &nondef, const std::string &nameLong)
Definition: TMetaUtils.cxx:503
bool ExtractAttrIntPropertyFromName(const clang::Decl &decl, const std::string &propName, int &propValue)
This routine counts on the &quot;propName&lt;separator&gt;propValue&quot; 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...
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 -&gt; 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
const T * GetAnnotatedRedeclarable(const T *Redecl)
Definition: TMetaUtils.h:612
const clang::CXXRecordDecl * GetType() const
bool RequireCompleteType(const cling::Interpreter &interp, const clang::CXXRecordDecl *cl)
Definition: TMetaUtils.cxx:723
TMarker * m
Definition: textangle.C:8
const int kMaxLen
Definition: TMetaUtils.h:117
ROOT::ESTLType IsSTLCont(const clang::RecordDecl &cl)
type : type name: vector&lt;list&lt;classA,allocator&gt;,allocator&gt; 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
static const std::string name("name")
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...
bool operator<(const AnnotatedRecordDecl &right) const
Definition: TMetaUtils.h:274
Type
enumeration specifying the integration types.
bool NeedDestructor(clang::CXXRecordDecl const *)
RConstructorType(const char *type_of_arg, const cling::Interpreter &)
const clang::RecordDecl * fDecl
Definition: TMetaUtils.h:176
const int kSysError
Definition: TMetaUtils.h:115
void ExtractCtxtEnclosingNameSpaces(const clang::DeclContext &, std::list< std::pair< std::string, bool > > &)
Extract enclosing namespaces recusrively.
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
virtual bool GetPartiallyDesugaredNameWithScopeHandling(const std::string &tname, std::string &result)
We assume that we have a simple type: [const] typename[*&amp;][const].
Definition: TMetaUtils.cxx:538
const std::string Decls2FwdDecls(const std::vector< const clang::Decl * > &decls, bool(*ignoreFiles)(const clang::PresumedLoc &), const cling::Interpreter &interp)
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:781
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:705
void SysError(const char *location, const char *va_(fmt),...)
Definition: TMetaUtils.h:761
bool EndsWith(const std::string &theString, const std::string &theSubstring)
const char * GetNormalizedName() const
Definition: TMetaUtils.h:248
const char * GetRequestedName() const
Definition: TMetaUtils.h:247
virtual bool IsDeclaredScope(const std::string &base, bool &isInlined)
Definition: TMetaUtils.cxx:519
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:711
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...
bool IsBase(const clang::CXXRecordDecl *cl, const clang::CXXRecordDecl *base, const clang::CXXRecordDecl *context, const cling::Interpreter &interp)
Definition: TMetaUtils.cxx:742
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)
unsigned int & GetNumberOfWarningsAndErrors()
Definition: TMetaUtils.h:699
int IsSTLContainer(const AnnotatedRecordDecl &annotated)
Is this an STL container.
const int kWarning
Definition: TMetaUtils.h:113
void keepTypedef(const cling::LookupHelper &lh, const char *name, bool replace=false)
Definition: TMetaUtils.cxx:344
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...
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]
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.
Definition: TMetaUtils.cxx:356
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 *)
bool HasCustomOperatorNewPlacement(char const *, clang::RecordDecl const &, const cling::Interpreter &)
return true if we can find a custom operator new with placement
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:791
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...