15 #ifndef LLVM_CLANG_AST_LEXICALLY_ORDERED_RECURSIVEASTVISITOR_H 16 #define LLVM_CLANG_AST_LEXICALLY_ORDERED_RECURSIVEASTVISITOR_H 21 #include "llvm/Support/SaveAndRestore.h" 59 template <
typename Derived>
71 bool Result = BaseType::TraverseObjCImplementationDecl(D);
72 return TraverseAdditionalLexicallyNestedDeclarations() ?
Result :
false;
76 bool Result = BaseType::TraverseObjCCategoryImplDecl(D);
77 return TraverseAdditionalLexicallyNestedDeclarations() ?
Result :
false;
90 if (!isa<ObjCImplementationDecl>(Child) &&
91 !isa<ObjCCategoryImplDecl>(Child)) {
99 LexicallyNestedDeclarations.clear();
100 for (++I; I != E; ++I) {
106 LexicallyNestedDeclarations.push_back(Sibling);
130 Swap = Children.size() != 2;
136 if (Swap && Children.size() > 1)
137 std::swap(Children[0], Children[1]);
142 bool TraverseAdditionalLexicallyNestedDeclarations() {
149 "post-order traversal is not supported for lexically ordered " 150 "recursive ast visitor");
151 for (
Decl *D : LexicallyNestedDeclarations) {
164 #endif // LLVM_CLANG_AST_LEXICALLY_ORDERED_RECURSIVEASTVISITOR_H A call to an overloaded operator written using operator syntax.
Stmt - This represents one statement.
LexicallyOrderedRecursiveASTVisitor(const SourceManager &SM)
Defines the SourceManager interface.
Decl - This represents one declaration (or definition), e.g.
bool shouldTraversePostOrder() const
Return whether this visitor should traverse post-order.
SourceLocation getBeginLoc() const LLVM_READONLY
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
llvm::iterator_range< child_iterator > child_range
SourceLocation getEndLoc() const LLVM_READONLY
bool TraverseObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
Derived & getDerived()
Return a reference to the derived class.
bool TraverseDeclContextHelper(DeclContext *DC)
SmallVector< Stmt *, 8 > getStmtChildren(CXXOperatorCallExpr *CE)
bool TraverseDecl(Decl *D)
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic ty...
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
bool canIgnoreChildDeclWhileTraversingDeclContext(const Decl *Child)
The result type of a method or function.
Stmt::child_range getStmtChildren(Stmt *S)
decl_iterator decls_begin() const
bool isInfixBinaryOp() const
Is this written as an infix binary operator?
A RecursiveASTVisitor subclass that guarantees that AST traversal is performed in a lexical order (i...
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
bool TraverseObjCImplementationDecl(ObjCImplementationDecl *D)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
This class handles loading and caching of source files into memory.
decl_iterator decls_end() const