llvm-project/clang/test/Analysis/report-uniqueing.cpp
Balázs Kéri 1745ba41b1 [Analyzer] Remove inclusion of uniqueing decl from diagnostic profile.
The uniqueing decl in PathDiagnostic is the declaration with the
uniqueing loc, as stated by documentation comments.
It is enough to include the uniqueing loc in the profile. It is possible
to have objects with different uniqueing decl but same location, at
least with templates. These belong to the same class and should have
same profile.

Reviewed By: vsavchenko, NoQ

Differential Revision: https://reviews.llvm.org/D84843
2020-07-30 09:52:28 +02:00

17 lines
430 B
C++

// RUN: %clang_analyze_cc1 -verify %s \
// RUN: -analyzer-checker=security
void bzero(void *, unsigned long);
template <typename T> void foo(T l) {
// The warning comes from multiple instances and with
// different declarations that have same source location.
// One instance should be shown.
bzero(l, 1); // expected-warning{{The bzero() function is obsoleted}}
}
void p(int *p, unsigned *q) {
foo(p);
foo(q);
}