summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/bugprone
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/bugprone')
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp6
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/CopyConstructorInitCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp5
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp6
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp8
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/SizeofContainerCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp28
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/StringLiteralWithEmbeddedNulCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp6
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp17
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/SwappedArgumentsCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/TerminatingContinueCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/UndefinedMemoryManipulationCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/VirtualNearMissCheck.cpp2
29 files changed, 67 insertions, 65 deletions
diff --git a/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
index a8da703edad..34d1712e25e 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
@@ -242,7 +242,7 @@ void ArgumentCommentCheck::checkCallArgs(ASTContext *Ctx,
}
CharSourceRange BeforeArgument =
- makeFileCharRange(ArgBeginLoc, Args[I]->getLocStart());
+ makeFileCharRange(ArgBeginLoc, Args[I]->getBeginLoc());
ArgBeginLoc = Args[I]->getLocEnd();
std::vector<std::pair<SourceLocation, StringRef>> Comments;
@@ -251,7 +251,7 @@ void ArgumentCommentCheck::checkCallArgs(ASTContext *Ctx,
} else {
// Fall back to parsing back from the start of the argument.
CharSourceRange ArgsRange = makeFileCharRange(
- Args[I]->getLocStart(), Args[NumArgs - 1]->getLocEnd());
+ Args[I]->getBeginLoc(), Args[NumArgs - 1]->getLocEnd());
Comments = getCommentsBeforeLoc(Ctx, ArgsRange.getBegin());
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
index 244e7552164..c747980b909 100644
--- a/clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
@@ -102,7 +102,7 @@ void AssertSideEffectCheck::registerMatchers(MatchFinder *Finder) {
void AssertSideEffectCheck::check(const MatchFinder::MatchResult &Result) {
const SourceManager &SM = *Result.SourceManager;
const LangOptions LangOpts = getLangOpts();
- SourceLocation Loc = Result.Nodes.getNodeAs<Stmt>("condStmt")->getLocStart();
+ SourceLocation Loc = Result.Nodes.getNodeAs<Stmt>("condStmt")->getBeginLoc();
StringRef AssertMacroName;
while (Loc.isValid() && Loc.isMacroID()) {
diff --git a/clang-tools-extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp
index ed2c2db952f..5f33697d6cd 100644
--- a/clang-tools-extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp
@@ -36,7 +36,7 @@ void BoolPointerImplicitConversionCheck::check(
auto *Var = Result.Nodes.getNodeAs<DeclRefExpr>("expr");
// Ignore macros.
- if (Var->getLocStart().isMacroID())
+ if (Var->getBeginLoc().isMacroID())
return;
// Only allow variable accesses for now, no function calls or member exprs.
@@ -63,9 +63,9 @@ void BoolPointerImplicitConversionCheck::check(
.empty())
return;
- diag(Var->getLocStart(), "dubious check of 'bool *' against 'nullptr', did "
+ diag(Var->getBeginLoc(), "dubious check of 'bool *' against 'nullptr', did "
"you mean to dereference it?")
- << FixItHint::CreateInsertion(Var->getLocStart(), "*");
+ << FixItHint::CreateInsertion(Var->getBeginLoc(), "*");
}
} // namespace bugprone
diff --git a/clang-tools-extra/clang-tidy/bugprone/CopyConstructorInitCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/CopyConstructorInitCheck.cpp
index 151e56c0769..170ce45251a 100644
--- a/clang-tools-extra/clang-tidy/bugprone/CopyConstructorInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/CopyConstructorInitCheck.cpp
@@ -104,7 +104,7 @@ void CopyConstructorInitCheck::check(const MatchFinder::MatchResult &Result) {
SourceLocation FixItLoc;
// There is no initialization list in this constructor.
if (!HasWrittenInitializer) {
- FixItLoc = Ctor->getBody()->getLocStart();
+ FixItLoc = Ctor->getBody()->getBeginLoc();
FixItMsg = " : " + FixItMsg;
} else {
// We apply the missing ctors at the beginning of the initialization list.
diff --git a/clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp
index a22dcad6581..81b799ede6f 100644
--- a/clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp
@@ -178,7 +178,7 @@ void DanglingHandleCheck::registerMatchers(MatchFinder *Finder) {
void DanglingHandleCheck::check(const MatchFinder::MatchResult &Result) {
auto *Handle = Result.Nodes.getNodeAs<CXXRecordDecl>("handle");
- diag(Result.Nodes.getNodeAs<Stmt>("bad_stmt")->getLocStart(),
+ diag(Result.Nodes.getNodeAs<Stmt>("bad_stmt")->getBeginLoc(),
"%0 outlives its value")
<< Handle->getQualifiedNameAsString();
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
index cf1be0e7b30..02d23c49920 100644
--- a/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
@@ -57,7 +57,7 @@ void InaccurateEraseCheck::check(const MatchFinder::MatchResult &Result) {
Result.Nodes.getNodeAs<CXXMemberCallExpr>("erase");
const auto *EndExpr =
Result.Nodes.getNodeAs<CXXMemberCallExpr>("end");
- const SourceLocation Loc = MemberCall->getLocStart();
+ const SourceLocation Loc = MemberCall->getBeginLoc();
FixItHint Hint;
diff --git a/clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
index ab7b28d69f4..549799f1ea9 100644
--- a/clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
@@ -61,7 +61,7 @@ void IncorrectRoundingsCheck::registerMatchers(MatchFinder *MatchFinder) {
void IncorrectRoundingsCheck::check(const MatchFinder::MatchResult &Result) {
const auto *CastExpr = Result.Nodes.getNodeAs<ImplicitCastExpr>("CastExpr");
- diag(CastExpr->getLocStart(),
+ diag(CastExpr->getBeginLoc(),
"casting (double + 0.5) to integer leads to incorrect rounding; "
"consider using lround (#include <cmath>) instead");
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp
index 1b4eaeabb4f..094d9913243 100644
--- a/clang-tools-extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp
@@ -48,7 +48,7 @@ void IntegerDivisionCheck::registerMatchers(MatchFinder *Finder) {
void IntegerDivisionCheck::check(const MatchFinder::MatchResult &Result) {
const auto *IntDiv = Result.Nodes.getNodeAs<BinaryOperator>("IntDiv");
- diag(IntDiv->getLocStart(), "result of integer division used in a floating "
+ diag(IntDiv->getBeginLoc(), "result of integer division used in a floating "
"point context; possible loss of precision");
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp
index f8db0b3ef94..25544a503bf 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp
@@ -102,9 +102,10 @@ void MisplacedOperatorInStrlenInAllocCheck::check(
StrLen->getSourceRange(),
(StrLenBegin + LHSText + StrLenEnd + " + " + RHSText).str());
- diag(Alloc->getLocStart(),
+ diag(Alloc->getBeginLoc(),
"addition operator is applied to the argument of %0 instead of its "
- "result") << StrLen->getDirectCallee()->getName() << Hint;
+ "result")
+ << StrLen->getDirectCallee()->getName() << Hint;
}
} // namespace bugprone
diff --git a/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp
index e263366b664..b9cbfebe8d9 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp
@@ -185,11 +185,11 @@ void MisplacedWideningCastCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Cast = Result.Nodes.getNodeAs<CastExpr>("Cast");
if (!CheckImplicitCasts && isa<ImplicitCastExpr>(Cast))
return;
- if (Cast->getLocStart().isMacroID())
+ if (Cast->getBeginLoc().isMacroID())
return;
const auto *Calc = Result.Nodes.getNodeAs<Expr>("Calc");
- if (Calc->getLocStart().isMacroID())
+ if (Calc->getBeginLoc().isMacroID())
return;
if (Cast->isTypeDependent() || Cast->isValueDependent() ||
@@ -223,7 +223,7 @@ void MisplacedWideningCastCheck::check(const MatchFinder::MatchResult &Result) {
if (Context.getIntWidth(CalcType) >= getMaxCalculationWidth(Context, Calc))
return;
- diag(Cast->getLocStart(), "either cast from %0 to %1 is ineffective, or "
+ diag(Cast->getBeginLoc(), "either cast from %0 to %1 is ineffective, or "
"there is loss of precision before the conversion")
<< CalcType << CastType;
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp
index 516ee193033..9699250bbdf 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp
@@ -29,7 +29,7 @@ static void replaceMoveWithForward(const UnresolvedLookupExpr *Callee,
CharSourceRange CallRange =
Lexer::makeFileCharRange(CharSourceRange::getTokenRange(
- Callee->getLocStart(), Callee->getLocEnd()),
+ Callee->getBeginLoc(), Callee->getLocEnd()),
SM, LangOpts);
if (CallRange.isValid()) {
diff --git a/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp
index 942c8752f35..5c498213df2 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp
@@ -19,7 +19,7 @@ namespace bugprone {
namespace {
-AST_MATCHER(Expr, isInMacro) { return Node.getLocStart().isMacroID(); }
+AST_MATCHER(Expr, isInMacro) { return Node.getBeginLoc().isMacroID(); }
/// \brief Find the next statement after `S`.
const Stmt *nextStmt(const MatchFinder::MatchResult &Result, const Stmt *S) {
@@ -73,13 +73,13 @@ void MultipleStatementMacroCheck::check(
if (!Next)
return;
- SourceLocation OuterLoc = Outer->getLocStart();
+ SourceLocation OuterLoc = Outer->getBeginLoc();
if (Result.Nodes.getNodeAs<Stmt>("else"))
OuterLoc = cast<IfStmt>(Outer)->getElseLoc();
- auto InnerRanges = getExpansionRanges(Inner->getLocStart(), Result);
+ auto InnerRanges = getExpansionRanges(Inner->getBeginLoc(), Result);
auto OuterRanges = getExpansionRanges(OuterLoc, Result);
- auto NextRanges = getExpansionRanges(Next->getLocStart(), Result);
+ auto NextRanges = getExpansionRanges(Next->getBeginLoc(), Result);
// Remove all the common ranges, starting from the top (the last ones in the
// list).
diff --git a/clang-tools-extra/clang-tidy/bugprone/SizeofContainerCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SizeofContainerCheck.cpp
index b4a019e996e..f7d63b1ae12 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SizeofContainerCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SizeofContainerCheck.cpp
@@ -40,7 +40,7 @@ void SizeofContainerCheck::check(const MatchFinder::MatchResult &Result) {
Result.Nodes.getNodeAs<UnaryExprOrTypeTraitExpr>("sizeof");
auto Diag =
- diag(SizeOf->getLocStart(), "sizeof() doesn't return the size of the "
+ diag(SizeOf->getBeginLoc(), "sizeof() doesn't return the size of the "
"container; did you mean .size()?");
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
index f05a90064c7..d662657a9b3 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
@@ -216,29 +216,29 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
const ASTContext &Ctx = *Result.Context;
if (const auto *E = Result.Nodes.getNodeAs<Expr>("sizeof-constant")) {
- diag(E->getLocStart(),
+ diag(E->getBeginLoc(),
"suspicious usage of 'sizeof(K)'; did you mean 'K'?");
} else if (const auto *E =
Result.Nodes.getNodeAs<Expr>("sizeof-integer-call")) {
- diag(E->getLocStart(), "suspicious usage of 'sizeof()' on an expression "
+ diag(E->getBeginLoc(), "suspicious usage of 'sizeof()' on an expression "
"that results in an integer");
} else if (const auto *E = Result.Nodes.getNodeAs<Expr>("sizeof-this")) {
- diag(E->getLocStart(),
+ diag(E->getBeginLoc(),
"suspicious usage of 'sizeof(this)'; did you mean 'sizeof(*this)'");
} else if (const auto *E = Result.Nodes.getNodeAs<Expr>("sizeof-charp")) {
- diag(E->getLocStart(),
+ diag(E->getBeginLoc(),
"suspicious usage of 'sizeof(char*)'; do you mean 'strlen'?");
} else if (const auto *E =
Result.Nodes.getNodeAs<Expr>("sizeof-pointer-to-aggregate")) {
- diag(E->getLocStart(),
+ diag(E->getBeginLoc(),
"suspicious usage of 'sizeof(A*)'; pointer to aggregate");
} else if (const auto *E =
Result.Nodes.getNodeAs<Expr>("sizeof-compare-constant")) {
- diag(E->getLocStart(),
+ diag(E->getBeginLoc(),
"suspicious comparison of 'sizeof(expr)' to a constant");
} else if (const auto *E =
Result.Nodes.getNodeAs<Expr>("sizeof-comma-expr")) {
- diag(E->getLocStart(), "suspicious usage of 'sizeof(..., ...)'");
+ diag(E->getBeginLoc(), "suspicious usage of 'sizeof(..., ...)'");
} else if (const auto *E =
Result.Nodes.getNodeAs<Expr>("sizeof-divide-expr")) {
const auto *NumTy = Result.Nodes.getNodeAs<Type>("num-type");
@@ -252,30 +252,30 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
if (DenominatorSize > CharUnits::Zero() &&
!NumeratorSize.isMultipleOf(DenominatorSize)) {
- diag(E->getLocStart(), "suspicious usage of 'sizeof(...)/sizeof(...)';"
+ diag(E->getBeginLoc(), "suspicious usage of 'sizeof(...)/sizeof(...)';"
" numerator is not a multiple of denominator");
} else if (ElementSize > CharUnits::Zero() &&
DenominatorSize > CharUnits::Zero() &&
ElementSize != DenominatorSize) {
- diag(E->getLocStart(), "suspicious usage of 'sizeof(...)/sizeof(...)';"
+ diag(E->getBeginLoc(), "suspicious usage of 'sizeof(...)/sizeof(...)';"
" numerator is not a multiple of denominator");
} else if (NumTy && DenomTy && NumTy == DenomTy) {
- diag(E->getLocStart(),
+ diag(E->getBeginLoc(),
"suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'");
} else if (PointedTy && DenomTy && PointedTy == DenomTy) {
- diag(E->getLocStart(),
+ diag(E->getBeginLoc(),
"suspicious usage of sizeof pointer 'sizeof(T*)/sizeof(T)'");
} else if (NumTy && DenomTy && NumTy->isPointerType() &&
DenomTy->isPointerType()) {
- diag(E->getLocStart(),
+ diag(E->getBeginLoc(),
"suspicious usage of sizeof pointer 'sizeof(P*)/sizeof(Q*)'");
}
} else if (const auto *E =
Result.Nodes.getNodeAs<Expr>("sizeof-sizeof-expr")) {
- diag(E->getLocStart(), "suspicious usage of 'sizeof(sizeof(...))'");
+ diag(E->getBeginLoc(), "suspicious usage of 'sizeof(sizeof(...))'");
} else if (const auto *E =
Result.Nodes.getNodeAs<Expr>("sizeof-multiply-sizeof")) {
- diag(E->getLocStart(), "suspicious 'sizeof' by 'sizeof' multiplication");
+ diag(E->getBeginLoc(), "suspicious 'sizeof' by 'sizeof' multiplication");
}
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
index 420428fc383..d88823067f2 100644
--- a/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
@@ -106,7 +106,7 @@ void StringConstructorCheck::check(const MatchFinder::MatchResult &Result) {
const ASTContext &Ctx = *Result.Context;
const auto *E = Result.Nodes.getNodeAs<CXXConstructExpr>("constructor");
assert(E && "missing constructor expression");
- SourceLocation Loc = E->getLocStart();
+ SourceLocation Loc = E->getBeginLoc();
if (Result.Nodes.getNodeAs<Expr>("swapped-parameter")) {
const Expr *P0 = E->getArg(0);
diff --git a/clang-tools-extra/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp
index f3736489ceb..1481cc380bd 100644
--- a/clang-tools-extra/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp
@@ -39,7 +39,7 @@ void StringIntegerAssignmentCheck::registerMatchers(MatchFinder *Finder) {
void StringIntegerAssignmentCheck::check(
const MatchFinder::MatchResult &Result) {
const auto *Argument = Result.Nodes.getNodeAs<Expr>("expr");
- SourceLocation Loc = Argument->getLocStart();
+ SourceLocation Loc = Argument->getBeginLoc();
auto Diag =
diag(Loc, "an integer is interpreted as a character code when assigning "
diff --git a/clang-tools-extra/clang-tidy/bugprone/StringLiteralWithEmbeddedNulCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/StringLiteralWithEmbeddedNulCheck.cpp
index eaa610fc64e..b440b616613 100644
--- a/clang-tools-extra/clang-tidy/bugprone/StringLiteralWithEmbeddedNulCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/StringLiteralWithEmbeddedNulCheck.cpp
@@ -68,14 +68,14 @@ void StringLiteralWithEmbeddedNulCheck::check(
SL->getCodeUnit(Offset + 1) == 'x' &&
isDigit(SL->getCodeUnit(Offset + 2)) &&
isDigit(SL->getCodeUnit(Offset + 3))) {
- diag(SL->getLocStart(), "suspicious embedded NUL character");
+ diag(SL->getBeginLoc(), "suspicious embedded NUL character");
return;
}
}
}
if (const auto *SL = Result.Nodes.getNodeAs<StringLiteral>("truncated")) {
- diag(SL->getLocStart(),
+ diag(SL->getBeginLoc(),
"truncated string literal with embedded NUL character");
}
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp
index 8e11a435174..2e0a46c91a7 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp
@@ -61,7 +61,7 @@ void SuspiciousMemsetUsageCheck::check(const MatchFinder::MatchResult &Result) {
SourceRange CharRange = CharZeroFill->getSourceRange();
auto Diag =
- diag(CharZeroFill->getLocStart(), "memset fill value is char '0', "
+ diag(CharZeroFill->getBeginLoc(), "memset fill value is char '0', "
"potentially mistaken for int 0");
// Only suggest a fix if no macros are involved.
@@ -82,7 +82,7 @@ void SuspiciousMemsetUsageCheck::check(const MatchFinder::MatchResult &Result) {
(NumValue >= 0 && NumValue <= UCharMax))
return;
- diag(NumFill->getLocStart(), "memset fill value is out of unsigned "
+ diag(NumFill->getBeginLoc(), "memset fill value is out of unsigned "
"character range, gets truncated");
}
@@ -110,7 +110,7 @@ void SuspiciousMemsetUsageCheck::check(const MatchFinder::MatchResult &Result) {
// `byte_count` is known to be zero at compile time, and `fill_char` is
// either not known or known to be a positive integer. Emit a warning
// and fix-its to swap the arguments.
- auto D = diag(Call->getLocStart(),
+ auto D = diag(Call->getBeginLoc(),
"memset of size zero, potentially swapped arguments");
StringRef RHSString = tooling::fixit::getText(*ByteCount, *Result.Context);
StringRef LHSString = tooling::fixit::getText(*FillChar, *Result.Context);
diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp
index 3831dc3eaee..a66cf431f7b 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp
@@ -120,7 +120,7 @@ void SuspiciousMissingCommaCheck::check(
if (double(Count) / Size > RatioThreshold)
return;
- diag(ConcatenatedLiteral->getLocStart(),
+ diag(ConcatenatedLiteral->getBeginLoc(),
"suspicious string literal, probably missing a comma");
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp
index d7f51d0d8bc..f4e1496af49 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp
@@ -34,7 +34,7 @@ void SuspiciousSemicolonCheck::check(const MatchFinder::MatchResult &Result) {
return;
const auto *Semicolon = Result.Nodes.getNodeAs<NullStmt>("semi");
- SourceLocation LocStart = Semicolon->getLocStart();
+ SourceLocation LocStart = Semicolon->getBeginLoc();
if (LocStart.isMacroID())
return;
@@ -60,7 +60,7 @@ void SuspiciousSemicolonCheck::check(const MatchFinder::MatchResult &Result) {
if (Lexer.LexFromRawLexer(Token))
return;
- unsigned BaseIndent = SM.getSpellingColumnNumber(Statement->getLocStart());
+ unsigned BaseIndent = SM.getSpellingColumnNumber(Statement->getBeginLoc());
unsigned NewTokenIndent = SM.getSpellingColumnNumber(Token.getLocation());
unsigned NewTokenLine = SM.getSpellingLineNumber(Token.getLocation());
diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
index 0cc62157b23..a16da4af1b8 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
@@ -177,7 +177,7 @@ void SuspiciousStringCompareCheck::check(
Call->getRParenLoc(), 0, Result.Context->getSourceManager(),
getLangOpts());
- diag(Call->getLocStart(),
+ diag(Call->getBeginLoc(),
"function %0 is called without explicitly comparing result")
<< Decl << FixItHint::CreateInsertion(EndLoc, " != 0");
}
@@ -186,29 +186,30 @@ void SuspiciousStringCompareCheck::check(
SourceLocation EndLoc = Lexer::getLocForEndOfToken(
Call->getRParenLoc(), 0, Result.Context->getSourceManager(),
getLangOpts());
- SourceLocation NotLoc = E->getLocStart();
+ SourceLocation NotLoc = E->getBeginLoc();
- diag(Call->getLocStart(),
+ diag(Call->getBeginLoc(),
"function %0 is compared using logical not operator")
- << Decl << FixItHint::CreateRemoval(
- CharSourceRange::getTokenRange(NotLoc, NotLoc))
+ << Decl
+ << FixItHint::CreateRemoval(
+ CharSourceRange::getTokenRange(NotLoc, NotLoc))
<< FixItHint::CreateInsertion(EndLoc, " == 0");
}
if (Result.Nodes.getNodeAs<Stmt>("invalid-comparison")) {
- diag(Call->getLocStart(),
+ diag(Call->getBeginLoc(),
"function %0 is compared to a suspicious constant")
<< Decl;
}
if (const auto *BinOp =
Result.Nodes.getNodeAs<BinaryOperator>("suspicious-operator")) {
- diag(Call->getLocStart(), "results of function %0 used by operator '%1'")
+ diag(Call->getBeginLoc(), "results of function %0 used by operator '%1'")
<< Decl << BinOp->getOpcodeStr();
}
if (Result.Nodes.getNodeAs<Stmt>("invalid-conversion")) {
- diag(Call->getLocStart(), "function %0 has suspicious implicit cast")
+ diag(Call->getBeginLoc(), "function %0 has suspicious implicit cast")
<< Decl;
}
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/SwappedArgumentsCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SwappedArgumentsCheck.cpp
index 64d3eaf5046..c1550f6d40a 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SwappedArgumentsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SwappedArgumentsCheck.cpp
@@ -84,7 +84,7 @@ void SwappedArgumentsCheck::check(const MatchFinder::MatchResult &Result) {
continue;
// Emit a warning and fix-its that swap the arguments.
- diag(Call->getLocStart(), "argument with implicit conversion from %0 "
+ diag(Call->getBeginLoc(), "argument with implicit conversion from %0 "
"to %1 followed by argument converted from "
"%2 to %3, potentially swapped arguments.")
<< LHS->getType() << LHSFrom->getType() << RHS->getType()
diff --git a/clang-tools-extra/clang-tidy/bugprone/TerminatingContinueCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/TerminatingContinueCheck.cpp
index 3e11e06cfc4..e41fc1fad7b 100644
--- a/clang-tools-extra/clang-tidy/bugprone/TerminatingContinueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/TerminatingContinueCheck.cpp
@@ -39,7 +39,7 @@ void TerminatingContinueCheck::check(const MatchFinder::MatchResult &Result) {
const auto *ContStmt = Result.Nodes.getNodeAs<ContinueStmt>("continue");
auto Diag =
- diag(ContStmt->getLocStart(),
+ diag(ContStmt->getBeginLoc(),
"'continue' in loop with false condition is equivalent to 'break'")
<< tooling::fixit::createReplacement(*ContStmt, "break");
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp
index 350cf3bc61b..695d9c5fadd 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp
@@ -42,7 +42,7 @@ void ThrowKeywordMissingCheck::check(const MatchFinder::MatchResult &Result) {
const auto *TemporaryExpr =
Result.Nodes.getNodeAs<Expr>("temporary-exception-not-thrown");
- diag(TemporaryExpr->getLocStart(), "suspicious exception object created but "
+ diag(TemporaryExpr->getBeginLoc(), "suspicious exception object created but "
"not thrown; did you mean 'throw %0'?")
<< TemporaryExpr->getType().getBaseTypeIdentifier()->getName();
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/UndefinedMemoryManipulationCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UndefinedMemoryManipulationCheck.cpp
index ebfe517dd07..0665e08017c 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UndefinedMemoryManipulationCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UndefinedMemoryManipulationCheck.cpp
@@ -52,7 +52,7 @@ void UndefinedMemoryManipulationCheck::check(
QualType DestType = Call->getArg(0)->IgnoreImplicit()->getType();
if (!DestType->getPointeeType().isNull())
DestType = DestType->getPointeeType();
- diag(Call->getLocStart(), "undefined behavior, destination object type %0 "
+ diag(Call->getBeginLoc(), "undefined behavior, destination object type %0 "
"is not TriviallyCopyable")
<< DestType;
}
@@ -60,7 +60,7 @@ void UndefinedMemoryManipulationCheck::check(
QualType SourceType = Call->getArg(1)->IgnoreImplicit()->getType();
if (!SourceType->getPointeeType().isNull())
SourceType = SourceType->getPointeeType();
- diag(Call->getLocStart(),
+ diag(Call->getBeginLoc(),
"undefined behavior, source object type %0 is not TriviallyCopyable")
<< SourceType;
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp
index f47ad7e7c47..90c07b9af7c 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp
@@ -75,7 +75,7 @@ void UndelegatedConstructorCheck::registerMatchers(MatchFinder *Finder) {
void UndelegatedConstructorCheck::check(
const MatchFinder::MatchResult &Result) {
const auto *E = Result.Nodes.getNodeAs<CXXConstructExpr>("construct");
- diag(E->getLocStart(), "did you intend to call a delegated constructor? "
+ diag(E->getBeginLoc(), "did you intend to call a delegated constructor? "
"A temporary object is created here instead");
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
index e2882f37104..e58f1668420 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
@@ -52,7 +52,7 @@ void UnusedRaiiCheck::check(const MatchFinder::MatchResult &Result) {
// We ignore code expanded from macros to reduce the number of false
// positives.
- if (E->getLocStart().isMacroID())
+ if (E->getBeginLoc().isMacroID())
return;
// Don't emit a warning for the last statement in the surrounding compund
@@ -62,7 +62,7 @@ void UnusedRaiiCheck::check(const MatchFinder::MatchResult &Result) {
return;
// Emit a warning.
- auto D = diag(E->getLocStart(), "object destroyed immediately after "
+ auto D = diag(E->getBeginLoc(), "object destroyed immediately after "
"creation; did you mean to name the object?");
const char *Replacement = " give_me_a_name";
diff --git a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
index d0c588570e1..b8de045e8da 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
@@ -86,10 +86,10 @@ void UnusedReturnValueCheck::registerMatchers(MatchFinder *Finder) {
void UnusedReturnValueCheck::check(const MatchFinder::MatchResult &Result) {
if (const auto *Matched = Result.Nodes.getNodeAs<CallExpr>("match")) {
- diag(Matched->getLocStart(),
+ diag(Matched->getBeginLoc(),
"the value returned by this function should be used")
<< Matched->getSourceRange();
- diag(Matched->getLocStart(),
+ diag(Matched->getBeginLoc(),
"cast the expression to void to silence this warning",
DiagnosticIDs::Note);
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/VirtualNearMissCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/VirtualNearMissCheck.cpp
index bb9c9b65c9c..ede1bf33cd6 100644
--- a/clang-tools-extra/clang-tidy/bugprone/VirtualNearMissCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/VirtualNearMissCheck.cpp
@@ -257,7 +257,7 @@ void VirtualNearMissCheck::check(const MatchFinder::MatchResult &Result) {
bool ApplyFix = !BaseMD->isTemplateInstantiation() &&
!DerivedMD->isTemplateInstantiation();
auto Diag =
- diag(DerivedMD->getLocStart(),
+ diag(DerivedMD->getBeginLoc(),
"method '%0' has a similar name and the same signature as "
"virtual method '%1'; did you mean to override it?")
<< DerivedMD->getQualifiedNameAsString()
OpenPOWER on IntegriCloud