diff options
Diffstat (limited to 'clang-tools-extra')
9 files changed, 27 insertions, 27 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp b/clang-tools-extra/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp index 4dc459ab871..f831125838d 100644 --- a/clang-tools-extra/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp @@ -32,8 +32,8 @@ void BoolPointerImplicitConversionCheck::registerMatchers(MatchFinder *Finder) { 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()) diff --git a/clang-tools-extra/clang-tidy/misc/IncorrectRoundings.cpp b/clang-tools-extra/clang-tidy/misc/IncorrectRoundings.cpp index 88365effc2f..b7c8e0a8280 100644 --- a/clang-tools-extra/clang-tidy/misc/IncorrectRoundings.cpp +++ b/clang-tools-extra/clang-tidy/misc/IncorrectRoundings.cpp @@ -60,7 +60,7 @@ void IncorrectRoundings::registerMatchers(MatchFinder *MatchFinder) { } 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"); diff --git a/clang-tools-extra/clang-tidy/misc/SwappedArgumentsCheck.cpp b/clang-tools-extra/clang-tidy/misc/SwappedArgumentsCheck.cpp index 389be350675..e4dc5ca056a 100644 --- a/clang-tools-extra/clang-tidy/misc/SwappedArgumentsCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/SwappedArgumentsCheck.cpp @@ -49,7 +49,7 @@ static bool isImplicitCastCandidate(const CastExpr *Cast) { 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) { diff --git a/clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp b/clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp index 003290ee4e7..f42f1c5af9e 100644 --- a/clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp +++ b/clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp @@ -74,7 +74,7 @@ void UndelegatedConstructorCheck::registerMatchers(MatchFinder *Finder) { 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"); } diff --git a/clang-tools-extra/clang-tidy/misc/UnusedRAIICheck.cpp b/clang-tools-extra/clang-tidy/misc/UnusedRAIICheck.cpp index 8350d533df7..e1acfe97c3b 100644 --- a/clang-tools-extra/clang-tidy/misc/UnusedRAIICheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/UnusedRAIICheck.cpp @@ -48,7 +48,7 @@ void UnusedRAIICheck::registerMatchers(MatchFinder *Finder) { } 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 MatchFinder::MatchResult &Result) { // 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 MatchFinder::MatchResult &Result) { // 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( diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp index 3754768ec04..d86a97c4b78 100644 --- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp @@ -703,7 +703,7 @@ void LoopConvertCheck::getIteratorLoopQualifiers(ASTContext *Context, 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(ASTContext *Context, 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(ASTContext *Context, } } 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 MatchFinder::MatchResult &Result) { 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 MatchFinder::MatchResult &Result) { 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 MatchFinder::MatchResult &Result) { // 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. diff --git a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp index 3b91c6efbb1..574d1a77b40 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp @@ -60,7 +60,7 @@ static StringRef GetText(const Token &Tok, const SourceManager &Sources) { } 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); diff --git a/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp index 8f086b87858..c6b384b3ac4 100644 --- a/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp @@ -177,9 +177,9 @@ void RedundantStringCStrCheck::registerMatchers( } 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 '.'. diff --git a/clang-tools-extra/unittests/clang-tidy/IncludeInserterTest.cpp b/clang-tools-extra/unittests/clang-tidy/IncludeInserterTest.cpp index 928d1cefd8a..1d46f2a5d81 100644 --- a/clang-tools-extra/unittests/clang-tidy/IncludeInserterTest.cpp +++ b/clang-tools-extra/unittests/clang-tidy/IncludeInserterTest.cpp @@ -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( |

