Files
clang-p2996/clang/test/Analysis/mutually_exclusive_null_fp.cpp
Aaron Ballman d618f1c3b1 Remove rdar links; NFC
This removes links to rdar, which is an internal bug tracker that the
community doesn't have visibility into.

See further discussion at:
https://discourse.llvm.org/t/code-review-reminder-about-links-in-code-commit-messages/71847
2023-07-07 08:41:11 -04:00

25 lines
471 B
C++

// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
// expected-no-diagnostics
struct Data {
int x;
Data *data;
};
int compare(Data &a, Data &b) {
Data *aData = a.data;
Data *bData = b.data;
// Covers the cases where both pointers are null as well as both pointing to the same buffer.
if (aData == bData)
return 0;
if (aData && !bData)
return 1;
if (!aData && bData)
return -1;
return compare(*aData, *bData); // no-warning
}