clang: include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef LLVM_CLANG_TOOLING_REFACTORING_RECURSIVESYMBOLVISITOR_H
16#define LLVM_CLANG_TOOLING_REFACTORING_RECURSIVESYMBOLVISITOR_H
17
21
23namespace tooling {
24
25
26
27template
31
32public:
34 : SM(SM), LangOpts(LangOpts) {}
35
38 return true;
39 }
40
41
42
44 return isa(D) ? true : visit(D, D->getLocation());
45 }
46
49
51 continue;
53 if (!visit(FD, Initializer->getSourceLocation(),
55 0, SM, LangOpts)))
56 return false;
57 }
58 }
59 return true;
60 }
61
62
63
65 return visit(Expr->getFoundDecl(), Expr->getLocation());
66 }
67
69 return visit(Expr->getFoundDecl().getDecl(), Expr->getMemberLoc());
70 }
71
73 for (unsigned I = 0, E = S->getNumComponents(); I != E; ++I) {
74 const OffsetOfNode &Component = S->getComponent(I);
77 return false;
78 }
79
80 }
81 return true;
82 }
83
84
85
90 if (const auto *TemplateTypeParm =
91 dyn_cast(Loc.getType())) {
92 if (!visit(TemplateTypeParm->getDecl(), TypeBeginLoc, TypeEndLoc))
93 return false;
94 }
95 if (const auto *TemplateSpecType =
96 dyn_cast(Loc.getType())) {
97 if (!visit(TemplateSpecType->getTemplateName().getAsTemplateDecl(),
98 TypeBeginLoc, TypeEndLoc))
99 return false;
100 }
101 if (const Type *TP = Loc.getTypePtr()) {
102 if (TP->getTypeClass() == clang::Type::Record)
103 return visit(TP->getAsCXXRecordDecl(), TypeBeginLoc, TypeEndLoc);
104 }
105 return true;
106 }
107
112 }
113
115
116
117 if (NNS) {
120 return false;
121 }
123 }
124
127 if (D.isFieldDesignator()) {
129 if (!visit(Decl, D.getFieldLoc(), D.getFieldLoc()))
130 return false;
131 }
132 }
133 }
134 return true;
135 }
136
137private:
140
145 }
148 }
149};
150
151}
152}
153
154#endif
Represents a C++ constructor within a class.
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
This represents one expression.
Represents a member of a struct/union/class.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset, const SourceManager &SM, const LangOptions &LangOpts)
Computes the source location just past the end of the token at this source location.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
This represents a decl that may have a name.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Helper class for OffsetOfExpr.
FieldDecl * getField() const
For a field offsetof node, returns the field.
Kind getKind() const
Determine what kind of offsetof node this is.
SourceLocation getEndLoc() const LLVM_READONLY
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Recursively visit a C++ nested-name-specifier with location information.
Encodes a location in the source.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
Base wrapper for a particular "section" of type source info.
SourceLocation getBeginLoc() const
Get the begin source location.
The base class of the type hierarchy.
Wrapper for source info for typedefs.
TypedefNameDecl * getTypedefNameDecl() const
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T