File tree Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,6 @@ namespace clang::tidy::modernize {
20
20
21
21
namespace {
22
22
AST_MATCHER (StringLiteral, isOrdinary) { return Node.isOrdinary (); }
23
- AST_MATCHER (QualType, isSimpleChar) {
24
- const auto ActualType = Node.getTypePtr ();
25
- return ActualType->isSpecificBuiltinType (BuiltinType::Char_S) ||
26
- ActualType->isSpecificBuiltinType (BuiltinType::Char_U);
27
- }
28
23
} // namespace
29
24
30
25
UseStdFormatCheck::UseStdFormatCheck (StringRef Name, ClangTidyContext *Context)
@@ -52,7 +47,8 @@ void UseStdFormatCheck::registerPPCallbacks(const SourceManager &SM,
52
47
}
53
48
54
49
void UseStdFormatCheck::registerMatchers (MatchFinder *Finder) {
55
- auto CharPointerType = hasType (pointerType (pointee (isSimpleChar ())));
50
+ auto CharPointerType =
51
+ hasType (pointerType (pointee (matchers::isSimpleChar ())));
56
52
Finder->addMatcher (
57
53
callExpr (
58
54
argumentCountAtLeast (1 ), hasArgument (0 , stringLiteral (isOrdinary ())),
Original file line number Diff line number Diff line change @@ -20,11 +20,6 @@ namespace clang::tidy::modernize {
20
20
21
21
namespace {
22
22
AST_MATCHER (StringLiteral, isOrdinary) { return Node.isOrdinary (); }
23
- AST_MATCHER (QualType, isSimpleChar) {
24
- const auto ActualType = Node.getTypePtr ();
25
- return ActualType->isSpecificBuiltinType (BuiltinType::Char_S) ||
26
- ActualType->isSpecificBuiltinType (BuiltinType::Char_U);
27
- }
28
23
} // namespace
29
24
30
25
UseStdPrintCheck::UseStdPrintCheck (StringRef Name, ClangTidyContext *Context)
@@ -100,7 +95,8 @@ unusedReturnValue(clang::ast_matchers::StatementMatcher MatchedCallExpr) {
100
95
}
101
96
102
97
void UseStdPrintCheck::registerMatchers (MatchFinder *Finder) {
103
- auto CharPointerType = hasType (pointerType (pointee (isSimpleChar ())));
98
+ auto CharPointerType =
99
+ hasType (pointerType (pointee (matchers::isSimpleChar ())));
104
100
if (!PrintfLikeFunctions.empty ())
105
101
Finder->addMatcher (
106
102
unusedReturnValue (
Original file line number Diff line number Diff line change @@ -49,6 +49,14 @@ AST_MATCHER_FUNCTION(ast_matchers::TypeMatcher, isPointerToConst) {
49
49
return pointerType (pointee (qualType (isConstQualified ())));
50
50
}
51
51
52
+ // Returns QualType matcher for target char type only.
53
+ AST_MATCHER (QualType, isSimpleChar) {
54
+ const auto ActualType = Node.getTypePtr ();
55
+ return ActualType &&
56
+ (ActualType->isSpecificBuiltinType (BuiltinType::Char_S) ||
57
+ ActualType->isSpecificBuiltinType (BuiltinType::Char_U));
58
+ }
59
+
52
60
AST_MATCHER (Expr, hasUnevaluatedContext) {
53
61
if (isa<CXXNoexceptExpr>(Node) || isa<RequiresExpr>(Node))
54
62
return true ;
You can’t perform that action at this time.
0 commit comments