clang
6.0.0
|
A RecursiveASTVisitor subclass that guarantees that AST traversal is performed in a lexical order (i.e. More...
#include "clang/AST/LexicallyOrderedRecursiveASTVisitor.h"
Public Member Functions | |
LexicallyOrderedRecursiveASTVisitor (const SourceManager &SM) | |
bool | TraverseObjCImplementationDecl (ObjCImplementationDecl *D) |
bool | TraverseObjCCategoryImplDecl (ObjCCategoryImplDecl *D) |
bool | TraverseDeclContextHelper (DeclContext *DC) |
Stmt::child_range | getStmtChildren (Stmt *S) |
SmallVector< Stmt *, 8 > | getStmtChildren (CXXOperatorCallExpr *CE) |
![]() | |
Derived & | getDerived () |
Return a reference to the derived class. More... | |
bool | shouldVisitTemplateInstantiations () const |
Return whether this visitor should recurse into template instantiations. More... | |
bool | shouldWalkTypesOfTypeLocs () const |
Return whether this visitor should recurse into the types of TypeLocs. More... | |
bool | shouldVisitImplicitCode () const |
Return whether this visitor should recurse into implicit code, e.g., implicit constructors and destructors. More... | |
bool | shouldTraversePostOrder () const |
Return whether this visitor should traverse post-order. More... | |
bool | TraverseStmt (Stmt *S, DataRecursionQueue *Queue=nullptr) |
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dynamic type. More... | |
bool | dataTraverseStmtPre (Stmt *S) |
Invoked before visiting a statement or expression via data recursion. More... | |
bool | dataTraverseStmtPost (Stmt *S) |
Invoked after visiting a statement or expression via data recursion. More... | |
bool | TraverseType (QualType T) |
Recursively visit a type, by dispatching to Traverse*Type() based on the argument's getTypeClass() property. More... | |
bool | TraverseTypeLoc (TypeLoc TL) |
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument type's getTypeClass() property. More... | |
bool | TraverseAttr (Attr *At) |
Recursively visit an attribute, by dispatching to Traverse*Attr() based on the argument's dynamic type. More... | |
bool | TraverseDecl (Decl *D) |
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic type. More... | |
bool | TraverseNestedNameSpecifier (NestedNameSpecifier *NNS) |
Recursively visit a C++ nested-name-specifier. More... | |
bool | TraverseNestedNameSpecifierLoc (NestedNameSpecifierLoc NNS) |
Recursively visit a C++ nested-name-specifier with location information. More... | |
bool | TraverseDeclarationNameInfo (DeclarationNameInfo NameInfo) |
Recursively visit a name with its location information. More... | |
bool | TraverseTemplateName (TemplateName Template) |
Recursively visit a template name and dispatch to the appropriate method. More... | |
bool | TraverseTemplateArgument (const TemplateArgument &Arg) |
Recursively visit a template argument and dispatch to the appropriate method for the argument type. More... | |
bool | TraverseTemplateArgumentLoc (const TemplateArgumentLoc &ArgLoc) |
Recursively visit a template argument location and dispatch to the appropriate method for the argument type. More... | |
bool | TraverseTemplateArguments (const TemplateArgument *Args, unsigned NumArgs) |
Recursively visit a set of template arguments. More... | |
bool | TraverseCXXBaseSpecifier (const CXXBaseSpecifier &Base) |
Recursively visit a base specifier. More... | |
bool | TraverseConstructorInitializer (CXXCtorInitializer *Init) |
Recursively visit a constructor initializer. More... | |
bool | TraverseLambdaCapture (LambdaExpr *LE, const LambdaCapture *C, Expr *Init) |
Recursively visit a lambda capture. More... | |
bool | TraverseLambdaBody (LambdaExpr *LE, DataRecursionQueue *Queue=nullptr) |
Recursively visit the body of a lambda expression. More... | |
bool | TraverseSynOrSemInitListExpr (InitListExpr *S, DataRecursionQueue *Queue=nullptr) |
Recursively visit the syntactic or semantic form of an initialization list. More... | |
bool | VisitAttr (Attr *A) |
Stmt::child_range | getStmtChildren (Stmt *S) |
bool | WalkUpFromStmt (Stmt *S) |
bool | VisitStmt (Stmt *S) |
bool | WalkUpFromType (Type *T) |
bool | VisitType (Type *T) |
bool | WalkUpFromTypeLoc (TypeLoc TL) |
bool | VisitTypeLoc (TypeLoc TL) |
bool | WalkUpFromQualifiedTypeLoc (QualifiedTypeLoc TL) |
bool | VisitQualifiedTypeLoc (QualifiedTypeLoc TL) |
bool | WalkUpFromUnqualTypeLoc (UnqualTypeLoc TL) |
bool | VisitUnqualTypeLoc (UnqualTypeLoc TL) |
bool | WalkUpFromDecl (Decl *D) |
bool | VisitDecl (Decl *D) |
bool | canIgnoreChildDeclWhileTraversingDeclContext (const Decl *Child) |
Additional Inherited Members | |
![]() | |
typedef SmallVectorImpl< llvm::PointerIntPair< Stmt *, 1, bool > > | DataRecursionQueue |
A queue used for performing data recursion over statements. More... | |
A RecursiveASTVisitor subclass that guarantees that AST traversal is performed in a lexical order (i.e.
the order in which declarations are written in the source).
RecursiveASTVisitor doesn't guarantee lexical ordering because there are some declarations, like Objective-C declarations that might be represented in the AST differently to how they were written in the source. In particular, Objective-C declarations may contain non-Objective-C declarations, like functions:
MyClass
Clang's AST stores these declarations outside of the declaration, so the example above would be represented using the following AST: |-ObjCImplementationDecl ... MyClass | `-ObjCMethodDecl ... method | ... `-FunctionDecl ... normalFunction ...
This class ensures that these declarations are traversed before the corresponding TraverseDecl for the returns. This ensures that the lexical parent relationship between these declarations and the is preserved while traversing the AST. Note that the current implementation doesn't mix these declarations with the declarations contained in the , so the traversal of all of the declarations in the still doesn't follow the lexical order.
Definition at line 60 of file LexicallyOrderedRecursiveASTVisitor.h.
|
inline |
Definition at line 65 of file LexicallyOrderedRecursiveASTVisitor.h.
|
inline |
Definition at line 114 of file LexicallyOrderedRecursiveASTVisitor.h.
|
inline |
Definition at line 116 of file LexicallyOrderedRecursiveASTVisitor.h.
References clang::CallExpr::children(), clang::RecursiveASTVisitor< Derived >::getDerived(), clang::CXXOperatorCallExpr::getOperator(), clang::CXXOperatorCallExpr::isInfixBinaryOp(), clang::RecursiveASTVisitor< Derived >::shouldTraversePostOrder(), and clang::RecursiveASTVisitor< Derived >::TraverseDecl().
|
inline |
Definition at line 80 of file LexicallyOrderedRecursiveASTVisitor.h.
|
inline |
Definition at line 75 of file LexicallyOrderedRecursiveASTVisitor.h.
References clang::Result.
|
inline |
Definition at line 67 of file LexicallyOrderedRecursiveASTVisitor.h.
References clang::Result.