[clang] [clang]bytecode] Add degenerate pointers (PR #160086)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 24 14:10:50 PDT 2025
================
@@ -252,14 +264,19 @@ class Pointer {
/// Checks if the pointer is null.
bool isZero() const {
- if (isBlockPointer())
+ switch (StorageKind) {
+ case Storage::Int:
+ return Int.Value == 0 && Offset == 0;
+ case Storage::Block:
return BS.Pointee == nullptr;
- if (isFunctionPointer())
- return Fn.isZero();
- if (isTypeidPointer())
+ case Storage::Fn:
+ return asFunctionPointer().isZero();
+ case Storage::Typeid:
return false;
- assert(isIntegralPointer());
- return Int.Value == 0 && Offset == 0;
+ case Storage::Degen:
+ return DP.Pointee == nullptr;
----------------
shafik wrote:
How do we end up w/ a degenerate pointer that is `nullptr`? Is this testable?
https://github.com/llvm/llvm-project/pull/160086
More information about the cfe-commits
mailing list