ROOT  6.06/09
Reference Guide
TClingMethodInfo.h
Go to the documentation of this file.
1 // @(#)root/core/meta:$Id$
2 // Author: Paul Russo 30/07/2012
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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_TClingMethodInfo
13 #define ROOT_TClingMethodInfo
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TClingMethodInfo //
18 // //
19 // Emulation of the CINT MethodInfo class. //
20 // //
21 // The CINT C++ interpreter provides an interface to metadata about //
22 // a function through the MethodInfo class. This class provides the //
23 // same functionality, using an interface as close as possible to //
24 // MethodInfo but the typedef metadata comes from the Clang C++ //
25 // compiler, not CINT. //
26 // //
27 //////////////////////////////////////////////////////////////////////////
28 
29 #include "TString.h"
30 #include "TDictionary.h"
31 
32 #include "clang/AST/DeclBase.h"
33 #include "llvm/ADT/SmallVector.h"
34 
35 namespace cling {
36  class Interpreter;
37 }
38 
39 namespace clang {
40  class FunctionDecl;
41 }
42 
43 namespace ROOT {
44  namespace TMetaUtils {
45  class TNormalizedCtxt;
46  }
47 }
48 
49 class TClingClassInfo;
50 class TClingTypeInfo;
51 
53 private:
54  class SpecIterator;
55 
56  cling::Interpreter *fInterp; // Cling interpreter, we do *not* own.
57  llvm::SmallVector<clang::DeclContext *, 2> fContexts; // Set of DeclContext that we will iterate over.
58  bool fFirstTime; // Flag for first time incrementing iterator, cint semantics are weird.
59  unsigned int fContextIdx; // Index in fContexts of DeclContext we are iterating over.
60  clang::DeclContext::decl_iterator fIter; // Our iterator.
61  std::string fTitle; // The meta info for the method.
62  SpecIterator *fTemplateSpecIter; // Iter over template specialization. [We own]
63  const clang::FunctionDecl *fSingleDecl; // The single member
64 
65 public:
66  explicit TClingMethodInfo(cling::Interpreter *interp)
67  : fInterp(interp), fFirstTime(true), fContextIdx(0U), fTitle(""),
68  fTemplateSpecIter(0), fSingleDecl(0) {}
69 
71 
72  // Takes concrete decl and disables the iterator.
73  TClingMethodInfo(cling::Interpreter *, const clang::FunctionDecl *);
74  TClingMethodInfo(cling::Interpreter *, TClingClassInfo *);
75 
77 
78  const clang::FunctionDecl *GetMethodDecl() const;
80  cling::Interpreter *GetInterpreter() const { return fInterp; }
81  void CreateSignature(TString &signature) const;
82  void Init(const clang::FunctionDecl *);
83  void *InterfaceMethod(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const;
84  bool IsValid() const;
85  int NArg() const;
86  int NDefaultArg() const;
87  int InternalNext();
88  int Next();
89  long Property() const;
90  long ExtraProperty() const;
91  TClingTypeInfo *Type() const;
92  std::string GetMangledName() const;
93  const char *GetPrototype(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const;
94  const char *Name(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const;
95  const char *TypeName() const;
96  const char *Title();
97 };
98 
99 #endif // ROOT_TClingMethodInfo
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
const char * GetPrototype(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
llvm::SmallVector< clang::DeclContext *, 2 > fContexts
Emulation of the CINT MethodInfo class.
int NDefaultArg() const
clang::DeclContext::decl_iterator fIter
Basic string class.
Definition: TString.h:137
TClingTypeInfo * Type() const
const char * Title()
const void * DeclId_t
Definition: TDictionary.h:209
void CreateSignature(TString &signature) const
cling::Interpreter * GetInterpreter() const
bool IsValid() const
Emulation of the CINT TypeInfo class.
long ExtraProperty() const
SpecIterator * fTemplateSpecIter
void Init(const clang::FunctionDecl *)
unsigned int fContextIdx
void * InterfaceMethod(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
const clang::FunctionDecl * GetMethodDecl() const
std::string fTitle
TDictionary::DeclId_t GetDeclId() const
const char * TypeName() const
std::string GetMangledName() const
const char * Name(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
const clang::FunctionDecl * fSingleDecl
Definition: TCling.h:48
Definition: TDatime.h:114
Emulation of the CINT ClassInfo class.
TClingMethodInfo(cling::Interpreter *interp)
long Property() const
cling::Interpreter * fInterp