blob: ed3f2d09857c238eca014296ab7525afe878c0b6 [file] [log] [blame]
Valeriy Savchenkoe63b488f2020-07-07 11:36:20 +03001// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
2
3// rdar://problem/56586853
4// expected-no-diagnostics
5
6struct Data {
7 int x;
8 Data *data;
9};
10
11int compare(Data &a, Data &b) {
12 Data *aData = a.data;
13 Data *bData = b.data;
14
15 // Covers the cases where both pointers are null as well as both pointing to the same buffer.
16 if (aData == bData)
17 return 0;
18
19 if (aData && !bData)
20 return 1;
21
22 if (!aData && bData)
23 return -1;
24
25 return compare(*aData, *bData); // no-warning
26}