Logo ROOT  
Reference Guide
RScanner Class Reference

Definition at line 50 of file Scanner.h.

Classes

class  AnnotatedNamespaceDecl
 
struct  DelayedAnnotatedRecordDeclInfo
 

Public Types

typedef std::vector< ROOT::TMetaUtils::AnnotatedRecordDeclClassColl_t
  More...
 
typedef void(* DeclCallback) (const clang::RecordDecl *)
  More...
 
typedef std::map< const clang::Decl *, const BaseSelectionRule * > DeclsSelRulesMap_t
  More...
 
typedef std::vector< const clang::EnumDecl * > EnumColl_t
  More...
 
enum class  EScanType : char { kNormal , kTwoPasses , kOnePCM }
 
typedef std::vector< const clang::FunctionDecl * > FunctionColl_t
  More...
 
typedef std::vector< AnnotatedNamespaceDeclNamespaceColl_t
  More...
 
typedef std::vector< const clang::TypedefNameDecl * > TypedefColl_t
  More...
 
typedef std::vector< const clang::VarDecl * > VariableColl_t
  More...
 

Public Member Functions

 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'. More...
 
virtual ~RScanner ()
  More...
 
void AddDelayedAnnotatedRecordDecls ()
  More...
 
bool GetDeclName (clang::Decl *D, std::string &name) const
  More...
 
const DeclsSelRulesMap_tGetDeclsSelRulesMap () const
  More...
 
bool GetFunctionPrototype (clang::Decl *D, std::string &prototype) const
  More...
 
void Scan (const clang::ASTContext &C)
  More...
 
DeclCallback SetRecordDeclCallback (DeclCallback callback)
 Set the callback to the RecordDecl and return the previous one. More...
 
bool shouldVisitTemplateInstantiations () const
  More...
 
bool TraverseClassTemplatePartialSpecializationDecl (clang::ClassTemplatePartialSpecializationDecl *)
  More...
 
bool TraverseDeclContextHelper (clang::DeclContext *DC)
  More...
 
bool TraverseStmt (clang::Stmt *)
  More...
 
bool TreatRecordDeclOrTypedefNameDecl (clang::TypeDecl *typeDecl)
  More...
 
bool VisitEnumDecl (clang::EnumDecl *D)
  More...
 
bool VisitFieldDecl (clang::FieldDecl *D)
 Nothing to be done here. More...
 
bool VisitFunctionDecl (clang::FunctionDecl *D)
  More...
 
bool VisitNamespaceDecl (clang::NamespaceDecl *D)
 This method visits a namespace node. More...
 
bool VisitRecordDecl (clang::RecordDecl *D)
  More...
 
bool VisitTypedefNameDecl (clang::TypedefNameDecl *D)
 Visitor for every TypedefNameDecl, i.e. More...
 
bool VisitVarDecl (clang::VarDecl *D)
  More...
 

Static Public Member Functions

static bool GetDeclQualName (const clang::Decl *D, std::string &qual_name)
  More...
 

Public Attributes

std::vector< DelayedAnnotatedRecordDeclInfofDelayedAnnotatedRecordDecls
  More...
 
ClassColl_t fSelectedClasses
  More...
 
EnumColl_t fSelectedEnums
  More...
 
FunctionColl_t fSelectedFunctions
  More...
 
NamespaceColl_t fSelectedNamespaces
  More...
 
TypedefColl_t fSelectedTypedefs
  More...
 
VariableColl_t fSelectedVariables
  More...
 

Static Public Attributes

static const char * fgClangDeclKey = "ClangDecl"
  More...
 
static const char * fgClangFuncKey = "ClangFunc"
  More...
 

Private Member Functions

int AddAnnotatedRecordDecl (const ClassSelectionRule *, const clang::Type *, const clang::RecordDecl *, const std::string &, const clang::TypedefNameDecl *, unsigned int indexOffset=0)
  More...
 
std::string ConvTemplateArguments (const clang::TemplateArgumentList &list) const
  More...
 
std::string ConvTemplateName (clang::TemplateName &N) const
  More...
 
std::string ConvTemplateParameterList (clang::TemplateParameterList *list) const
  More...
 
std::string ConvTemplateParams (clang::TemplateDecl *D) const
  More...
 
void DeclInfo (clang::Decl *D) const
  More...
 
std::string ExprToStr (clang::Expr *expr) const
  More...
 
unsigned int FuncModifiers (clang::FunctionDecl *D) const
  More...
 
std::string FuncParameterList (clang::FunctionDecl *D) const
  More...
 
std::string FuncParameters (clang::FunctionDecl *D) const
  More...
 
std::string GetEnumName (clang::EnumDecl *D) const
  More...
 
std::string GetLocation (clang::Decl *D) const
  More...
 
std::string GetName (clang::Decl *D) const
  More...
 
std::string GetSrcLocation (clang::SourceLocation L) const
  More...
 
bool shouldVisitDecl (clang::NamedDecl *D)
 Whether we can actually visit this declaration, i.e. More...
 
void ShowError (const std::string &msg, const std::string &location="") const
  More...
 
void ShowInfo (const std::string &msg, const std::string &location="") const
  More...
 
void ShowTemplateInfo (const std::string &msg, const std::string &location="") const
  More...
 
void ShowWarning (const std::string &msg, const std::string &location="") const
  More...
 
void UnexpectedDecl (clang::Decl *D, const std::string &txt="") const
 unexpected - this kind of declaration is unexpected (in concrete place) More...
 
void UnimplementedDecl (clang::Decl *D, const std::string &txt="")
 information about item, that should be implemented More...
 
void UnimportantDecl (clang::Decl *D, const std::string &txt="") const
 unimportant - this kind of declaration is not stored into reflex More...
 
void UnknownDecl (clang::Decl *D, const std::string &txt="") const
 unknown - this kind of declaration was not known to programmer More...
 
void UnknownType (clang::QualType qual_type) const
  More...
 
void UnsupportedDecl (clang::Decl *D, const std::string &txt="") const
 unsupported - this kind of declaration is probably not used (in current version of C++) More...
 
void UnsupportedType (clang::QualType qual_type) const
  More...
 
unsigned int VarModifiers (clang::VarDecl *D) const
  More...
 
unsigned int Visibility (clang::Decl *D) const
  More...
 
unsigned int VisibilityModifiers (clang::AccessSpecifier access) const
  More...
 

Private Attributes

DeclsSelRulesMap_t fDeclSelRuleMap
  More...
 
bool fDeclTable [fgDeclLast+1]
  More...
 
bool fFirstPass
  More...
 
const cling::Interpreter & fInterpreter
  More...
 
clang::Decl * fLastDecl
  More...
 
ROOT::TMetaUtils::TNormalizedCtxtfNormCtxt
  More...
 
DeclCallback fRecordDeclCallback
  More...
 
EScanType fScanType
  More...
 
std::set< clang::RecordDecl * > fselectedRecordDecls
  More...
 
SelectionRulesfSelectionRules
  More...
 
const clang::SourceManager * fSourceManager
  More...
 
bool fTypeTable [fgTypeLast+1]
  More...
 
unsigned int fVerboseLevel
  More...
 

Static Private Attributes

static int fgAnonymousClassCounter = 0
  More...
 
static std::map< clang::Decl *, std::string > fgAnonymousClassMap
  More...
 
static int fgAnonymousEnumCounter = 0
  More...
 
static std::map< clang::Decl *, std::string > fgAnonymousEnumMap
  More...
 
static int fgBadClassCounter = 0
  More...
 
static const int fgDeclLast = clang::Decl::Var
  More...
 
static const int fgTypeLast = clang::Type::TemplateTypeParm
  More...
 

#include </home/sftnight/build/workspace/root-makedoc-master/rootspi/rdoc/src/master/core/dictgen/res/Scanner.h>

Inheritance diagram for RScanner:
[legend]

Member Typedef Documentation

◆ ClassColl_t

Definition at line 72 of file Scanner.h.

◆ DeclCallback

typedef void(* RScanner::DeclCallback) (const clang::RecordDecl *)

Definition at line 77 of file Scanner.h.

◆ DeclsSelRulesMap_t

typedef std::map<const clang::Decl*,const BaseSelectionRule*> RScanner::DeclsSelRulesMap_t

Definition at line 78 of file Scanner.h.

◆ EnumColl_t

typedef std::vector<const clang::EnumDecl*> RScanner::EnumColl_t

Definition at line 76 of file Scanner.h.

◆ FunctionColl_t

typedef std::vector<const clang::FunctionDecl*> RScanner::FunctionColl_t

Definition at line 74 of file Scanner.h.

◆ NamespaceColl_t

Definition at line 71 of file Scanner.h.

◆ TypedefColl_t

typedef std::vector<const clang::TypedefNameDecl*> RScanner::TypedefColl_t

Definition at line 73 of file Scanner.h.

◆ VariableColl_t

typedef std::vector<const clang::VarDecl*> RScanner::VariableColl_t

Definition at line 75 of file Scanner.h.

Member Enumeration Documentation

◆ EScanType

enum class RScanner::EScanType : char
strong
Enumerator
kNormal 
kTwoPasses 
kOnePCM 

Definition at line 80 of file Scanner.h.

Constructor & Destructor Documentation

◆ RScanner()

RScanner::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'.

Definition at line 76 of file Scanner.cxx.

◆ ~RScanner()

RScanner::~RScanner ( )
virtual

Definition at line 104 of file Scanner.cxx.

Member Function Documentation

◆ AddAnnotatedRecordDecl()

int RScanner::AddAnnotatedRecordDecl ( const ClassSelectionRule selected,
const clang::Type *  req_type,
const clang::RecordDecl *  recordDecl,
const std::string &  attr_name,
const clang::TypedefNameDecl *  typedefNameDecl,
unsigned int  indexOffset = 0 
)
private

Definition at line 534 of file Scanner.cxx.

◆ AddDelayedAnnotatedRecordDecls()

void RScanner::AddDelayedAnnotatedRecordDecls ( )

Definition at line 810 of file Scanner.cxx.

◆ ConvTemplateArguments()

std::string RScanner::ConvTemplateArguments ( const clang::TemplateArgumentList &  list) const
private

◆ ConvTemplateName()

std::string RScanner::ConvTemplateName ( clang::TemplateName &  N) const
private

Definition at line 416 of file Scanner.cxx.

◆ ConvTemplateParameterList()

std::string RScanner::ConvTemplateParameterList ( clang::TemplateParameterList *  list) const
private

◆ ConvTemplateParams()

std::string RScanner::ConvTemplateParams ( clang::TemplateDecl *  D) const
private

◆ DeclInfo()

void RScanner::DeclInfo ( clang::Decl *  D) const
private

Definition at line 275 of file Scanner.cxx.

◆ ExprToStr()

std::string RScanner::ExprToStr ( clang::Expr *  expr) const
private

Definition at line 401 of file Scanner.cxx.

◆ FuncModifiers()

unsigned int RScanner::FuncModifiers ( clang::FunctionDecl *  D) const
private

◆ FuncParameterList()

std::string RScanner::FuncParameterList ( clang::FunctionDecl *  D) const
private

Definition at line 458 of file Scanner.cxx.

◆ FuncParameters()

std::string RScanner::FuncParameters ( clang::FunctionDecl *  D) const
private

Definition at line 431 of file Scanner.cxx.

◆ GetDeclName()

bool RScanner::GetDeclName ( clang::Decl *  D,
std::string &  name 
) const

Definition at line 979 of file Scanner.cxx.

◆ GetDeclQualName()

bool RScanner::GetDeclQualName ( const clang::Decl *  D,
std::string &  qual_name 
)
static

Definition at line 995 of file Scanner.cxx.

◆ GetDeclsSelRulesMap()

const DeclsSelRulesMap_t& RScanner::GetDeclsSelRulesMap ( ) const
inline

Definition at line 125 of file Scanner.h.

◆ GetEnumName()

std::string RScanner::GetEnumName ( clang::EnumDecl *  D) const
private

Definition at line 377 of file Scanner.cxx.

◆ GetFunctionPrototype()

bool RScanner::GetFunctionPrototype ( clang::Decl *  D,
std::string &  prototype 
) const

Definition at line 1011 of file Scanner.cxx.

◆ GetLocation()

std::string RScanner::GetLocation ( clang::Decl *  D) const
private

Definition at line 234 of file Scanner.cxx.

◆ GetName()

std::string RScanner::GetName ( clang::Decl *  D) const
private

Definition at line 251 of file Scanner.cxx.

◆ GetSrcLocation()

std::string RScanner::GetSrcLocation ( clang::SourceLocation  L) const
private

Definition at line 224 of file Scanner.cxx.

◆ Scan()

void RScanner::Scan ( const clang::ASTContext &  C)

Definition at line 1047 of file Scanner.cxx.

◆ SetRecordDeclCallback()

RScanner::DeclCallback RScanner::SetRecordDeclCallback ( RScanner::DeclCallback  callback)

Set the callback to the RecordDecl and return the previous one.

Definition at line 1078 of file Scanner.cxx.

◆ shouldVisitDecl()

bool RScanner::shouldVisitDecl ( clang::NamedDecl *  D)
private

Whether we can actually visit this declaration, i.e.

if it is reachable via name lookup.

RScanner shouldn't touch decls for which this method returns false as we call Sema methods on those declarations. Those will fail in strange way as they assume those decls are already visible.

The main problem this is supposed to prevent is when we use C++ modules and have hidden declarations in our AST. Usually they can't be found as they are hidden from name lookup until their module is actually imported, but as the RecursiveASTVisitor is not supposed to be restricted by lookup limitations, it still reaches those hidden declarations.

Definition at line 121 of file Scanner.cxx.

◆ shouldVisitTemplateInstantiations()

bool RScanner::shouldVisitTemplateInstantiations ( ) const
inline

Definition at line 89 of file Scanner.h.

◆ ShowError()

void RScanner::ShowError ( const std::string &  msg,
const std::string &  location = "" 
) const
private

Definition at line 206 of file Scanner.cxx.

◆ ShowInfo()

void RScanner::ShowInfo ( const std::string &  msg,
const std::string &  location = "" 
) const
private

Definition at line 190 of file Scanner.cxx.

◆ ShowTemplateInfo()

void RScanner::ShowTemplateInfo ( const std::string &  msg,
const std::string &  location = "" 
) const
private

Definition at line 214 of file Scanner.cxx.

◆ ShowWarning()

void RScanner::ShowWarning ( const std::string &  msg,
const std::string &  location = "" 
) const
private

Definition at line 198 of file Scanner.cxx.

◆ TraverseClassTemplatePartialSpecializationDecl()

bool RScanner::TraverseClassTemplatePartialSpecializationDecl ( clang::ClassTemplatePartialSpecializationDecl *  )
inline

Definition at line 95 of file Scanner.h.

◆ TraverseDeclContextHelper()

bool RScanner::TraverseDeclContextHelper ( clang::DeclContext *  DC)

Definition at line 949 of file Scanner.cxx.

◆ TraverseStmt()

bool RScanner::TraverseStmt ( clang::Stmt *  )
inline

Definition at line 92 of file Scanner.h.

◆ TreatRecordDeclOrTypedefNameDecl()

bool RScanner::TreatRecordDeclOrTypedefNameDecl ( clang::TypeDecl *  typeDecl)

Definition at line 607 of file Scanner.cxx.

◆ UnexpectedDecl()

void RScanner::UnexpectedDecl ( clang::Decl *  D,
const std::string &  txt = "" 
) const
private

unexpected - this kind of declaration is unexpected (in concrete place)

Definition at line 297 of file Scanner.cxx.

◆ UnimplementedDecl()

void RScanner::UnimplementedDecl ( clang::Decl *  D,
const std::string &  txt = "" 
)
private

information about item, that should be implemented

Definition at line 326 of file Scanner.cxx.

◆ UnimportantDecl()

void RScanner::UnimportantDecl ( clang::Decl *  D,
const std::string &  txt = "" 
) const
private

unimportant - this kind of declaration is not stored into reflex

Definition at line 319 of file Scanner.cxx.

◆ UnknownDecl()

void RScanner::UnknownDecl ( clang::Decl *  D,
const std::string &  txt = "" 
) const
private

unknown - this kind of declaration was not known to programmer

Definition at line 286 of file Scanner.cxx.

◆ UnknownType()

void RScanner::UnknownType ( clang::QualType  qual_type) const
private

Definition at line 359 of file Scanner.cxx.

◆ UnsupportedDecl()

void RScanner::UnsupportedDecl ( clang::Decl *  D,
const std::string &  txt = "" 
) const
private

unsupported - this kind of declaration is probably not used (in current version of C++)

Definition at line 308 of file Scanner.cxx.

◆ UnsupportedType()

void RScanner::UnsupportedType ( clang::QualType  qual_type) const
private

Definition at line 368 of file Scanner.cxx.

◆ VarModifiers()

unsigned int RScanner::VarModifiers ( clang::VarDecl *  D) const
private

◆ Visibility()

unsigned int RScanner::Visibility ( clang::Decl *  D) const
private

◆ VisibilityModifiers()

unsigned int RScanner::VisibilityModifiers ( clang::AccessSpecifier  access) const
private

◆ VisitEnumDecl()

bool RScanner::VisitEnumDecl ( clang::EnumDecl *  D)

Definition at line 870 of file Scanner.cxx.

◆ VisitFieldDecl()

bool RScanner::VisitFieldDecl ( clang::FieldDecl *  D)

Nothing to be done here.

Definition at line 907 of file Scanner.cxx.

◆ VisitFunctionDecl()

bool RScanner::VisitFunctionDecl ( clang::FunctionDecl *  D)

Definition at line 929 of file Scanner.cxx.

◆ VisitNamespaceDecl()

bool RScanner::VisitNamespaceDecl ( clang::NamespaceDecl *  D)

This method visits a namespace node.

Definition at line 478 of file Scanner.cxx.

◆ VisitRecordDecl()

bool RScanner::VisitRecordDecl ( clang::RecordDecl *  D)

Definition at line 521 of file Scanner.cxx.

◆ VisitTypedefNameDecl()

bool RScanner::VisitTypedefNameDecl ( clang::TypedefNameDecl *  D)

Visitor for every TypedefNameDecl, i.e.

aliases and typedefs We check three conditions before trying to match the name: 1) If we are creating a big PCM 2) If the underlying decl is a RecordDecl 3) If the typedef is eventually contained in the std namespace

Definition at line 844 of file Scanner.cxx.

◆ VisitVarDecl()

bool RScanner::VisitVarDecl ( clang::VarDecl *  D)

Definition at line 888 of file Scanner.cxx.

Member Data Documentation

◆ fDeclSelRuleMap

DeclsSelRulesMap_t RScanner::fDeclSelRuleMap
private

Definition at line 201 of file Scanner.h.

◆ fDeclTable

bool RScanner::fDeclTable[fgDeclLast+1]
private

Definition at line 189 of file Scanner.h.

◆ fDelayedAnnotatedRecordDecls

std::vector<DelayedAnnotatedRecordDeclInfo> RScanner::fDelayedAnnotatedRecordDecls

Definition at line 140 of file Scanner.h.

◆ fFirstPass

bool RScanner::fFirstPass
private

Definition at line 200 of file Scanner.h.

◆ fgAnonymousClassCounter

int RScanner::fgAnonymousClassCounter = 0
staticprivate

Definition at line 193 of file Scanner.h.

◆ fgAnonymousClassMap

std::map< clang::Decl *, std::string > RScanner::fgAnonymousClassMap
staticprivate

Definition at line 175 of file Scanner.h.

◆ fgAnonymousEnumCounter

int RScanner::fgAnonymousEnumCounter = 0
staticprivate

Definition at line 194 of file Scanner.h.

◆ fgAnonymousEnumMap

std::map< clang::Decl *, std::string > RScanner::fgAnonymousEnumMap
staticprivate

Definition at line 176 of file Scanner.h.

◆ fgBadClassCounter

int RScanner::fgBadClassCounter = 0
staticprivate

Definition at line 195 of file Scanner.h.

◆ fgClangDeclKey

const char * RScanner::fgClangDeclKey = "ClangDecl"
static

Definition at line 122 of file Scanner.h.

◆ fgClangFuncKey

const char * RScanner::fgClangFuncKey = "ClangFunc"
static

Definition at line 123 of file Scanner.h.

◆ fgDeclLast

const int RScanner::fgDeclLast = clang::Decl::Var
staticprivate

Definition at line 187 of file Scanner.h.

◆ fgTypeLast

const int RScanner::fgTypeLast = clang::Type::TemplateTypeParm
staticprivate

Definition at line 188 of file Scanner.h.

◆ fInterpreter

const cling::Interpreter& RScanner::fInterpreter
private

Definition at line 186 of file Scanner.h.

◆ fLastDecl

clang::Decl* RScanner::fLastDecl
private

Definition at line 190 of file Scanner.h.

◆ fNormCtxt

ROOT::TMetaUtils::TNormalizedCtxt& RScanner::fNormCtxt
private

Definition at line 196 of file Scanner.h.

◆ fRecordDeclCallback

DeclCallback RScanner::fRecordDeclCallback
private

Definition at line 191 of file Scanner.h.

◆ fScanType

EScanType RScanner::fScanType
private

Definition at line 199 of file Scanner.h.

◆ fSelectedClasses

ClassColl_t RScanner::fSelectedClasses

Definition at line 128 of file Scanner.h.

◆ fSelectedEnums

EnumColl_t RScanner::fSelectedEnums

Definition at line 133 of file Scanner.h.

◆ fSelectedFunctions

FunctionColl_t RScanner::fSelectedFunctions

Definition at line 131 of file Scanner.h.

◆ fSelectedNamespaces

NamespaceColl_t RScanner::fSelectedNamespaces

Definition at line 129 of file Scanner.h.

◆ fselectedRecordDecls

std::set<clang::RecordDecl*> RScanner::fselectedRecordDecls
private

Definition at line 198 of file Scanner.h.

◆ fSelectedTypedefs

TypedefColl_t RScanner::fSelectedTypedefs

Definition at line 130 of file Scanner.h.

◆ fSelectedVariables

VariableColl_t RScanner::fSelectedVariables

Definition at line 132 of file Scanner.h.

◆ fSelectionRules

SelectionRules& RScanner::fSelectionRules
private

Definition at line 197 of file Scanner.h.

◆ fSourceManager

const clang::SourceManager* RScanner::fSourceManager
private

Definition at line 185 of file Scanner.h.

◆ fTypeTable

bool RScanner::fTypeTable[fgTypeLast+1]
private

Definition at line 192 of file Scanner.h.

◆ fVerboseLevel

unsigned int RScanner::fVerboseLevel
private

Definition at line 167 of file Scanner.h.


The documentation for this class was generated from the following files: