Skip to content

Commit ec1dba9

Browse files
committed
WebKit checkers: recgonize @yES / @no as safe constants (llvm#148721)
1 parent ade7ba4 commit ec1dba9

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
@@ -178,7 +178,10 @@ bool tryToFindPtrOrigin(
178178
E = unaryOp->getSubExpr();
179179
continue;
180180
}
181-
181+
if (auto *BoxedExpr = dyn_cast<ObjCBoxedExpr>(E)) {
182+
E = BoxedExpr->getSubExpr();
183+
continue;
184+
}
182185
break;
183186
}
184187
// 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
@@ -328,13 +328,17 @@ void foo() {
328328
}
329329
}
330330

331+
#define YES 1
332+
331333
namespace call_with_cf_constant {
332334
void bar(const NSArray *);
333335
void baz(const NSDictionary *);
336+
void boo(NSNumber *);
334337
void foo() {
335338
CFArrayCreateMutable(kCFAllocatorDefault, 10);
336339
bar(@[@"hello"]);
337340
baz(@{@"hello": @3});
341+
boo(@YES);
338342
}
339343
}
340344

0 commit comments

Comments
 (0)