[clang] 3a07280 - [analyzer] Fix wrong annotation of PointerToMemberData

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 1 07:13:22 PDT 2022


Author: Balazs Benics
Date: 2022-06-01T16:12:54+02:00
New Revision: 3a07280290564e294c957c94c918a6680714b417

URL: https://github.com/llvm/llvm-project/commit/3a07280290564e294c957c94c918a6680714b417
DIFF: https://github.com/llvm/llvm-project/commit/3a07280290564e294c957c94c918a6680714b417.diff

LOG: [analyzer] Fix wrong annotation of PointerToMemberData

Unfortunately I don't have a reproducer for this.
Reported by @mikaelholmen!

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
index 457247bcdf553..59bfbe3dea77b 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
@@ -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 @@ class PointerToMemberData : public llvm::FoldingSetNode {
 
   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 {


        


More information about the cfe-commits mailing list