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);
160 bool AllowOnUnknownClass =
false);
170 bool IsDecl =
false);
177 bool IsDecl =
false);
184template <
typename BODY_TRANS>
195 BODY_TRANS(Pass).transformBody(rootS, ParentD);
201 return base::TraverseObjCMethodDecl(
D);
208template <
typename iterator>
210 for (; begin != end; ++begin)
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.