[clang] [clang][bytecode] Remove unnecessary null check (PR #174368)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 4 23:49:35 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
A null Pointee shouldn't happen anymore.
---
Full diff: https://github.com/llvm/llvm-project/pull/174368.diff
1 Files Affected:
- (modified) clang/lib/AST/ByteCode/Pointer.cpp (+2-3)
``````````diff
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)
``````````
</details>
https://github.com/llvm/llvm-project/pull/174368
More information about the cfe-commits
mailing list