[analyzer] Fix wrong annotation of PointerToMemberData
authorBalazs Benics <balazs.benics@sigmatechnology.se>
Wed, 1 Jun 2022 14:12:54 +0000 (16:12 +0200)
committerBalazs Benics <balazs.benics@sigmatechnology.se>
Wed, 1 Jun 2022 14:12:54 +0000 (16:12 +0200)
Unfortunately I don't have a reproducer for this.
Reported by @mikaelholmen!

Differential Revision: https://reviews.llvm.org/D126198

clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h

index 457247b..59bfbe3 100644 (file)
@@ -90,9 +90,7 @@ class PointerToMemberData : public llvm::FoldingSetNode {
 public:
   PointerToMemberData(const NamedDecl *D,
                       llvm::ImmutableList<const CXXBaseSpecifier *> L)
-      : D(D), L(L) {
-    assert(D);
-  }
+      : D(D), L(L) {}
 
   using iterator = llvm::ImmutableList<const CXXBaseSpecifier *>::iterator;
 
@@ -104,7 +102,7 @@ public:
 
   void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, D, L); }
 
-  LLVM_ATTRIBUTE_RETURNS_NONNULL
+  /// It might return null.
   const NamedDecl *getDeclaratorDecl() const { return D; }
 
   llvm::ImmutableList<const CXXBaseSpecifier *> getCXXBaseList() const {