From 2dfd8132cf7984a86fd4cfc9d84f2195d60205ef Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 9 Aug 2018 21:09:38 +0000 Subject: Port getLocEnd -> getEndLoc Reviewers: teemperor! Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50351 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339386 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ARCMigrate/ObjCMT.cpp | 33 +++++++++++++++++---------------- lib/ARCMigrate/TransAutoreleasePool.cpp | 10 +++++----- lib/ARCMigrate/TransProtectedScope.cpp | 2 +- lib/ARCMigrate/TransUnbridgedCasts.cpp | 4 ++-- 4 files changed, 25 insertions(+), 24 deletions(-) (limited to 'lib/ARCMigrate') diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp index 038101ae4a..f86c82699b 100644 --- a/lib/ARCMigrate/ObjCMT.cpp +++ b/lib/ARCMigrate/ObjCMT.cpp @@ -261,7 +261,7 @@ namespace { if (IsGetter) { // Find space location range between receiver expression and getter method. SourceLocation BegLoc = - ReceiverIsSuper ? Msg->getSuperLoc() : receiver->getLocEnd(); + ReceiverIsSuper ? Msg->getSuperLoc() : receiver->getEndLoc(); BegLoc = PP.getLocForEndOfToken(BegLoc); SourceLocation EndLoc = Msg->getSelectorLoc(0); SourceRange SpaceRange(BegLoc, EndLoc); @@ -291,7 +291,7 @@ namespace { if (!RHS) return false; SourceLocation BegLoc = - ReceiverIsSuper ? Msg->getSuperLoc() : receiver->getLocEnd(); + ReceiverIsSuper ? Msg->getSuperLoc() : receiver->getEndLoc(); BegLoc = PP.getLocForEndOfToken(BegLoc); SourceLocation EndLoc = RHS->getBeginLoc(); EndLoc = EndLoc.getLocWithOffset(-1); @@ -722,7 +722,7 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl, ClassString += ')'; SourceRange R(EnumDcl->getBeginLoc(), EnumDcl->getBeginLoc()); commit.replace(R, ClassString); - SourceLocation EndOfEnumDclLoc = EnumDcl->getLocEnd(); + SourceLocation EndOfEnumDclLoc = EnumDcl->getEndLoc(); EndOfEnumDclLoc = trans::findSemiAfterLocation(EndOfEnumDclLoc, NS.getASTContext(), /*IsDecl*/true); if (EndOfEnumDclLoc.isValid()) { @@ -732,7 +732,7 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl, else return false; - SourceLocation EndTypedefDclLoc = TypedefDcl->getLocEnd(); + SourceLocation EndTypedefDclLoc = TypedefDcl->getEndLoc(); EndTypedefDclLoc = trans::findSemiAfterLocation(EndTypedefDclLoc, NS.getASTContext(), /*IsDecl*/true); if (EndTypedefDclLoc.isValid()) { @@ -742,8 +742,9 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl, else return false; - EndOfEnumDclLoc = trans::findLocationAfterSemi(EnumDcl->getLocEnd(), NS.getASTContext(), - /*IsDecl*/true); + EndOfEnumDclLoc = + trans::findLocationAfterSemi(EnumDcl->getEndLoc(), NS.getASTContext(), + /*IsDecl*/ true); if (EndOfEnumDclLoc.isValid()) { SourceLocation BeginOfEnumDclLoc = EnumDcl->getBeginLoc(); // FIXME. This assumes that enum decl; is immediately preceded by eoln. @@ -779,9 +780,9 @@ static void rewriteToNSMacroDecl(ASTContext &Ctx, CharSourceRange::getCharRange(EnumDcl->getBeginLoc(), EndLoc); commit.replace(R, ClassString); // This is to remove spaces between '}' and typedef name. - SourceLocation StartTypedefLoc = EnumDcl->getLocEnd(); + SourceLocation StartTypedefLoc = EnumDcl->getEndLoc(); StartTypedefLoc = StartTypedefLoc.getLocWithOffset(+1); - SourceLocation EndTypedefLoc = TypedefDcl->getLocEnd(); + SourceLocation EndTypedefLoc = TypedefDcl->getEndLoc(); commit.remove(SourceRange(StartTypedefLoc, EndTypedefLoc)); } @@ -812,7 +813,7 @@ static bool UseNSOptionsMacro(Preprocessor &PP, ASTContext &Ctx, } if (AllHexdecimalEnumerator && EnumVal) { bool FoundHexdecimalEnumerator = false; - SourceLocation EndLoc = Enumerator->getLocEnd(); + SourceLocation EndLoc = Enumerator->getEndLoc(); Token Tok; if (!PP.getRawToken(EndLoc, Tok, /*IgnoreWhiteSpace=*/true)) if (Tok.isLiteral() && Tok.getLength() > 2) { @@ -1258,7 +1259,7 @@ void ObjCMigrateASTConsumer::migrateNsReturnsInnerPointer(ASTContext &Ctx, return; edit::Commit commit(*Editor); - commit.insertBefore(OM->getLocEnd(), " NS_RETURNS_INNER_POINTER"); + commit.insertBefore(OM->getEndLoc(), " NS_RETURNS_INNER_POINTER"); Editor->commit(commit); } @@ -1270,7 +1271,7 @@ void ObjCMigrateASTConsumer::migratePropertyNsReturnsInnerPointer(ASTContext &Ct !NSAPIObj->isMacroDefined("NS_RETURNS_INNER_POINTER")) return; edit::Commit commit(*Editor); - commit.insertBefore(P->getLocEnd(), " NS_RETURNS_INNER_POINTER "); + commit.insertBefore(P->getEndLoc(), " NS_RETURNS_INNER_POINTER "); Editor->commit(commit); } @@ -1398,7 +1399,7 @@ void ObjCMigrateASTConsumer::AnnotateImplicitBridging(ASTContext &Ctx) { edit::Commit commit(*Editor); commit.insertBefore(FirstFD->getBeginLoc(), PragmaString); PragmaString = "\n\nCF_IMPLICIT_BRIDGING_DISABLED\n"; - SourceLocation EndLoc = LastFD->getLocEnd(); + SourceLocation EndLoc = LastFD->getEndLoc(); // get location just past end of function location. EndLoc = PP.getLocForEndOfToken(EndLoc); if (isa(LastFD)) { @@ -1473,7 +1474,7 @@ void ObjCMigrateASTConsumer::AddCFAnnotations(ASTContext &Ctx, if (AnnotationString) { edit::Commit commit(*Editor); - commit.insertAfterToken(FuncDecl->getLocEnd(), AnnotationString); + commit.insertAfterToken(FuncDecl->getEndLoc(), AnnotationString); Editor->commit(commit); } } @@ -1599,7 +1600,7 @@ void ObjCMigrateASTConsumer::AddCFAnnotations(ASTContext &Ctx, if (AnnotationString) { edit::Commit commit(*Editor); - commit.insertBefore(MethodDecl->getLocEnd(), AnnotationString); + commit.insertBefore(MethodDecl->getEndLoc(), AnnotationString); Editor->commit(commit); } } @@ -1637,7 +1638,7 @@ void ObjCMigrateASTConsumer::migrateAddMethodAnnotation( MethodDecl->getMethodFamily() != OMF_release && NSAPIObj->isMacroDefined("NS_CONSUMES_SELF")) { edit::Commit commit(*Editor); - commit.insertBefore(MethodDecl->getLocEnd(), " NS_CONSUMES_SELF"); + commit.insertBefore(MethodDecl->getEndLoc(), " NS_CONSUMES_SELF"); Editor->commit(commit); } @@ -1714,7 +1715,7 @@ void ObjCMigrateASTConsumer::inferDesignatedInitializers( continue; if (hasSuperInitCall(MD)) { edit::Commit commit(*Editor); - commit.insert(IFaceM->getLocEnd(), " NS_DESIGNATED_INITIALIZER"); + commit.insert(IFaceM->getEndLoc(), " NS_DESIGNATED_INITIALIZER"); Editor->commit(commit); } } diff --git a/lib/ARCMigrate/TransAutoreleasePool.cpp b/lib/ARCMigrate/TransAutoreleasePool.cpp index 09064026f1..1acf63cc2b 100644 --- a/lib/ARCMigrate/TransAutoreleasePool.cpp +++ b/lib/ARCMigrate/TransAutoreleasePool.cpp @@ -128,15 +128,15 @@ public: Pass.TA.removeStmt(*scope.End); Stmt::child_iterator retI = scope.End; ++retI; - SourceLocation afterSemi = findLocationAfterSemi((*retI)->getLocEnd(), - Pass.Ctx); + SourceLocation afterSemi = + findLocationAfterSemi((*retI)->getEndLoc(), Pass.Ctx); assert(afterSemi.isValid() && "Didn't we check before setting IsFollowedBySimpleReturnStmt " "to true?"); Pass.TA.insertAfterToken(afterSemi, "\n}"); Pass.TA.increaseIndentation( SourceRange(scope.getIndentedRange().getBegin(), - (*retI)->getLocEnd()), + (*retI)->getEndLoc()), scope.CompoundParent->getBeginLoc()); } else { Pass.TA.replaceStmt(*scope.Begin, "@autoreleasepool {"); @@ -241,7 +241,7 @@ private: Stmt::child_iterator rangeE = Begin; for (Stmt::child_iterator I = rangeS; I != End; ++I) ++rangeE; - return SourceRange((*rangeS)->getBeginLoc(), (*rangeE)->getLocEnd()); + return SourceRange((*rangeS)->getBeginLoc(), (*rangeE)->getEndLoc()); } }; @@ -307,7 +307,7 @@ private: if (ReturnStmt *retS = dyn_cast(*SI)) if ((retS->getRetValue() == nullptr || isa(retS->getRetValue()->IgnoreParenCasts())) && - findLocationAfterSemi(retS->getLocEnd(), Pass.Ctx).isValid()) { + findLocationAfterSemi(retS->getEndLoc(), Pass.Ctx).isValid()) { scope.IsFollowedBySimpleReturnStmt = true; ++SI; // the return will be included in scope, don't check it. } diff --git a/lib/ARCMigrate/TransProtectedScope.cpp b/lib/ARCMigrate/TransProtectedScope.cpp index e9485e4bdb..bfc542e749 100644 --- a/lib/ARCMigrate/TransProtectedScope.cpp +++ b/lib/ARCMigrate/TransProtectedScope.cpp @@ -73,7 +73,7 @@ public: Curr = Curr->getNextSwitchCase(); } - SourceLocation NextLoc = S->getLocEnd(); + SourceLocation NextLoc = S->getEndLoc(); Curr = S->getSwitchCaseList(); // We iterate over case statements in reverse source-order. while (Curr) { diff --git a/lib/ARCMigrate/TransUnbridgedCasts.cpp b/lib/ARCMigrate/TransUnbridgedCasts.cpp index 0a7d124537..631eceb03f 100644 --- a/lib/ARCMigrate/TransUnbridgedCasts.cpp +++ b/lib/ARCMigrate/TransUnbridgedCasts.cpp @@ -242,7 +242,7 @@ private: } else { newCast += '('; TA.insert(insertLoc, newCast.str()); - TA.insertAfterToken(E->getLocEnd(), ")"); + TA.insertAfterToken(E->getEndLoc(), ")"); } } } else { @@ -267,7 +267,7 @@ private: } else { BridgeCall += '('; TA.insert(InsertLoc, BridgeCall); - TA.insertAfterToken(WrapE->getLocEnd(), ")"); + TA.insertAfterToken(WrapE->getEndLoc(), ")"); } } } -- cgit v1.2.1