15 using namespace clang;
16 using namespace arcmt;
17 using namespace trans;
21 class GCCollectableCallsChecker :
31 NSMakeCollectableII = &Ids.
get(
"NSMakeCollectable");
32 CFMakeCollectableII = &Ids.
get(
"CFMakeCollectable");
35 bool shouldWalkTypesOfTypeLocs()
const {
return false; }
40 if (MigrateCtx.isGCOwnedNonObjC(E->
getType())) {
47 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(CEE)) {
48 if (
FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(DRE->getDecl())) {
49 if (!FD->getDeclContext()->getRedeclContext()->isFileContext())
52 if (FD->getIdentifier() == NSMakeCollectableII) {
55 diag::err_unavailable_message,
56 diag::err_ovl_deleted_call,
57 DRE->getSourceRange());
58 TA.
replace(DRE->getSourceRange(),
"CFBridgingRelease");
60 }
else if (FD->getIdentifier() == CFMakeCollectableII) {
61 TA.
reportError(
"CFMakeCollectable will leak the object that it "
62 "receives in ARC", DRE->getLocation(),
63 DRE->getSourceRange());
Defines the clang::ASTContext interface.
const Expr * getCallee() const
MigrationContext & getMigrationContext()
A class that does preorder depth-first traversal on the entire Clang AST and visits each node...
Implements an efficient mapping from strings to IdentifierInfo nodes.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
void traverseBody(BodyContext &BodyCtx) override
Expr * IgnoreParenImpCasts() LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].