13
13
#include " clang/Analysis/Analyses/ExprMutationAnalyzer.h"
14
14
#include " clang/Analysis/CallGraph.h"
15
15
#include " llvm/ADT/SCCIterator.h"
16
- #include " llvm/ADT/SmallVector.h"
17
16
18
17
using namespace clang ::ast_matchers;
18
+ using clang::ast_matchers::internal::Matcher;
19
19
using clang::tidy::utils::hasPtrOrReferenceInFunc;
20
20
21
21
namespace clang {
22
- namespace ast_matchers {
22
+ namespace tidy ::bugprone {
23
+
24
+ namespace {
23
25
// / matches a Decl if it has a "no return" attribute of any kind
24
26
AST_MATCHER (Decl, declHasNoReturnAttr) {
25
27
return Node.hasAttr <NoReturnAttr>() || Node.hasAttr <CXX11NoReturnAttr>() ||
@@ -30,23 +32,21 @@ AST_MATCHER(Decl, declHasNoReturnAttr) {
30
32
AST_MATCHER (FunctionType, typeHasNoReturnAttr) {
31
33
return Node.getNoReturnAttr ();
32
34
}
33
- } // namespace ast_matchers
34
- namespace tidy ::bugprone {
35
+ } // namespace
35
36
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 =
39
39
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 )))));
43
43
44
44
return stmt (anyOf (
45
45
mapAnyOf (breakStmt, returnStmt, gotoStmt, cxxThrowExpr).with (Internal),
46
46
callExpr (Internal,
47
47
callee (mapAnyOf (functionDecl, /* block callee */ varDecl)
48
- .with (isNoReturnDecl ))),
49
- objcMessageExpr (Internal, callee (isNoReturnDecl ))));
48
+ .with (IsNoReturnDecl ))),
49
+ objcMessageExpr (Internal, callee (IsNoReturnDecl ))));
50
50
}
51
51
52
52
// / Return whether `Var` was changed in `LoopStmt`.
0 commit comments