================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits