Go to the documentation of this file.
14 #ifndef LLVM_CLANG_AST_LEXICALLYORDEREDRECURSIVEASTVISITOR_H
15 #define LLVM_CLANG_AST_LEXICALLYORDEREDRECURSIVEASTVISITOR_H
20 #include "llvm/Support/SaveAndRestore.h"
58 template <
typename Derived>
70 bool Result = BaseType::TraverseObjCImplementationDecl(D);
71 return TraverseAdditionalLexicallyNestedDeclarations() ? Result :
false;
75 bool Result = BaseType::TraverseObjCCategoryImplDecl(D);
76 return TraverseAdditionalLexicallyNestedDeclarations() ? Result :
false;
89 if (!isa<ObjCImplementationDecl>(Child) &&
90 !isa<ObjCCategoryImplDecl>(Child)) {
98 LexicallyNestedDeclarations.clear();
99 for (++I; I != E; ++I) {
105 LexicallyNestedDeclarations.push_back(Sibling);
129 Swap = Children.size() != 2;
135 if (Swap && Children.size() > 1)
136 std::swap(Children[0], Children[1]);
141 bool TraverseAdditionalLexicallyNestedDeclarations() {
148 "post-order traversal is not supported for lexically ordered "
149 "recursive ast visitor");
150 for (
Decl *D : LexicallyNestedDeclarations) {
157 const SourceManager &SM;
163 #endif // LLVM_CLANG_AST_LEXICALLYORDEREDRECURSIVEASTVISITOR_H
decl_iterator decls_end() const
SourceLocation getBeginLoc() const LLVM_READONLY
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
bool canIgnoreChildDeclWhileTraversingDeclContext(const Decl *Child)
bool TraverseDeclContextHelper(DeclContext *DC)
This class handles loading and caching of source files into memory.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
bool TraverseObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
llvm::iterator_range< child_iterator > child_range
bool shouldTraversePostOrder() const
Return whether this visitor should traverse post-order.
A RecursiveASTVisitor subclass that guarantees that AST traversal is performed in a lexical order (i....
Derived & getDerived()
Return a reference to the derived class.
Stmt::child_range getStmtChildren(Stmt *S)
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
bool TraverseObjCImplementationDecl(ObjCImplementationDecl *D)
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Decl - This represents one declaration (or definition), e.g.
SmallVector< Stmt *, 8 > getStmtChildren(CXXOperatorCallExpr *CE)
Stmt - This represents one statement.
bool TraverseDecl(Decl *D)
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic ty...
LexicallyOrderedRecursiveASTVisitor(const SourceManager &SM)
A call to an overloaded operator written using operator syntax.
bool isInfixBinaryOp() const
Is this written as an infix binary operator?
decl_iterator decls_begin() const