diff options
Diffstat (limited to 'lib/ARCMigrate/TransUnbridgedCasts.cpp')
-rw-r--r-- | lib/ARCMigrate/TransUnbridgedCasts.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/ARCMigrate/TransUnbridgedCasts.cpp b/lib/ARCMigrate/TransUnbridgedCasts.cpp index 66167d37ac958..9d46d8c5fcae0 100644 --- a/lib/ARCMigrate/TransUnbridgedCasts.cpp +++ b/lib/ARCMigrate/TransUnbridgedCasts.cpp @@ -209,7 +209,7 @@ private: // We will remove the compiler diagnostic. if (!TA.hasDiagnostic(diag::err_arc_mismatched_cast, diag::err_arc_cast_requires_bridge, - E->getLocStart())) { + E->getBeginLoc())) { Trans.abort(); return; } @@ -225,13 +225,12 @@ private: } TA.clearDiagnostic(diag::err_arc_mismatched_cast, - diag::err_arc_cast_requires_bridge, - E->getLocStart()); + diag::err_arc_cast_requires_bridge, E->getBeginLoc()); if (Kind == OBC_Bridge || !Pass.CFBridgingFunctionsDefined()) { if (CStyleCastExpr *CCE = dyn_cast<CStyleCastExpr>(E)) { TA.insertAfterToken(CCE->getLParenLoc(), bridge); } else { - SourceLocation insertLoc = E->getSubExpr()->getLocStart(); + SourceLocation insertLoc = E->getSubExpr()->getBeginLoc(); SmallString<128> newCast; newCast += '('; newCast += bridge; @@ -243,7 +242,7 @@ private: } else { newCast += '('; TA.insert(insertLoc, newCast.str()); - TA.insertAfterToken(E->getLocEnd(), ")"); + TA.insertAfterToken(E->getEndLoc(), ")"); } } } else { @@ -251,7 +250,7 @@ private: SmallString<32> BridgeCall; Expr *WrapE = E->getSubExpr(); - SourceLocation InsertLoc = WrapE->getLocStart(); + SourceLocation InsertLoc = WrapE->getBeginLoc(); SourceManager &SM = Pass.Ctx.getSourceManager(); char PrevChar = *SM.getCharacterData(InsertLoc.getLocWithOffset(-1)); @@ -268,7 +267,7 @@ private: } else { BridgeCall += '('; TA.insert(InsertLoc, BridgeCall); - TA.insertAfterToken(WrapE->getLocEnd(), ")"); + TA.insertAfterToken(WrapE->getEndLoc(), ")"); } } } @@ -368,19 +367,19 @@ private: err += family == OMF_autorelease ? "autorelease" : "release"; err += "' message; a __bridge cast may result in a pointer to a " "destroyed object and a __bridge_retained may leak the object"; - Pass.TA.reportError(err, E->getLocStart(), + Pass.TA.reportError(err, E->getBeginLoc(), E->getSubExpr()->getSourceRange()); Stmt *parent = E; do { parent = StmtMap->getParentIgnoreParenImpCasts(parent); - } while (parent && isa<ExprWithCleanups>(parent)); + } while (parent && isa<FullExpr>(parent)); if (ReturnStmt *retS = dyn_cast_or_null<ReturnStmt>(parent)) { std::string note = "remove the cast and change return type of function " "to '"; note += E->getSubExpr()->getType().getAsString(Pass.Ctx.getPrintingPolicy()); note += "' to have the object automatically autoreleased"; - Pass.TA.reportNote(note, retS->getLocStart()); + Pass.TA.reportNote(note, retS->getBeginLoc()); } } |