summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/cppcoreguidelines
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/cppcoreguidelines')
-rw-r--r--clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/cppcoreguidelines/NoMallocCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp24
-rw-r--r--clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp8
-rw-r--r--clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp12
6 files changed, 28 insertions, 28 deletions
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp
index 3e800cd59e1..eaed15f97b7 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp
@@ -19,7 +19,7 @@ namespace cppcoreguidelines {
namespace {
AST_MATCHER(GotoStmt, isForwardJumping) {
- return Node.getLocStart() < Node.getLabel()->getLocStart();
+ return Node.getBeginLoc() < Node.getLabel()->getBeginLoc();
}
} // namespace
@@ -49,7 +49,7 @@ void AvoidGotoCheck::check(const MatchFinder::MatchResult &Result) {
diag(Goto->getGotoLoc(), "avoid using 'goto' for flow control")
<< Goto->getSourceRange();
- diag(Goto->getLabel()->getLocStart(), "label defined here",
+ diag(Goto->getLabel()->getBeginLoc(), "label defined here",
DiagnosticIDs::Note);
}
} // namespace cppcoreguidelines
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
index 2c5676e76a2..3a22c1e9c50 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
@@ -52,14 +52,14 @@ void NarrowingConversionsCheck::registerMatchers(MatchFinder *Finder) {
void NarrowingConversionsCheck::check(const MatchFinder::MatchResult &Result) {
if (const auto *Op = Result.Nodes.getNodeAs<BinaryOperator>("op")) {
- if (Op->getLocStart().isMacroID())
+ if (Op->getBeginLoc().isMacroID())
return;
diag(Op->getOperatorLoc(), "narrowing conversion from %0 to %1")
<< Op->getRHS()->getType() << Op->getLHS()->getType();
return;
}
const auto *Cast = Result.Nodes.getNodeAs<ImplicitCastExpr>("cast");
- if (Cast->getLocStart().isMacroID())
+ if (Cast->getBeginLoc().isMacroID())
return;
diag(Cast->getExprLoc(), "narrowing conversion from %0 to %1")
<< Cast->getSubExpr()->getType() << Cast->getType();
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/NoMallocCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/NoMallocCheck.cpp
index 5a2b8824665..cc334681645 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/NoMallocCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/NoMallocCheck.cpp
@@ -73,8 +73,8 @@ void NoMallocCheck::check(const MatchFinder::MatchResult &Result) {
assert(Call && "Unhandled binding in the Matcher");
- diag(Call->getLocStart(), "do not manage memory manually; %0")
- << Recommendation << SourceRange(Call->getLocStart(), Call->getLocEnd());
+ diag(Call->getBeginLoc(), "do not manage memory manually; %0")
+ << Recommendation << SourceRange(Call->getBeginLoc(), Call->getLocEnd());
}
} // namespace cppcoreguidelines
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
index 6c86e053b14..ebebfda2b08 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
@@ -203,7 +203,7 @@ bool OwningMemoryCheck::handleDeletion(const BoundNodes &Nodes) {
// Deletion of non-owners, with `delete variable;`
if (DeleteStmt) {
- diag(DeleteStmt->getLocStart(),
+ diag(DeleteStmt->getBeginLoc(),
"deleting a pointer through a type that is "
"not marked 'gsl::owner<>'; consider using a "
"smart pointer instead")
@@ -212,7 +212,7 @@ bool OwningMemoryCheck::handleDeletion(const BoundNodes &Nodes) {
// FIXME: The declaration of the variable that was deleted can be
// rewritten.
const ValueDecl *Decl = DeletedVariable->getDecl();
- diag(Decl->getLocStart(), "variable declared here", DiagnosticIDs::Note)
+ diag(Decl->getBeginLoc(), "variable declared here", DiagnosticIDs::Note)
<< Decl->getSourceRange();
return true;
@@ -228,7 +228,7 @@ bool OwningMemoryCheck::handleLegacyConsumers(const BoundNodes &Nodes) {
// as a pointer, which should not be an owner. The argument that is an owner
// is known and the false positive coming from the filename can be avoided.
if (LegacyConsumer) {
- diag(LegacyConsumer->getLocStart(),
+ diag(LegacyConsumer->getBeginLoc(),
"calling legacy resource function without passing a 'gsl::owner<>'")
<< LegacyConsumer->getSourceRange();
return true;
@@ -242,7 +242,7 @@ bool OwningMemoryCheck::handleExpectedOwner(const BoundNodes &Nodes) {
// Expected function argument to be owner.
if (ExpectedOwner) {
- diag(ExpectedOwner->getLocStart(),
+ diag(ExpectedOwner->getBeginLoc(),
"expected argument of type 'gsl::owner<>'; got %0")
<< ExpectedOwner->getType() << ExpectedOwner->getSourceRange();
return true;
@@ -261,7 +261,7 @@ bool OwningMemoryCheck::handleAssignmentAndInit(const BoundNodes &Nodes) {
// Assignments to owners.
if (OwnerAssignment) {
- diag(OwnerAssignment->getLocStart(),
+ diag(OwnerAssignment->getBeginLoc(),
"expected assignment source to be of type 'gsl::owner<>'; got %0")
<< OwnerAssignment->getRHS()->getType()
<< OwnerAssignment->getSourceRange();
@@ -270,7 +270,7 @@ bool OwningMemoryCheck::handleAssignmentAndInit(const BoundNodes &Nodes) {
// Initialization of owners.
if (OwnerInitialization) {
- diag(OwnerInitialization->getLocStart(),
+ diag(OwnerInitialization->getBeginLoc(),
"expected initialization with value of type 'gsl::owner<>'; got %0")
<< OwnerInitialization->getAnyInitializer()->getType()
<< OwnerInitialization->getSourceRange();
@@ -306,7 +306,7 @@ bool OwningMemoryCheck::handleAssignmentFromNewOwner(const BoundNodes &Nodes) {
// Bad assignments to non-owners, where the RHS is a newly created owner.
if (BadOwnerAssignment) {
- diag(BadOwnerAssignment->getLocStart(),
+ diag(BadOwnerAssignment->getBeginLoc(),
"assigning newly created 'gsl::owner<>' to non-owner %0")
<< BadOwnerAssignment->getLHS()->getType()
<< BadOwnerAssignment->getSourceRange();
@@ -315,7 +315,7 @@ bool OwningMemoryCheck::handleAssignmentFromNewOwner(const BoundNodes &Nodes) {
// Bad initialization of non-owners, where the RHS is a newly created owner.
if (BadOwnerInitialization) {
- diag(BadOwnerInitialization->getLocStart(),
+ diag(BadOwnerInitialization->getBeginLoc(),
"initializing non-owner %0 with a newly created 'gsl::owner<>'")
<< BadOwnerInitialization->getType()
<< BadOwnerInitialization->getSourceRange();
@@ -326,7 +326,7 @@ bool OwningMemoryCheck::handleAssignmentFromNewOwner(const BoundNodes &Nodes) {
// If the type of the variable was deduced, the wrapping owner typedef is
// eliminated, therefore the check emits a special note for that case.
if (Nodes.getNodeAs<AutoType>("deduced_type")) {
- diag(BadOwnerInitialization->getLocStart(),
+ diag(BadOwnerInitialization->getBeginLoc(),
"type deduction did not result in an owner", DiagnosticIDs::Note);
}
return true;
@@ -337,7 +337,7 @@ bool OwningMemoryCheck::handleAssignmentFromNewOwner(const BoundNodes &Nodes) {
if (BadOwnerArgument) {
assert(BadOwnerParameter &&
"parameter for the problematic argument not found");
- diag(BadOwnerArgument->getLocStart(), "initializing non-owner argument of "
+ diag(BadOwnerArgument->getBeginLoc(), "initializing non-owner argument of "
"type %0 with a newly created "
"'gsl::owner<>'")
<< BadOwnerParameter->getType() << BadOwnerArgument->getSourceRange();
@@ -356,7 +356,7 @@ bool OwningMemoryCheck::handleReturnValues(const BoundNodes &Nodes) {
if (BadReturnType) {
// The returned value is a resource or variable that was not annotated with
// owner<> and the function return type is not owner<>.
- diag(BadReturnType->getLocStart(),
+ diag(BadReturnType->getBeginLoc(),
"returning a newly created resource of "
"type %0 or 'gsl::owner<>' from a "
"function whose return type is not 'gsl::owner<>'")
@@ -380,7 +380,7 @@ bool OwningMemoryCheck::handleOwnerMembers(const BoundNodes &Nodes) {
assert(DeclaredOwnerMember &&
"match on class with bad destructor but without a declared owner");
- diag(DeclaredOwnerMember->getLocStart(),
+ diag(DeclaredOwnerMember->getBeginLoc(),
"member variable of type 'gsl::owner<>' requires the class %0 to "
"implement a destructor to release the owned resource")
<< BadClass;
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp
index 52156ad2221..8a43a816ddd 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp
@@ -46,7 +46,7 @@ void ProTypeCstyleCastCheck::check(const MatchFinder::MatchResult &Result) {
MatchedCast->getCastKind() == CK_IntegralToPointer ||
MatchedCast->getCastKind() == CK_PointerToIntegral ||
MatchedCast->getCastKind() == CK_ReinterpretMemberPointer) {
- diag(MatchedCast->getLocStart(),
+ diag(MatchedCast->getBeginLoc(),
"do not use C-style cast to convert between unrelated types");
return;
}
@@ -71,7 +71,7 @@ void ProTypeCstyleCastCheck::check(const MatchFinder::MatchResult &Result) {
*Result.SourceManager, getLangOpts());
auto diag_builder = diag(
- MatchedCast->getLocStart(),
+ MatchedCast->getBeginLoc(),
"do not use C-style cast to downcast from a base to a derived class; "
"use dynamic_cast instead");
@@ -90,7 +90,7 @@ void ProTypeCstyleCastCheck::check(const MatchFinder::MatchResult &Result) {
diag_builder << FixItHint::CreateReplacement(ParenRange, CastText);
} else {
diag(
- MatchedCast->getLocStart(),
+ MatchedCast->getBeginLoc(),
"do not use C-style cast to downcast from a base to a derived class");
}
return;
@@ -98,7 +98,7 @@ void ProTypeCstyleCastCheck::check(const MatchFinder::MatchResult &Result) {
if (MatchedCast->getCastKind() == CK_NoOp &&
needsConstCast(SourceType, MatchedCast->getType())) {
- diag(MatchedCast->getLocStart(),
+ diag(MatchedCast->getBeginLoc(),
"do not use C-style cast to cast away constness");
}
}
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
index 4d9be8151a0..142ac2ed787 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -120,7 +120,7 @@ struct IntializerInsertion {
switch (Placement) {
case InitializerPlacement::New:
Location = utils::lexer::getPreviousToken(
- Context, Constructor.getBody()->getLocStart())
+ Context, Constructor.getBody()->getBeginLoc())
.getLocation();
break;
case InitializerPlacement::Before:
@@ -230,7 +230,7 @@ void fixInitializerList(const ASTContext &Context, DiagnosticBuilder &Diag,
const CXXConstructorDecl *Ctor,
const SmallPtrSetImpl<const T *> &DeclsToInit) {
// Do not propose fixes in macros since we cannot place them correctly.
- if (Ctor->getLocStart().isMacroID())
+ if (Ctor->getBeginLoc().isMacroID())
return;
SmallVector<const NamedDecl *, 16> OrderedDecls;
@@ -384,7 +384,7 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
return;
DiagnosticBuilder Diag =
- diag(Ctor ? Ctor->getLocStart() : ClassDecl.getLocation(),
+ diag(Ctor ? Ctor->getBeginLoc() : ClassDecl.getLocation(),
IsUnion
? "union constructor should initialize one of these fields: %0"
: "constructor does not initialize these fields: %0")
@@ -392,7 +392,7 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
// Do not propose fixes for constructors in macros since we cannot place them
// correctly.
- if (Ctor && Ctor->getLocStart().isMacroID())
+ if (Ctor && Ctor->getBeginLoc().isMacroID())
return;
// Collect all fields but only suggest a fix for the first member of unions,
@@ -462,7 +462,7 @@ void ProTypeMemberInitCheck::checkMissingBaseClassInitializer(
return;
DiagnosticBuilder Diag =
- diag(Ctor ? Ctor->getLocStart() : ClassDecl.getLocation(),
+ diag(Ctor ? Ctor->getBeginLoc() : ClassDecl.getLocation(),
"constructor does not initialize these bases: %0")
<< toCommaSeparatedString(AllBases, BasesToInit);
@@ -473,7 +473,7 @@ void ProTypeMemberInitCheck::checkMissingBaseClassInitializer(
void ProTypeMemberInitCheck::checkUninitializedTrivialType(
const ASTContext &Context, const VarDecl *Var) {
DiagnosticBuilder Diag =
- diag(Var->getLocStart(), "uninitialized record type: %0") << Var;
+ diag(Var->getBeginLoc(), "uninitialized record type: %0") << Var;
Diag << FixItHint::CreateInsertion(
getLocationForEndOfToken(Context, Var->getSourceRange().getEnd()),
OpenPOWER on IntegriCloud