Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / mutually_exclusive_null_fp.cpp
blobe74e4e7be3580b536a01202c2bf3a8aefebe182d
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
2 // expected-no-diagnostics
4 struct Data {
5 int x;
6 Data *data;
7 };
9 int compare(Data &a, Data &b) {
10 Data *aData = a.data;
11 Data *bData = b.data;
13 // Covers the cases where both pointers are null as well as both pointing to the same buffer.
14 if (aData == bData)
15 return 0;
17 if (aData && !bData)
18 return 1;
20 if (!aData && bData)
21 return -1;
23 return compare(*aData, *bData); // no-warning