[clang] 3388c5a - [clang][Interp][NFC] Add missing assertion to Block ctor

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 5 04:57:34 PDT 2024


Author: Timm Bäder
Date: 2024-06-05T13:57:23+02:00
New Revision: 3388c5aadd8583b5a596576c52be886104d557f2

URL: https://github.com/llvm/llvm-project/commit/3388c5aadd8583b5a596576c52be886104d557f2
DIFF: https://github.com/llvm/llvm-project/commit/3388c5aadd8583b5a596576c52be886104d557f2.diff

LOG: [clang][Interp][NFC] Add missing assertion to Block ctor

We have this assertion in all the other constructors.

Added: 
    

Modified: 
    clang/lib/AST/Interp/InterpBlock.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/InterpBlock.h b/clang/lib/AST/Interp/InterpBlock.h
index 506034e880d0b..2bb195648a9a9 100644
--- a/clang/lib/AST/Interp/InterpBlock.h
+++ b/clang/lib/AST/Interp/InterpBlock.h
@@ -125,13 +125,15 @@ class Block final {
   void dump() const { dump(llvm::errs()); }
   void dump(llvm::raw_ostream &OS) const;
 
-protected:
+private:
   friend class Pointer;
   friend class DeadBlock;
   friend class InterpState;
 
   Block(const Descriptor *Desc, bool IsExtern, bool IsStatic, bool IsDead)
-      : IsStatic(IsStatic), IsExtern(IsExtern), IsDead(true), Desc(Desc) {}
+      : IsStatic(IsStatic), IsExtern(IsExtern), IsDead(true), Desc(Desc) {
+    assert(Desc);
+  }
 
   /// Deletes a dead block at the end of its lifetime.
   void cleanup();


        


More information about the cfe-commits mailing list