diff options
author | Stephen Kelly <steveire@gmail.com> | 2018-08-09 22:43:02 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2018-08-09 22:43:02 +0000 |
commit | a32ea61ae09dc772fd7f688a89a0bd07c1bcc4f1 (patch) | |
tree | 52290d59333c69de31f8ddc393a17610db34b879 /clang-tidy/readability | |
parent | 4cacbf2c444f87871805c14748142cd9d92ff716 (diff) |
Port getLocEnd -> getEndLoc
Subscribers: nemanjai, ioeric, kbarton, cfe-commits
Differential Revision: https://reviews.llvm.org/D50355
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@339401 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/readability')
10 files changed, 16 insertions, 16 deletions
diff --git a/clang-tidy/readability/AvoidConstParamsInDecls.cpp b/clang-tidy/readability/AvoidConstParamsInDecls.cpp index 8b221881..51fc4895 100644 --- a/clang-tidy/readability/AvoidConstParamsInDecls.cpp +++ b/clang-tidy/readability/AvoidConstParamsInDecls.cpp @@ -23,7 +23,7 @@ namespace { SourceRange getTypeRange(const ParmVarDecl &Param) { if (Param.getIdentifier() != nullptr) return SourceRange(Param.getBeginLoc(), - Param.getLocEnd().getLocWithOffset(-1)); + Param.getEndLoc().getLocWithOffset(-1)); return Param.getSourceRange(); } @@ -97,7 +97,7 @@ void AvoidConstParamsInDecls::check(const MatchFinder::MatchResult &Result) { Diag << Param; } - if (Param->getBeginLoc().isMacroID() != Param->getLocEnd().isMacroID()) { + if (Param->getBeginLoc().isMacroID() != Param->getEndLoc().isMacroID()) { // Do not offer a suggestion if the part of the variable declaration comes // from a macro. return; diff --git a/clang-tidy/readability/BracesAroundStatementsCheck.cpp b/clang-tidy/readability/BracesAroundStatementsCheck.cpp index a29e68a3..5f5294c2 100644 --- a/clang-tidy/readability/BracesAroundStatementsCheck.cpp +++ b/clang-tidy/readability/BracesAroundStatementsCheck.cpp @@ -177,9 +177,9 @@ BracesAroundStatementsCheck::findRParenLoc(const IfOrWhileStmt *S, if (S->getBeginLoc().isMacroID()) return SourceLocation(); - SourceLocation CondEndLoc = S->getCond()->getLocEnd(); + SourceLocation CondEndLoc = S->getCond()->getEndLoc(); if (const DeclStmt *CondVar = S->getConditionVariableDeclStmt()) - CondEndLoc = CondVar->getLocEnd(); + CondEndLoc = CondVar->getEndLoc(); if (!CondEndLoc.isValid()) { return SourceLocation(); diff --git a/clang-tidy/readability/DeleteNullPointerCheck.cpp b/clang-tidy/readability/DeleteNullPointerCheck.cpp index 4d3188c4..02b9bbe8 100644 --- a/clang-tidy/readability/DeleteNullPointerCheck.cpp +++ b/clang-tidy/readability/DeleteNullPointerCheck.cpp @@ -63,7 +63,7 @@ void DeleteNullPointerCheck::check(const MatchFinder::MatchResult &Result) { Diag << FixItHint::CreateRemoval(CharSourceRange::getTokenRange( IfWithDelete->getBeginLoc(), - Lexer::getLocForEndOfToken(IfWithDelete->getCond()->getLocEnd(), 0, + Lexer::getLocForEndOfToken(IfWithDelete->getCond()->getEndLoc(), 0, *Result.SourceManager, Result.Context->getLangOpts()))); if (Compound) { diff --git a/clang-tidy/readability/FunctionSizeCheck.cpp b/clang-tidy/readability/FunctionSizeCheck.cpp index b1ceea11..9547afb8 100644 --- a/clang-tidy/readability/FunctionSizeCheck.cpp +++ b/clang-tidy/readability/FunctionSizeCheck.cpp @@ -162,8 +162,8 @@ void FunctionSizeCheck::check(const MatchFinder::MatchResult &Result) { // Count the lines including whitespace and comments. Really simple. if (const Stmt *Body = Func->getBody()) { SourceManager *SM = Result.SourceManager; - if (SM->isWrittenInSameFile(Body->getBeginLoc(), Body->getLocEnd())) { - FI.Lines = SM->getSpellingLineNumber(Body->getLocEnd()) - + if (SM->isWrittenInSameFile(Body->getBeginLoc(), Body->getEndLoc())) { + FI.Lines = SM->getSpellingLineNumber(Body->getEndLoc()) - SM->getSpellingLineNumber(Body->getBeginLoc()); } } diff --git a/clang-tidy/readability/ImplicitBoolConversionCheck.cpp b/clang-tidy/readability/ImplicitBoolConversionCheck.cpp index 2a449ff6..e88c1436 100644 --- a/clang-tidy/readability/ImplicitBoolConversionCheck.cpp +++ b/clang-tidy/readability/ImplicitBoolConversionCheck.cpp @@ -145,7 +145,7 @@ void fixGenericExprCastToBool(DiagnosticBuilder &Diag, } SourceLocation EndLoc = Lexer::getLocForEndOfToken( - Cast->getLocEnd(), 0, Context.getSourceManager(), Context.getLangOpts()); + Cast->getEndLoc(), 0, Context.getSourceManager(), Context.getLangOpts()); Diag << FixItHint::CreateInsertion(EndLoc, EndLocInsertion); } @@ -189,7 +189,7 @@ void fixGenericExprCastFromBool(DiagnosticBuilder &Diag, if (NeedParens) { SourceLocation EndLoc = Lexer::getLocForEndOfToken( - Cast->getLocEnd(), 0, Context.getSourceManager(), + Cast->getEndLoc(), 0, Context.getSourceManager(), Context.getLangOpts()); Diag << FixItHint::CreateInsertion(EndLoc, ")"); diff --git a/clang-tidy/readability/MisleadingIndentationCheck.cpp b/clang-tidy/readability/MisleadingIndentationCheck.cpp index 5abace50..9791531f 100644 --- a/clang-tidy/readability/MisleadingIndentationCheck.cpp +++ b/clang-tidy/readability/MisleadingIndentationCheck.cpp @@ -40,7 +40,7 @@ void MisleadingIndentationCheck::danglingElseCheck(const SourceManager &SM, if (IfLoc.isMacroID() || ElseLoc.isMacroID()) return; - if (SM.getExpansionLineNumber(If->getThen()->getLocEnd()) == + if (SM.getExpansionLineNumber(If->getThen()->getEndLoc()) == SM.getExpansionLineNumber(ElseLoc)) return; diff --git a/clang-tidy/readability/RedundantControlFlowCheck.cpp b/clang-tidy/readability/RedundantControlFlowCheck.cpp index 0788c42e..d5898ed9 100644 --- a/clang-tidy/readability/RedundantControlFlowCheck.cpp +++ b/clang-tidy/readability/RedundantControlFlowCheck.cpp @@ -81,7 +81,7 @@ void RedundantControlFlowCheck::issueDiagnostic( SourceLocation Start; if (Previous != Block->body_rend()) Start = Lexer::findLocationAfterToken( - dyn_cast<Stmt>(*Previous)->getLocEnd(), tok::semi, SM, getLangOpts(), + dyn_cast<Stmt>(*Previous)->getEndLoc(), tok::semi, SM, getLangOpts(), /*SkipTrailingWhitespaceAndNewLine=*/true); if (!Start.isValid()) Start = StmtRange.getBegin(); diff --git a/clang-tidy/readability/SimplifyBooleanExprCheck.cpp b/clang-tidy/readability/SimplifyBooleanExprCheck.cpp index 97243a9d..9420c6c3 100644 --- a/clang-tidy/readability/SimplifyBooleanExprCheck.cpp +++ b/clang-tidy/readability/SimplifyBooleanExprCheck.cpp @@ -385,7 +385,7 @@ void SimplifyBooleanExprCheck::reportBinOp( const Expr *ReplaceWith, bool Negated) { std::string Replacement = replacementExpression(Result, Negated, ReplaceWith); - SourceRange Range(LHS->getBeginLoc(), RHS->getLocEnd()); + SourceRange Range(LHS->getBeginLoc(), RHS->getEndLoc()); issueDiag(Result, Bool->getBeginLoc(), SimplifyOperatorDiagnostic, Range, Replacement); }; @@ -641,7 +641,7 @@ void SimplifyBooleanExprCheck::replaceCompoundReturnWithCondition( "return " + replacementExpression(Result, Negated, Condition); issueDiag( Result, Lit->getBeginLoc(), SimplifyConditionalReturnDiagnostic, - SourceRange(If->getBeginLoc(), Ret->getLocEnd()), Replacement); + SourceRange(If->getBeginLoc(), Ret->getEndLoc()), Replacement); return; } diff --git a/clang-tidy/readability/SimplifySubscriptExprCheck.cpp b/clang-tidy/readability/SimplifySubscriptExprCheck.cpp index 036489f3..f4c306e9 100644 --- a/clang-tidy/readability/SimplifySubscriptExprCheck.cpp +++ b/clang-tidy/readability/SimplifySubscriptExprCheck.cpp @@ -63,7 +63,7 @@ void SimplifySubscriptExprCheck::check(const MatchFinder::MatchResult &Result) { DiagBuilder << FixItHint::CreateInsertion(Member->getBeginLoc(), "(*") << FixItHint::CreateInsertion(Member->getOperatorLoc(), ")"); DiagBuilder << FixItHint::CreateRemoval( - {Member->getOperatorLoc(), Call->getLocEnd()}); + {Member->getOperatorLoc(), Call->getEndLoc()}); } void SimplifySubscriptExprCheck::storeOptions( diff --git a/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp b/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp index 4476f370..bb2c6901 100644 --- a/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp +++ b/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp @@ -52,7 +52,7 @@ void UniqueptrDeleteReleaseCheck::check( return; SourceLocation AfterPtr = Lexer::getLocForEndOfToken( - PtrExpr->getLocEnd(), 0, *Result.SourceManager, getLangOpts()); + PtrExpr->getEndLoc(), 0, *Result.SourceManager, getLangOpts()); diag(DeleteExpr->getBeginLoc(), "prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> " @@ -60,7 +60,7 @@ void UniqueptrDeleteReleaseCheck::check( << FixItHint::CreateRemoval(CharSourceRange::getCharRange( DeleteExpr->getBeginLoc(), PtrExpr->getBeginLoc())) << FixItHint::CreateReplacement( - CharSourceRange::getTokenRange(AfterPtr, DeleteExpr->getLocEnd()), + CharSourceRange::getTokenRange(AfterPtr, DeleteExpr->getEndLoc()), " = nullptr"); } |