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