10 #ifndef LLVM_CLANG_LIB_ARCMIGRATE_TRANSFORMS_H
11 #define LLVM_CLANG_LIB_ARCMIGRATE_TRANSFORMS_H
15 #include "llvm/ADT/DenseSet.h"
16 #include "llvm/Support/SaveAndRestore.h"
53 : MigrateCtx(MigrateCtx), PMap(S), TopStmt(S) {}
67 : MigrateCtx(MigrateCtx), ImpD(D) {}
82 std::vector<ASTTraverser *> Traversers;
112 Traversers.push_back(traverser);
161 bool AllowOnUnknownClass =
false);
171 bool IsDecl =
false);
178 bool IsDecl =
false);
185 template <
typename BODY_TRANS>
196 BODY_TRANS(Pass).transformBody(rootS, ParentD);
202 return base::TraverseObjCMethodDecl(D);
209 template <
typename iterator>
211 for (; begin != end; ++begin)
BodyContext(MigrationContext &MigrateCtx, Stmt *S)
bool isGCOwnedNonObjC(QualType T)
BodyTransform(MigrationPass &pass)
MigrationContext & getMigrationContext()
traverser_iterator traversers_begin()
void traverseObjCImplementation(ObjCImplementationContext &ImplCtx) override
virtual void traverseObjCImplementation(ObjCImplementationContext &ImplCtx)
bool rewritePropertyAttribute(StringRef fromAttr, StringRef toAttr, SourceLocation atLoc)
void traverse(TranslationUnitDecl *TU)
SourceLocation findSemiAfterLocation(SourceLocation loc, ASTContext &Ctx, bool IsDecl=false)
'Loc' is the end of a statement range. This returns the location of the semicolon following the state...
void makeAssignARCSafe(MigrationPass &pass)
std::vector< ASTTraverser * >::iterator traverser_iterator
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. it is in a body and not just in an interface.
SourceLocation findLocationAfterSemi(SourceLocation loc, ASTContext &Ctx, bool IsDecl=false)
'Loc' is the end of a statement range. This returns the location immediately after the semicolon foll...
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 depth-first traversal on the entire Clang AST and visits each node...
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)
void traverseBody(BodyContext &BodyCtx) override
void removeEmptyStatementsAndDeallocFinalize(MigrationPass &pass)
ObjCImplementationDecl * getImplementationDecl()
void checkAPIUses(MigrationPass &pass)
bool addPropertyAttribute(StringRef attr, SourceLocation atLoc)
bool canApplyWeak(ASTContext &Ctx, QualType type, bool AllowOnUnknownClass=false)
Determine whether we can add weak to the given type.
void traverseBody(BodyContext &BodyCtx) override
void rewriteUnbridgedCasts(MigrationPass &pass)
llvm::DenseSet< unsigned > AttrSet
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
void traverseTU(MigrationContext &MigrateCtx) override
traverser_iterator traversers_end()
bool removePropertyAttribute(StringRef fromAttr, SourceLocation atLoc)
void traverseBody(BodyContext &BodyCtx) override
void collectRefs(ValueDecl *D, Stmt *S, ExprSet &refs)
void addTraverser(ASTTraverser *traverser)
llvm::DenseSet< Expr * > ExprSet
ObjCImplementationContext(MigrationContext &MigrateCtx, ObjCImplementationDecl *D)
void rewriteAutoreleasePool(MigrationPass &pass)
bool hasSideEffects(Expr *E, ASTContext &Ctx)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
bool isPlusOne(const Expr *E)
void removeZeroOutPropsInDeallocFinalize(MigrationPass &pass)
MigrationContext(MigrationPass &pass)
enum clang::arcmt::trans::MigrationContext::GCAttrOccurrence::AttrKind Kind
TranslationUnitDecl - The top declaration context.
llvm::DenseSet< unsigned > AtPropsWeak
Set of raw '@' locations for 'assign' properties group that contain GC __weak.