diff --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp --- a/clang/lib/Analysis/PathDiagnostic.cpp +++ b/clang/lib/Analysis/PathDiagnostic.cpp @@ -1134,7 +1134,6 @@ void PathDiagnostic::Profile(llvm::FoldingSetNodeID &ID) const { ID.Add(getLocation()); ID.Add(getUniqueingLoc()); - ID.AddPointer(getUniqueingLoc().isValid() ? getUniqueingDecl() : nullptr); ID.AddString(BugType); ID.AddString(VerboseDesc); ID.AddString(Category); diff --git a/clang/test/Analysis/report-uniqueing.cpp b/clang/test/Analysis/report-uniqueing.cpp new file mode 100644 --- /dev/null +++ b/clang/test/Analysis/report-uniqueing.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -analyzer-checker=security + +void bzero(void *, unsigned long); + +template 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); +}