Skip to content

Commit 63dfe70

Browse files
authored
[clang-tidy][NFC] move AST_MATCHER to anonymous namespace in InfiniteLoopCheck (llvm#118820)
1 parent 68e75ee commit 63dfe70

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h"
1414
#include "clang/Analysis/CallGraph.h"
1515
#include "llvm/ADT/SCCIterator.h"
16-
#include "llvm/ADT/SmallVector.h"
1716

1817
using namespace clang::ast_matchers;
18+
using clang::ast_matchers::internal::Matcher;
1919
using clang::tidy::utils::hasPtrOrReferenceInFunc;
2020

2121
namespace clang {
22-
namespace ast_matchers {
22+
namespace tidy::bugprone {
23+
24+
namespace {
2325
/// matches a Decl if it has a "no return" attribute of any kind
2426
AST_MATCHER(Decl, declHasNoReturnAttr) {
2527
return Node.hasAttr<NoReturnAttr>() || Node.hasAttr<CXX11NoReturnAttr>() ||
@@ -30,23 +32,21 @@ AST_MATCHER(Decl, declHasNoReturnAttr) {
3032
AST_MATCHER(FunctionType, typeHasNoReturnAttr) {
3133
return Node.getNoReturnAttr();
3234
}
33-
} // namespace ast_matchers
34-
namespace tidy::bugprone {
35+
} // namespace
3536

36-
static internal::Matcher<Stmt>
37-
loopEndingStmt(internal::Matcher<Stmt> Internal) {
38-
internal::Matcher<QualType> isNoReturnFunType =
37+
static Matcher<Stmt> loopEndingStmt(Matcher<Stmt> Internal) {
38+
Matcher<QualType> IsNoReturnFunType =
3939
ignoringParens(functionType(typeHasNoReturnAttr()));
40-
internal::Matcher<Decl> isNoReturnDecl =
41-
anyOf(declHasNoReturnAttr(), functionDecl(hasType(isNoReturnFunType)),
42-
varDecl(hasType(blockPointerType(pointee(isNoReturnFunType)))));
40+
Matcher<Decl> IsNoReturnDecl =
41+
anyOf(declHasNoReturnAttr(), functionDecl(hasType(IsNoReturnFunType)),
42+
varDecl(hasType(blockPointerType(pointee(IsNoReturnFunType)))));
4343

4444
return stmt(anyOf(
4545
mapAnyOf(breakStmt, returnStmt, gotoStmt, cxxThrowExpr).with(Internal),
4646
callExpr(Internal,
4747
callee(mapAnyOf(functionDecl, /* block callee */ varDecl)
48-
.with(isNoReturnDecl))),
49-
objcMessageExpr(Internal, callee(isNoReturnDecl))));
48+
.with(IsNoReturnDecl))),
49+
objcMessageExpr(Internal, callee(IsNoReturnDecl))));
5050
}
5151

5252
/// Return whether `Var` was changed in `LoopStmt`.

0 commit comments

Comments
 (0)