File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 10
10
#include " clang/AST/ASTContext.h"
11
11
#include " clang/AST/ParentMapContext.h"
12
12
#include " clang/ASTMatchers/ASTMatchFinder.h"
13
+ #include " clang/ASTMatchers/ASTMatchers.h"
13
14
14
15
using namespace clang ::ast_matchers;
15
16
@@ -56,6 +57,7 @@ void ProBoundsArrayToPointerDecayCheck::registerMatchers(MatchFinder *Finder) {
56
57
TK_AsIs,
57
58
implicitCastExpr (
58
59
unless (hasParent (arraySubscriptExpr ())),
60
+ unless (hasSourceExpression (predefinedExpr ())),
59
61
unless (hasParentIgnoringImpCasts (explicitCastExpr ())),
60
62
unless (isInsideOfRangeBeginEndStmt ()),
61
63
unless (hasSourceExpression (ignoringParens (stringLiteral ()))),
Original file line number Diff line number Diff line change @@ -186,6 +186,10 @@ Changes in existing checks
186
186
<clang-tidy/checks/cppcoreguidelines/prefer-member-initializer>` check to
187
187
ignore delegate constructors.
188
188
189
+ - Improved :doc `cppcoreguidelines-pro-bounds-array-to-pointer-decay
190
+ <clang-tidy/checks/cppcoreguidelines/pro-bounds-array-to-pointer-decay> ` check
191
+ to ignore predefined expression (e.g., ``__func__ ``, ...).
192
+
189
193
- Improved :doc: `cppcoreguidelines-pro-type-member-init
190
194
<clang-tidy/checks/cppcoreguidelines/pro-type-member-init>` check to ignore
191
195
dependent delegate constructors.
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ const char *g() {
43
43
const char *g2 () {
44
44
return (" clang" ); // OK, ParenExpr hides the literal-pointer decay
45
45
}
46
+ const char *g3 () {
47
+ return __func__; // OK, don't diagnose PredefinedExpr
48
+ }
46
49
47
50
void f2 (void *const *);
48
51
void bug25362 () {
You can’t perform that action at this time.
0 commit comments