9 #ifndef LLVM_CLANG_LIB_ARCMIGRATE_TRANSFORMS_H 10 #define LLVM_CLANG_LIB_ARCMIGRATE_TRANSFORMS_H 14 #include "llvm/ADT/DenseSet.h" 15 #include "llvm/Support/SaveAndRestore.h" 52 : MigrateCtx(MigrateCtx), PMap(S), TopStmt(S) {}
66 : MigrateCtx(MigrateCtx), ImpD(D) {}
81 std::vector<ASTTraverser *> Traversers;
111 Traversers.push_back(traverser);
116 return rewritePropertyAttribute(fromAttr, StringRef(), atLoc);
118 bool rewritePropertyAttribute(StringRef fromAttr, StringRef toAttr,
160 bool AllowOnUnknownClass =
false);
170 bool IsDecl =
false);
177 bool IsDecl =
false);
184 template <
typename BODY_TRANS>
195 BODY_TRANS(Pass).transformBody(rootS, ParentD);
201 return base::TraverseObjCMethodDecl(D);
208 template <
typename iterator>
210 for (; begin != end; ++begin)
BodyContext(MigrationContext &MigrateCtx, Stmt *S)
A (possibly-)qualified type.
Stmt - This represents one statement.
Decl - This represents one declaration (or definition), e.g.
BodyTransform(MigrationPass &pass)
MigrationContext & getMigrationContext()
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
traverser_iterator traversers_begin()
virtual void traverseObjCImplementation(ObjCImplementationContext &ImplCtx)
SourceLocation findSemiAfterLocation(SourceLocation loc, ASTContext &Ctx, bool IsDecl=false)
'Loc' is the end of a statement range.
void makeAssignARCSafe(MigrationPass &pass)
std::vector< ASTTraverser * >::iterator traverser_iterator
ObjCMethodDecl - Represents an instance or class method declaration.
std::vector< GCAttrOccurrence > GCAttrs
void clearRefsIn(Stmt *S, ExprSet &refs)
ParentMap & getParentMap()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool TraverseObjCMethodDecl(ObjCMethodDecl *D)
bool isGlobalVar(Expr *E)
bool FullyMigratable
true if the attribute is owned, e.g.
SourceLocation findLocationAfterSemi(SourceLocation loc, ASTContext &Ctx, bool IsDecl=false)
'Loc' is the end of a statement range.
void removeRetainReleaseDeallocFinalize(MigrationPass &pass)
MigrationContext & getMigrationContext()
bool TraverseStmt(Stmt *rootS)
A builtin binary operation expression such as "x + y" or "x <= y".
void rewriteUnusedInitDelegate(MigrationPass &pass)
virtual void traverseBody(BodyContext &BodyCtx)
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
bool isPlusOneAssign(const BinaryOperator *E)
virtual void traverseTU(MigrationContext &MigrateCtx)
StringRef getNilString(MigrationPass &Pass)
Returns "nil" or "0" if 'nil' macro is not actually defined.
llvm::DenseSet< unsigned > RemovedAttrSet
void collectRemovables(Stmt *S, ExprSet &exprs)
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
void removeEmptyStatementsAndDeallocFinalize(MigrationPass &pass)
ObjCImplementationDecl * getImplementationDecl()
void checkAPIUses(MigrationPass &pass)
bool canApplyWeak(ASTContext &Ctx, QualType type, bool AllowOnUnknownClass=false)
Determine whether we can add weak to the given type.
void rewriteUnbridgedCasts(MigrationPass &pass)
llvm::DenseSet< unsigned > AttrSet
Encodes a location in the source.
traverser_iterator traversers_end()
bool removePropertyAttribute(StringRef fromAttr, SourceLocation atLoc)
void collectRefs(ValueDecl *D, Stmt *S, ExprSet &refs)
void addTraverser(ASTTraverser *traverser)
llvm::DenseSet< Expr * > ExprSet
Dataflow Directional Tag Classes.
ObjCImplementationContext(MigrationContext &MigrateCtx, ObjCImplementationDecl *D)
void rewriteAutoreleasePool(MigrationPass &pass)
bool hasSideEffects(Expr *E, ASTContext &Ctx)
bool isPlusOne(const Expr *E)
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
void removeZeroOutPropsInDeallocFinalize(MigrationPass &pass)
MigrationContext(MigrationPass &pass)
The top declaration context.
llvm::DenseSet< unsigned > AtPropsWeak
Set of raw '@' locations for 'assign' properties group that contain GC __weak.