1 // RUN: %clang_analyze_cc1 -w -analyzer-checker=core,debug.ExprInspection \
2 // RUN: -analyzer-output=text -verify %s
4 int OSAtomicCompareAndSwapPtrBarrier(void *, void *, void **);
5 int OSAtomicCompareAndSwapPtrBarrier(void *, void *, void **) {
6 // There is some body in the actual header,
7 // but we should trust our BodyFarm instead.
10 int *invalidSLocOnRedecl(void) {
11 // Was crashing when trying to throw a report about returning an uninitialized
12 // value to the caller. FIXME: We should probably still throw that report,
13 // something like "The "compare" part of CompareAndSwap depends on an
16 OSAtomicCompareAndSwapPtrBarrier(0, 0, &b
); // no-crash
20 void testThatItActuallyWorks(void) {
22 int res
= OSAtomicCompareAndSwapPtrBarrier(0, &x
, &x
);
23 clang_analyzer_eval(res
); // expected-warning{{TRUE}}
24 // expected-note@-1{{TRUE}}
25 clang_analyzer_eval(x
== &x
); // expected-warning{{TRUE}}
26 // expected-note@-1{{TRUE}}