Skip to content

Commit ae3bba4

Browse files
authored
WebKit checkers: recgonize @yES / @no as safe constants (#148721)
1 parent c36156d commit ae3bba4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ bool tryToFindPtrOrigin(
177177
E = unaryOp->getSubExpr();
178178
continue;
179179
}
180-
180+
if (auto *BoxedExpr = dyn_cast<ObjCBoxedExpr>(E)) {
181+
E = BoxedExpr->getSubExpr();
182+
continue;
183+
}
181184
break;
182185
}
183186
// Some other expression.

clang/test/Analysis/Checkers/WebKit/unretained-call-args.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,17 @@ void foo() {
329329
}
330330
}
331331

332+
#define YES 1
333+
332334
namespace call_with_cf_constant {
333335
void bar(const NSArray *);
334336
void baz(const NSDictionary *);
337+
void boo(NSNumber *);
335338
void foo() {
336339
CFArrayCreateMutable(kCFAllocatorDefault, 10);
337340
bar(@[@"hello"]);
338341
baz(@{@"hello": @3});
342+
boo(@YES);
339343
}
340344
}
341345

0 commit comments

Comments
 (0)