================
@@ -5854,16 +5854,43 @@ bool Compiler<Emitter>::visitAPValue(const APValue 
&Val, PrimType ValType,
       return this->emitNull(ValType, 0, nullptr, Info);
 
     APValue::LValueBase Base = Val.getLValueBase();
-    ArrayRef<APValue::LValuePathEntry> Path = Val.getLValuePath();
-
-    if (const Expr *BaseExpr = Base.dyn_cast<const Expr *>())
-      return this->visit(BaseExpr);
-    if (const auto *VD = Base.dyn_cast<const ValueDecl *>()) {
+    QualType EntryType;
+    if (const Expr *BaseExpr = Base.dyn_cast<const Expr *>()) {
+      if (!this->visit(BaseExpr))
+        return false;
+      EntryType = BaseExpr->getType();
+    } else if (const auto *VD = Base.dyn_cast<const ValueDecl *>()) {
       if (!this->visitDeclRef(VD, Info.asExpr()))
         return false;
+      EntryType = VD->getType();
+    } else if (Base.is<TypeInfoLValue>()) {
+      EntryType = Base.getTypeInfoType();
+      if (!this->emitGetTypeid(Base.get<TypeInfoLValue>()
+                                   .getType()
+                                   ->getCanonicalTypeUnqualified()
+                                   .getTypePtr(),
+                               EntryType.getTypePtr(), Info))
+        return false;
+    } else if (!Base) {
+      // An integer cast to a pointer.
+      const Expr *E = Info.asExpr();
+      if (!E)
+        return false;
+      QualType PtrType = E->isGLValue()
+                             ? Ctx.getASTContext().getPointerType(E->getType())
+                             : E->getType();
+      uint64_t Offset = Val.getLValueOffset().getQuantity();
+      if (!this->emitConst(Offset, PT_Uint64, Info))
+        return false;
+      if (!this->emitGetIntPtr(PT_Uint64, PtrType.getTypePtr(), Info))
----------------
tbaederr wrote:

```suggestion
      if (!this->emitGetIntPtrUint64(PtrType.getTypePtr(), Info))
```

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

Reply via email to