From 479d684ba53e70fe39d002482a00ae007a3d64cd Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 4 Mar 2022 13:25:05 +0100 Subject: [PATCH] [Coroutines] Support opaque pointers in solveTypeName() As far as I can tell, these names are only intended to be informative, so just use a generic "PointerType" for opaque pointers. The code in solveDIType() also treats pointers as basic types (and does not try to encode the pointed-to type further), so I believe this should be fine. Differential Revision: https://reviews.llvm.org/D121280 --- llvm/lib/Transforms/Coroutines/CoroFrame.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index ee88e95924b9..c2f4fe071dd6 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -808,9 +808,10 @@ static StringRef solveTypeName(Type *Ty) { return "__floating_type_"; } - if (Ty->isPointerTy()) { - auto *PtrTy = cast(Ty); - Type *PointeeTy = PtrTy->getPointerElementType(); + if (auto *PtrTy = dyn_cast(Ty)) { + if (PtrTy->isOpaque()) + return "PointerType"; + Type *PointeeTy = PtrTy->getNonOpaquePointerElementType(); auto Name = solveTypeName(PointeeTy); if (Name == "UnknownType") return "PointerType";