[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Analysis / OSAtomic_mac.c
blob5cf7e930143235f3d378756dc1e8c396bad13054
1 // RUN: %clang_analyze_cc1 -w -analyzer-checker=core,debug.ExprInspection \
2 // RUN: -analyzer-output=text -verify %s
4 extern void clang_analyzer_eval(int);
6 int OSAtomicCompareAndSwapPtrBarrier(void *, void *, void **);
7 int OSAtomicCompareAndSwapPtrBarrier(void *, void *, void **) {
8 // There is some body in the actual header,
9 // but we should trust our BodyFarm instead.
12 int *invalidSLocOnRedecl(void) {
13 // Was crashing when trying to throw a report about returning an uninitialized
14 // value to the caller. FIXME: We should probably still throw that report,
15 // something like "The "compare" part of CompareAndSwap depends on an
16 // undefined value".
17 int *b;
18 OSAtomicCompareAndSwapPtrBarrier(0, 0, &b); // no-crash
19 return b;
22 void testThatItActuallyWorks(void) {
23 void *x = 0;
24 int res = OSAtomicCompareAndSwapPtrBarrier(0, &x, &x);
25 clang_analyzer_eval(res); // expected-warning{{TRUE}}
26 // expected-note@-1{{TRUE}}
27 clang_analyzer_eval(x == &x); // expected-warning{{TRUE}}
28 // expected-note@-1{{TRUE}}