llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/215054.diff


1 Files Affected:

- (modified) clang/lib/AST/ByteCode/Pointer.cpp (+11-5) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp 
b/clang/lib/AST/ByteCode/Pointer.cpp
index b987b350f9537..4f36d20b352cb 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -176,28 +176,34 @@ APValue Pointer::toAPValue(const ASTContext &ASTCtx) 
const {
   if (isZero())
     return APValue(APValue::LValueBase(), CharUnits::Zero(), Path,
                    /*IsOnePastEnd=*/false, /*IsNullPtr=*/true);
-  if (isIntegralPointer())
+
+  switch (StorageKind) {
+  case Storage::Int:
     return APValue(static_cast<const Expr *>(nullptr),
                    CharUnits::fromQuantity(asIntPointer().Value + 
this->Offset),
                    Path,
                    /*IsOnePastEnd=*/false, /*IsNullPtr=*/false);
-  if (isFunctionPointer()) {
+  case Storage::Block:
+    // See below.
+    break;
+  case Storage::Fn: {
     const FunctionPointer &FP = asFunctionPointer();
     if (const FunctionDecl *FD = FP.Func->getDecl())
       return APValue(FD, CharUnits::fromQuantity(Offset), {},
                      /*OnePastTheEnd=*/false, /*IsNull=*/false);
     return APValue(FP.Func->getExpr(), CharUnits::fromQuantity(Offset), {},
                    /*OnePastTheEnd=*/false, /*IsNull=*/false);
-  }
-
-  if (isTypeidPointer()) {
+  } break;
+  case Storage::Typeid: {
     TypeInfoLValue TypeInfo(Typeid.TypePtr);
     return APValue(APValue::LValueBase::getTypeInfo(
                        TypeInfo, QualType(Typeid.TypeInfoType, 0)),
                    CharUnits::Zero(), {},
                    /*OnePastTheEnd=*/false, /*IsNull=*/false);
+  } break;
   }
 
+  assert(isBlockPointer());
   // Build the lvalue base from the block.
   const Descriptor *Desc = getDeclDesc();
   APValue::LValueBase Base;

``````````

</details>


https://github.com/llvm/llvm-project/pull/215054
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to