[clang-tools-extra] r289542 - Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs, getDeclAs}
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 13 08:19:19 PST 2016
Author: alexfh
Date: Tue Dec 13 10:19:19 2016
New Revision: 289542
URL: http://llvm.org/viewvc/llvm-project?rev=289542&view=rev
Log:
Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}
Modified:
clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp
clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp
clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseOverrideCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp
clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
Modified: clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp?rev=289542&r1=289541&r2=289542&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp Tue Dec 13 10:19:19 2016
@@ -32,8 +32,8 @@ void BoolPointerImplicitConversionCheck:
void BoolPointerImplicitConversionCheck::check(
const MatchFinder::MatchResult &Result) {
- auto *If = Result.Nodes.getStmtAs<IfStmt>("if");
- auto *Var = Result.Nodes.getStmtAs<DeclRefExpr>("expr");
+ auto *If = Result.Nodes.getNodeAs<IfStmt>("if");
+ auto *Var = Result.Nodes.getNodeAs<DeclRefExpr>("expr");
// Ignore macros.
if (Var->getLocStart().isMacroID())
Modified: clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp?rev=289542&r1=289541&r2=289542&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp Tue Dec 13 10:19:19 2016
@@ -60,7 +60,7 @@ void IncorrectRoundings::registerMatcher
}
void IncorrectRoundings::check(const MatchFinder::MatchResult &Result) {
- const auto *CastExpr = Result.Nodes.getStmtAs<ImplicitCastExpr>("CastExpr");
+ const auto *CastExpr = Result.Nodes.getNodeAs<ImplicitCastExpr>("CastExpr");
diag(CastExpr->getLocStart(),
"casting (double + 0.5) to integer leads to incorrect rounding; "
"consider using lround (#include <cmath>) instead");
Modified: clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp?rev=289542&r1=289541&r2=289542&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp Tue Dec 13 10:19:19 2016
@@ -49,7 +49,7 @@ static bool isImplicitCastCandidate(cons
void SwappedArgumentsCheck::check(const MatchFinder::MatchResult &Result) {
const ASTContext &Ctx = *Result.Context;
- const auto *Call = Result.Nodes.getStmtAs<CallExpr>("call");
+ const auto *Call = Result.Nodes.getNodeAs<CallExpr>("call");
llvm::SmallPtrSet<const Expr *, 4> UsedArgs;
for (unsigned I = 1, E = Call->getNumArgs(); I < E; ++I) {
Modified: clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp?rev=289542&r1=289541&r2=289542&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp Tue Dec 13 10:19:19 2016
@@ -74,7 +74,7 @@ void UndelegatedConstructorCheck::regist
void UndelegatedConstructorCheck::check(
const MatchFinder::MatchResult &Result) {
- const auto *E = Result.Nodes.getStmtAs<CXXConstructExpr>("construct");
+ const auto *E = Result.Nodes.getNodeAs<CXXConstructExpr>("construct");
diag(E->getLocStart(), "did you intend to call a delegated constructor? "
"A temporary object is created here instead");
}
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp?rev=289542&r1=289541&r2=289542&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp Tue Dec 13 10:19:19 2016
@@ -48,7 +48,7 @@ void UnusedRAIICheck::registerMatchers(M
}
void UnusedRAIICheck::check(const MatchFinder::MatchResult &Result) {
- const auto *E = Result.Nodes.getStmtAs<Expr>("expr");
+ const auto *E = Result.Nodes.getNodeAs<Expr>("expr");
// We ignore code expanded from macros to reduce the number of false
// positives.
@@ -57,7 +57,7 @@ void UnusedRAIICheck::check(const MatchF
// Don't emit a warning for the last statement in the surrounding compund
// statement.
- const auto *CS = Result.Nodes.getStmtAs<CompoundStmt>("compound");
+ const auto *CS = Result.Nodes.getNodeAs<CompoundStmt>("compound");
if (E == CS->body_back())
return;
@@ -68,7 +68,7 @@ void UnusedRAIICheck::check(const MatchF
// If this is a default ctor we have to remove the parens or we'll introduce a
// most vexing parse.
- const auto *BTE = Result.Nodes.getStmtAs<CXXBindTemporaryExpr>("temp");
+ const auto *BTE = Result.Nodes.getNodeAs<CXXBindTemporaryExpr>("temp");
if (const auto *TOE = dyn_cast<CXXTemporaryObjectExpr>(BTE->getSubExpr()))
if (TOE->getNumArgs() == 0) {
D << FixItHint::CreateReplacement(
Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=289542&r1=289541&r2=289542&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Tue Dec 13 10:19:19 2016
@@ -703,7 +703,7 @@ void LoopConvertCheck::getIteratorLoopQu
RangeDescriptor &Descriptor) {
// The matchers for iterator loops provide bound nodes to obtain this
// information.
- const auto *InitVar = Nodes.getDeclAs<VarDecl>(InitVarName);
+ const auto *InitVar = Nodes.getNodeAs<VarDecl>(InitVarName);
QualType CanonicalInitVarType = InitVar->getType().getCanonicalType();
const auto *DerefByValueType =
Nodes.getNodeAs<QualType>(DerefByValueResultName);
@@ -763,13 +763,13 @@ bool LoopConvertCheck::isConvertible(AST
return false;
// Check that we have exactly one index variable and at most one end variable.
- const auto *LoopVar = Nodes.getDeclAs<VarDecl>(IncrementVarName);
- const auto *CondVar = Nodes.getDeclAs<VarDecl>(ConditionVarName);
- const auto *InitVar = Nodes.getDeclAs<VarDecl>(InitVarName);
+ const auto *LoopVar = Nodes.getNodeAs<VarDecl>(IncrementVarName);
+ const auto *CondVar = Nodes.getNodeAs<VarDecl>(ConditionVarName);
+ const auto *InitVar = Nodes.getNodeAs<VarDecl>(InitVarName);
if (!areSameVariable(LoopVar, CondVar) || !areSameVariable(LoopVar, InitVar))
return false;
- const auto *EndVar = Nodes.getDeclAs<VarDecl>(EndVarName);
- const auto *ConditionEndVar = Nodes.getDeclAs<VarDecl>(ConditionEndVarName);
+ const auto *EndVar = Nodes.getNodeAs<VarDecl>(EndVarName);
+ const auto *ConditionEndVar = Nodes.getNodeAs<VarDecl>(ConditionEndVarName);
if (EndVar && !areSameVariable(EndVar, ConditionEndVar))
return false;
@@ -798,7 +798,7 @@ bool LoopConvertCheck::isConvertible(AST
}
} else if (FixerKind == LFK_PseudoArray) {
// This call is required to obtain the container.
- const auto *EndCall = Nodes.getStmtAs<CXXMemberCallExpr>(EndCallName);
+ const auto *EndCall = Nodes.getNodeAs<CXXMemberCallExpr>(EndCallName);
if (!EndCall || !dyn_cast<MemberExpr>(EndCall->getCallee()))
return false;
}
@@ -814,12 +814,12 @@ void LoopConvertCheck::check(const Match
LoopFixerKind FixerKind;
RangeDescriptor Descriptor;
- if ((Loop = Nodes.getStmtAs<ForStmt>(LoopNameArray))) {
+ if ((Loop = Nodes.getNodeAs<ForStmt>(LoopNameArray))) {
FixerKind = LFK_Array;
- } else if ((Loop = Nodes.getStmtAs<ForStmt>(LoopNameIterator))) {
+ } else if ((Loop = Nodes.getNodeAs<ForStmt>(LoopNameIterator))) {
FixerKind = LFK_Iterator;
} else {
- Loop = Nodes.getStmtAs<ForStmt>(LoopNamePseudoArray);
+ Loop = Nodes.getNodeAs<ForStmt>(LoopNamePseudoArray);
assert(Loop && "Bad Callback. No for statement");
FixerKind = LFK_PseudoArray;
}
@@ -827,8 +827,8 @@ void LoopConvertCheck::check(const Match
if (!isConvertible(Context, Nodes, Loop, FixerKind))
return;
- const auto *LoopVar = Nodes.getDeclAs<VarDecl>(IncrementVarName);
- const auto *EndVar = Nodes.getDeclAs<VarDecl>(EndVarName);
+ const auto *LoopVar = Nodes.getNodeAs<VarDecl>(IncrementVarName);
+ const auto *EndVar = Nodes.getNodeAs<VarDecl>(EndVarName);
// If the loop calls end()/size() after each iteration, lower our confidence
// level.
@@ -837,8 +837,8 @@ void LoopConvertCheck::check(const Match
// If the end comparison isn't a variable, we can try to work with the
// expression the loop variable is being tested against instead.
- const auto *EndCall = Nodes.getStmtAs<CXXMemberCallExpr>(EndCallName);
- const auto *BoundExpr = Nodes.getStmtAs<Expr>(ConditionBoundName);
+ const auto *EndCall = Nodes.getNodeAs<CXXMemberCallExpr>(EndCallName);
+ const auto *BoundExpr = Nodes.getNodeAs<Expr>(ConditionBoundName);
// Find container expression of iterators and pseudoarrays, and determine if
// this expression needs to be dereferenced to obtain the container.
Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseOverrideCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseOverrideCheck.cpp?rev=289542&r1=289541&r2=289542&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseOverrideCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseOverrideCheck.cpp Tue Dec 13 10:19:19 2016
@@ -60,7 +60,7 @@ static StringRef GetText(const Token &To
}
void UseOverrideCheck::check(const MatchFinder::MatchResult &Result) {
- const FunctionDecl *Method = Result.Nodes.getStmtAs<FunctionDecl>("method");
+ const FunctionDecl *Method = Result.Nodes.getNodeAs<FunctionDecl>("method");
const SourceManager &Sources = *Result.SourceManager;
assert(Method != nullptr);
Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp?rev=289542&r1=289541&r2=289542&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp Tue Dec 13 10:19:19 2016
@@ -177,9 +177,9 @@ void RedundantStringCStrCheck::registerM
}
void RedundantStringCStrCheck::check(const MatchFinder::MatchResult &Result) {
- const auto *Call = Result.Nodes.getStmtAs<CallExpr>("call");
- const auto *Arg = Result.Nodes.getStmtAs<Expr>("arg");
- const auto *Member = Result.Nodes.getStmtAs<MemberExpr>("member");
+ const auto *Call = Result.Nodes.getNodeAs<CallExpr>("call");
+ const auto *Arg = Result.Nodes.getNodeAs<Expr>("arg");
+ const auto *Member = Result.Nodes.getNodeAs<MemberExpr>("member");
bool Arrow = Member->isArrow();
// Replace the "call" node with the "arg" node, prefixed with '*'
// if the call was using '->' rather than '.'.
Modified: clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp?rev=289542&r1=289541&r2=289542&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp Tue Dec 13 10:19:19 2016
@@ -45,7 +45,7 @@ public:
}
void check(const ast_matchers::MatchFinder::MatchResult &Result) override {
- auto Diag = diag(Result.Nodes.getStmtAs<DeclStmt>("stmt")->getLocStart(),
+ auto Diag = diag(Result.Nodes.getNodeAs<DeclStmt>("stmt")->getLocStart(),
"foo, bar");
for (StringRef header : HeadersToInclude()) {
auto Fixit = Inserter->CreateIncludeInsertion(
More information about the cfe-commits
mailing list