[clang] e16860b - [clang][bytecode] Remove unnecessary null check (#174368)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 5 01:48:31 PST 2026


Author: Timm Baeder
Date: 2026-01-05T10:48:27+01:00
New Revision: e16860be5e1cd39df072aca805b38a6e2c2668a5

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

LOG: [clang][bytecode] Remove unnecessary null check (#174368)

A null Pointee shouldn't happen anymore.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Pointer.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 2e38c1bb65d36..5d11321d09079 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -33,13 +33,12 @@ Pointer::Pointer(Block *Pointee, uint64_t BaseAndOffset)
 
 Pointer::Pointer(Block *Pointee, unsigned Base, uint64_t Offset)
     : Offset(Offset), StorageKind(Storage::Block) {
+  assert(Pointee);
   assert((Base == RootPtrMark || Base % alignof(void *) == 0) && "wrong base");
   assert(Base >= Pointee->getDescriptor()->getMetadataSize());
 
   BS = {Pointee, Base, nullptr, nullptr};
-
-  if (Pointee)
-    Pointee->addPointer(this);
+  Pointee->addPointer(this);
 }
 
 Pointer::Pointer(const Pointer &P)


        


More information about the cfe-commits mailing list