14#ifndef LLVM_CLANG_AST_LEXICALLYORDEREDRECURSIVEASTVISITOR_H
15#define LLVM_CLANG_AST_LEXICALLYORDEREDRECURSIVEASTVISITOR_H
20#include "llvm/Support/SaveAndRestore.h"
58template <
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;
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the SourceManager interface.
A call to an overloaded operator written using operator syntax.
bool isInfixBinaryOp() const
Is this written as an infix binary operator?
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
decl_iterator decls_end() const
decl_iterator decls_begin() const
Decl - This represents one declaration (or definition), e.g.
SourceLocation getBeginLoc() const LLVM_READONLY
A RecursiveASTVisitor subclass that guarantees that AST traversal is performed in a lexical order (i....
bool TraverseObjCImplementationDecl(ObjCImplementationDecl *D)
LexicallyOrderedRecursiveASTVisitor(const SourceManager &SM)
SmallVector< Stmt *, 8 > getStmtChildren(CXXOperatorCallExpr *CE)
bool TraverseDeclContextHelper(DeclContext *DC)
bool TraverseObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
Stmt::child_range getStmtChildren(Stmt *S)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
bool canIgnoreChildDeclWhileTraversingDeclContext(const Decl *Child)
bool TraverseDecl(Decl *D)
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic ty...
bool shouldTraversePostOrder() const
Return whether this visitor should traverse post-order.
Derived & getDerived()
Return a reference to the derived class.
This class handles loading and caching of source files into memory.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
Stmt - This represents one statement.
llvm::iterator_range< child_iterator > child_range
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.