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"
29#include "TClingUtils.h"
32 class ClassTemplatePartialSpecializationDecl;
33 class ClassTemplateDecl;
46class RScanner:
public clang::RecursiveASTVisitor<RScanner>
59 operator clang::NamespaceDecl
const *()
const {
return fDecl; }
62 const clang::NamespaceDecl *
fDecl;
68 typedef std::vector<ROOT::TMetaUtils::AnnotatedRecordDecl>
ClassColl_t;
76 enum class EScanType :
char {kNormal, kTwoPasses, kOnePCM};
80 const cling::Interpreter &interpret,
81 ROOT::TMetaUtils::TNormalizedCtxt &normCtxt,
111 void Scan(
const clang::ASTContext &
C);
115 static bool GetDeclQualName(
const clang::Decl* D, std::string& qual_name);
133 const clang::ClassTemplateSpecializationDecl *
fDecl;
146 const clang::RecordDecl*,
148 const clang::TypedefNameDecl*,
149 unsigned int indexOffset=0);
154 void DeclInfo(clang::Decl* D)
const;
155 std::string
ExprToStr(clang::Expr* expr)
const;
160 std::string
GetName(clang::Decl* D)
const;
167 void ShowError(
const std::string &msg,
const std::string &location =
"")
const;
168 void ShowInfo(
const std::string &msg,
const std::string &location =
"")
const;
169 void ShowTemplateInfo(
const std::string &msg,
const std::string &location =
"")
const;
170 void ShowWarning(
const std::string &msg,
const std::string &location =
"")
const;
173 void UnexpectedDecl(clang::Decl* D,
const std::string &txt =
"")
const;
175 void UnimportantDecl(clang::Decl* D,
const std::string &txt =
"")
const;
176 void UnknownDecl(clang::Decl* D,
const std::string &txt =
"")
const;
178 void UnsupportedDecl(clang::Decl* D,
const std::string &txt =
"")
const;
typedef void((*Func_t)())
const clang::NamespaceDecl * fDecl
bool RequestOnlyTClass() const
bool operator<(const AnnotatedNamespaceDecl &right)
const clang::NamespaceDecl * GetNamespaceDecl() const
AnnotatedNamespaceDecl(clang::NamespaceDecl *decl, long index, bool rRequestOnlyTClass)
std::string GetLocation(clang::Decl *D) const
void Scan(const clang::ASTContext &C)
void UnknownDecl(clang::Decl *D, const std::string &txt="") const
unknown - this kind of declaration was not known to programmer
std::string ConvTemplateArguments(const clang::TemplateArgumentList &list) const
std::string ConvTemplateParams(clang::TemplateDecl *D) const
RScanner(SelectionRules &rules, EScanType stype, const cling::Interpreter &interpret, ROOT::TMetaUtils::TNormalizedCtxt &normCtxt, unsigned int verbose=0)
Regular constructor setting up the scanner to search for entities matching the 'rules'.
ROOT::TMetaUtils::TNormalizedCtxt & fNormCtxt
std::vector< ROOT::TMetaUtils::AnnotatedRecordDecl > ClassColl_t
DeclCallback fRecordDeclCallback
void UnsupportedDecl(clang::Decl *D, const std::string &txt="") const
unsupported - this kind of declaration is probably not used (in current version of C++)
static std::map< clang::Decl *, std::string > fgAnonymousEnumMap
const DeclsSelRulesMap_t & GetDeclsSelRulesMap() const
void UnimportantDecl(clang::Decl *D, const std::string &txt="") const
unimportant - this kind of declaration is not stored into reflex
bool TraverseClassTemplatePartialSpecializationDecl(clang::ClassTemplatePartialSpecializationDecl *)
void AddDelayedAnnotatedRecordDecls()
const clang::SourceManager * fSourceManager
static const int fgDeclLast
FunctionColl_t fSelectedFunctions
unsigned int VisibilityModifiers(clang::AccessSpecifier access) const
unsigned int Visibility(clang::Decl *D) const
bool VisitFieldDecl(clang::FieldDecl *D)
Nothing to be done here.
void ShowInfo(const std::string &msg, const std::string &location="") const
bool TreatRecordDeclOrTypedefNameDecl(clang::TypeDecl *typeDecl)
static int fgAnonymousClassCounter
std::string FuncParameters(clang::FunctionDecl *D) const
bool fTypeTable[fgTypeLast+1]
std::vector< const clang::FunctionDecl * > FunctionColl_t
void ShowTemplateInfo(const std::string &msg, const std::string &location="") const
std::string GetEnumName(clang::EnumDecl *D) const
NamespaceColl_t fSelectedNamespaces
bool GetFunctionPrototype(clang::Decl *D, std::string &prototype) const
std::set< clang::RecordDecl * > fselectedRecordDecls
std::string ConvTemplateParameterList(clang::TemplateParameterList *list) const
std::string ConvTemplateName(clang::TemplateName &N) const
std::vector< AnnotatedNamespaceDecl > NamespaceColl_t
unsigned int FuncModifiers(clang::FunctionDecl *D) const
static int fgBadClassCounter
void UnimplementedDecl(clang::Decl *D, const std::string &txt="")
information about item, that should be implemented
bool VisitVarDecl(clang::VarDecl *D)
TypedefColl_t fSelectedTypedefs
std::string GetSrcLocation(clang::SourceLocation L) const
void(* DeclCallback)(const clang::RecordDecl *)
void UnsupportedType(clang::QualType qual_type) const
const cling::Interpreter & fInterpreter
DeclCallback SetRecordDeclCallback(DeclCallback callback)
Set the callback to the RecordDecl and return the previous one.
bool VisitNamespaceDecl(clang::NamespaceDecl *D)
This method visits a namespace node.
std::map< const clang::Decl *, const BaseSelectionRule * > DeclsSelRulesMap_t
void ShowWarning(const std::string &msg, const std::string &location="") const
std::string GetName(clang::Decl *D) const
bool shouldVisitTemplateInstantiations() const
static int fgAnonymousEnumCounter
static const char * fgClangFuncKey
void ShowError(const std::string &msg, const std::string &location="") const
void UnexpectedDecl(clang::Decl *D, const std::string &txt="") const
unexpected - this kind of declaration is unexpected (in concrete place)
EnumColl_t fSelectedEnums
int AddAnnotatedRecordDecl(const ClassSelectionRule *, const clang::Type *, const clang::RecordDecl *, const std::string &, const clang::TypedefNameDecl *, unsigned int indexOffset=0)
unsigned int VarModifiers(clang::VarDecl *D) const
std::vector< const clang::TypedefNameDecl * > TypedefColl_t
std::vector< DelayedAnnotatedRecordDeclInfo > fDelayedAnnotatedRecordDecls
std::vector< const clang::VarDecl * > VariableColl_t
bool VisitEnumDecl(clang::EnumDecl *D)
static std::map< clang::Decl *, std::string > fgAnonymousClassMap
std::string FuncParameterList(clang::FunctionDecl *D) const
static bool GetDeclQualName(const clang::Decl *D, std::string &qual_name)
bool TraverseStmt(clang::Stmt *)
std::string ExprToStr(clang::Expr *expr) const
static const int fgTypeLast
SelectionRules & fSelectionRules
static const char * fgClangDeclKey
bool VisitRecordDecl(clang::RecordDecl *D)
void UnknownType(clang::QualType qual_type) const
bool fDeclTable[fgDeclLast+1]
VariableColl_t fSelectedVariables
bool VisitFunctionDecl(clang::FunctionDecl *D)
DeclsSelRulesMap_t fDeclSelRuleMap
unsigned int fVerboseLevel
bool GetDeclName(clang::Decl *D, std::string &name) const
std::vector< const clang::EnumDecl * > EnumColl_t
bool TraverseDeclContextHelper(clang::DeclContext *DC)
ClassColl_t fSelectedClasses
void DeclInfo(clang::Decl *D) const
bool shouldVisitDecl(clang::NamedDecl *D)
Whether we can actually visit this declaration, i.e.
bool VisitTypedefNameDecl(clang::TypedefNameDecl *D)
Visitor for every TypedefNameDecl, i.e.
The class representing the collection of selection rules.
Type
enumeration specifying the integration types.
double Var(const RVec< T > &v)
Get the variance of the elements of an RVec.
static constexpr double L
const clang::ClassTemplateSpecializationDecl * fDecl
const clang::TypedefNameDecl * fTypedefNameDecl
const ClassSelectionRule * fSelected