15 #ifndef ROOT__RSCANNER_H__ 16 #define ROOT__RSCANNER_H__ 20 #include "clang/AST/AST.h" 21 #include "clang/AST/ASTContext.h" 22 #include "clang/AST/DeclGroup.h" 23 #include "clang/AST/DeclFriend.h" 24 #include "clang/AST/Type.h" 25 #include "clang/AST/RecursiveASTVisitor.h" 27 #include "llvm/IR/Module.h" 32 class ClassTemplatePartialSpecializationDecl;
33 class ClassTemplateDecl;
45 class RScanner:
public clang::RecursiveASTVisitor<RScanner>
52 fDecl(decl), fRuleIndex(index), fRequestOnlyTClass(rRequestOnlyTClass){}
56 operator clang::NamespaceDecl
const *()
const {
return fDecl; }
59 const clang::NamespaceDecl *
fDecl;
65 typedef std::vector<ROOT::TMetaUtils::AnnotatedRecordDecl>
ClassColl_t;
70 typedef void (*DeclCallback)(
const char *
type);
73 enum class EScanType : char {kNormal, kTwoPasses, kOnePCM};
77 const cling::Interpreter &interpret,
90 bool VisitEnumDecl(clang::EnumDecl* D);
91 bool VisitFieldDecl(clang::FieldDecl* D);
92 bool VisitFunctionDecl(clang::FunctionDecl* D);
93 bool VisitNamespaceDecl(clang::NamespaceDecl* D);
94 bool VisitRecordDecl(clang::RecordDecl* D);
95 bool VisitTypedefNameDecl(clang::TypedefNameDecl* D);
96 bool VisitVarDecl(clang::VarDecl* D);
98 bool TreatRecordDeclOrTypedefNameDecl(clang::TypeDecl* typeDecl);
100 bool TraverseDeclContextHelper(clang::DeclContext *DC);
104 DeclCallback SetRecordDeclCallback(DeclCallback callback);
107 void Scan(
const clang::ASTContext &
C);
110 std::string GetClassName(clang::DeclContext* DC)
const;
111 bool GetDeclName(clang::Decl* D, std::string&
name)
const;
112 bool GetDeclQualName(clang::Decl* D, std::string& qual_name)
const;
113 bool GetFunctionPrototype(clang::Decl* D, std::string& prototype)
const;
121 ClassColl_t fSelectedClasses;
134 std::string ConvTemplateArguments(
const clang::TemplateArgumentList& list)
const;
135 std::string ConvTemplateName(clang::TemplateName&
N)
const;
136 std::string ConvTemplateParameterList(clang::TemplateParameterList* list)
const;
137 std::string ConvTemplateParams(clang::TemplateDecl* D)
const;
138 void DeclInfo(clang::Decl* D)
const;
139 std::string ExprToStr(clang::Expr* expr)
const;
140 std::string FuncParameterList(clang::FunctionDecl* D)
const;
141 std::string FuncParameters(clang::FunctionDecl* D)
const;
142 std::string GetClassName(clang::RecordDecl* D)
const;
143 std::string GetEnumName(clang::EnumDecl* D)
const;
144 std::string GetLocation(clang::Decl* D)
const;
145 std::string GetName(clang::Decl* D)
const;
146 std::string GetSrcLocation(clang::SourceLocation
L)
const;
147 unsigned int FuncModifiers(clang::FunctionDecl* D)
const;
149 unsigned int VarModifiers(clang::VarDecl* D)
const;
150 unsigned int Visibility(clang::Decl* D)
const;
151 unsigned int VisibilityModifiers(clang::AccessSpecifier access)
const;
152 void ShowError(
const std::string &msg,
const std::string &location =
"")
const;
153 void ShowInfo(
const std::string &msg,
const std::string &location =
"")
const;
154 void ShowTemplateInfo(
const std::string &msg,
const std::string &location =
"")
const;
155 void ShowWarning(
const std::string &msg,
const std::string &location =
"")
const;
158 void UnexpectedDecl(clang::Decl* D,
const std::string &txt =
"")
const;
159 void UnimplementedDecl(clang::Decl* D,
const std::string &txt =
"");
160 void UnimplementedType(clang::QualType qual_type);
162 void UnimportantDecl(clang::Decl* D,
const std::string &txt =
"")
const;
163 void UnimportantType(clang::QualType qual_type)
const;
164 void UnknownDecl(clang::Decl* D,
const std::string &txt =
"")
const;
165 void UnknownType(clang::QualType qual_type)
const;
166 void UnsupportedDecl(clang::Decl* D,
const std::string &txt =
"")
const;
167 void UnsupportedType(clang::QualType qual_type)
const;
171 static const int fgDeclLast = clang::Decl::Var;
172 static const int fgTypeLast = clang::Type::TemplateTypeParm;
173 bool fDeclTable [ fgDeclLast+1 ];
176 bool fTypeTable [ fgTypeLast+1 ];
NamespaceColl_t fSelectedNamespaces
bool shouldVisitTemplateInstantiations() const
bool TraverseStmt(clang::Stmt *)
RooArgList L(const RooAbsArg &v1)
static std::map< clang::Decl *, std::string > fgAnonymousEnumMap
const clang::NamespaceDecl * fDecl
static std::map< clang::Decl *, std::string > fgAnonymousClassMap
static int fgAnonymousEnumCounter
ROOT::TMetaUtils::TNormalizedCtxt & fNormCtxt
unsigned int fVerboseLevel
SelectionRules & fSelectionRules
static const char * fgClangDeclKey
VariableColl_t fSelectedVariables
static int fgAnonymousClassCounter
FunctionColl_t fSelectedFunctions
bool TraverseClassTemplatePartialSpecializationDecl(clang::ClassTemplatePartialSpecializationDecl *)
The class representing the collection of selection rules.
std::vector< clang::FunctionDecl * > FunctionColl_t
RooCmdArg ShowError(Bool_t flag)
const cling::Interpreter & fInterpreter
bool RequestOnlyTClass() const
std::vector< clang::VarDecl * > VariableColl_t
const DeclsSelRulesMap_t & GetDeclsSelRulesMap() const
bool operator<(const AnnotatedNamespaceDecl &right)
std::vector< clang::EnumDecl * > EnumColl_t
DeclsSelRulesMap_t fDeclSelRuleMap
Type
enumeration specifying the integration types.
const clang::NamespaceDecl * GetNamespaceDecl() const
const clang::SourceManager * fSourceManager
std::map< clang::Decl *, const BaseSelectionRule * > DeclsSelRulesMap_t
Print a TSeq at the prompt:
std::set< clang::RecordDecl * > fselectedRecordDecls
EnumColl_t fSelectedEnums
AnnotatedNamespaceDecl(clang::NamespaceDecl *decl, long index, bool rRequestOnlyTClass)
typedef void((*Func_t)())
std::vector< ROOT::TMetaUtils::AnnotatedRecordDecl > ClassColl_t
std::vector< AnnotatedNamespaceDecl > NamespaceColl_t
static const char * fgClangFuncKey
DeclCallback fRecordDeclCallback
static int fgBadClassCounter
std::vector< clang::TypedefNameDecl * > TypedefColl_t
TypedefColl_t fSelectedTypedefs