clang: lib/ARCMigrate/Transforms.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_CLANG_LIB_ARCMIGRATE_TRANSFORMS_H
10#define LLVM_CLANG_LIB_ARCMIGRATE_TRANSFORMS_H
11
14#include "llvm/ADT/DenseSet.h"
15#include "llvm/Support/SaveAndRestore.h"
16
19 class Stmt;
20 class BlockDecl;
21 class ObjCMethodDecl;
22 class FunctionDecl;
23
24namespace arcmt {
25 class MigrationPass;
26
27namespace trans {
28
30
31
32
33
34
42
44
48 Stmt *TopStmt;
49
50public:
52 : MigrateCtx(MigrateCtx), PMap(S), TopStmt(S) {}
53
57};
58
62
63public:
66 : MigrateCtx(MigrateCtx), ImpD(D) {}
67
70};
71
73public:
78};
79
81 std::vector<ASTTraverser *> Traversers;
82
83public:
85
91
92
94 };
98
99
100
102
105
109
111 Traversers.push_back(traverser);
112 }
113
117 }
121
123
125};
126
128public:
130};
131
133public:
135};
136
138public:
140};
141
142
143
145public:
147};
148
150public:
152};
153
154
155
156
157
158
160 bool AllowOnUnknownClass = false);
161
164
165
166
167
168
170 bool IsDecl = false);
171
172
173
174
175
177 bool IsDecl = false);
178
181
183
184template <typename BODY_TRANS>
187 Decl *ParentD;
188
190public:
192
194 if (rootS)
195 BODY_TRANS(Pass).transformBody(rootS, ParentD);
196 return true;
197 }
198
201 return base::TraverseObjCMethodDecl(D);
202 }
203};
204
205typedef llvm::DenseSet<Expr *> ExprSet;
206
208template
210 for (; begin != end; ++begin)
212}
213
215
217
218}
219
220}
221
222}
223
224#endif
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A builtin binary operation expression such as "x + y" or "x <= y".
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
ObjCMethodDecl - Represents an instance or class method declaration.
A (possibly-)qualified type.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
Encodes a location in the source.
Stmt - This represents one statement.
The top declaration context.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
virtual void traverseObjCImplementation(ObjCImplementationContext &ImplCtx)
virtual void traverseBody(BodyContext &BodyCtx)
virtual void traverseTU(MigrationContext &MigrateCtx)
void traverseBody(BodyContext &BodyCtx) override
MigrationContext & getMigrationContext()
BodyContext(MigrationContext &MigrateCtx, Stmt *S)
ParentMap & getParentMap()
BodyTransform(MigrationPass &pass)
bool TraverseObjCMethodDecl(ObjCMethodDecl *D)
bool TraverseStmt(Stmt *rootS)
void traverseTU(MigrationContext &MigrateCtx) override
void traverseBody(BodyContext &BodyCtx) override
llvm::DenseSet< SourceLocation > AttrSet
void traverse(TranslationUnitDecl *TU)
bool addPropertyAttribute(StringRef attr, SourceLocation atLoc)
bool removePropertyAttribute(StringRef fromAttr, SourceLocation atLoc)
traverser_iterator traversers_begin()
std::vector< ASTTraverser * >::iterator traverser_iterator
std::vector< GCAttrOccurrence > GCAttrs
llvm::DenseSet< SourceLocation > AtPropsWeak
Set of raw '@' locations for 'assign' properties group that contain GC __weak.
MigrationContext(MigrationPass &pass)
bool rewritePropertyAttribute(StringRef fromAttr, StringRef toAttr, SourceLocation atLoc)
void addTraverser(ASTTraverser *traverser)
bool isGCOwnedNonObjC(QualType T)
llvm::DenseSet< SourceLocation > RemovedAttrSet
traverser_iterator traversers_end()
MigrationContext & getMigrationContext()
ObjCImplementationDecl * getImplementationDecl()
ObjCImplementationContext(MigrationContext &MigrateCtx, ObjCImplementationDecl *D)
void traverseObjCImplementation(ObjCImplementationContext &ImplCtx) override
void traverseBody(BodyContext &BodyCtx) override
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
StringRef getNilString(MigrationPass &Pass)
Returns "nil" or "0" if 'nil' macro is not actually defined.
bool hasSideEffects(Expr *E, ASTContext &Ctx)
void removeRetainReleaseDeallocFinalize(MigrationPass &pass)
bool canApplyWeak(ASTContext &Ctx, QualType type, bool AllowOnUnknownClass=false)
Determine whether we can add weak to the given type.
void removeEmptyStatementsAndDeallocFinalize(MigrationPass &pass)
void collectRefs(ValueDecl *D, Stmt *S, ExprSet &refs)
void clearRefsIn(Stmt *S, ExprSet &refs)
llvm::DenseSet< Expr * > ExprSet
void rewriteAutoreleasePool(MigrationPass &pass)
void rewriteUnbridgedCasts(MigrationPass &pass)
void rewriteUnusedInitDelegate(MigrationPass &pass)
bool isPlusOneAssign(const BinaryOperator *E)
void checkAPIUses(MigrationPass &pass)
bool isPlusOne(const Expr *E)
SourceLocation findLocationAfterSemi(SourceLocation loc, ASTContext &Ctx, bool IsDecl=false)
'Loc' is the end of a statement range.
bool isGlobalVar(Expr *E)
void removeZeroOutPropsInDeallocFinalize(MigrationPass &pass)
SourceLocation findSemiAfterLocation(SourceLocation loc, ASTContext &Ctx, bool IsDecl=false)
'Loc' is the end of a statement range.
void makeAssignARCSafe(MigrationPass &pass)
void collectRemovables(Stmt *S, ExprSet &exprs)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
enum clang::arcmt::trans::MigrationContext::GCAttrOccurrence::AttrKind Kind
bool FullyMigratable
true if the attribute is owned, e.g.