[PATCH] D121280: [Coroutines] Support opaque pointers in solveTypeName()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 04:06:22 PST 2022


nikic created this revision.
nikic added reviewers: ChuanqiXu, lxfind, opaque-pointers.
Herald added subscribers: dexonsmith, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


https://reviews.llvm.org/D121280

Files:
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp


Index: llvm/lib/Transforms/Coroutines/CoroFrame.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -808,9 +808,10 @@
     return "__floating_type_";
   }
 
-  if (Ty->isPointerTy()) {
-    auto *PtrTy = cast<PointerType>(Ty);
-    Type *PointeeTy = PtrTy->getPointerElementType();
+  if (auto *PtrTy = dyn_cast<PointerType>(Ty)) {
+    if (PtrTy->isOpaque())
+      return "PointerType";
+    Type *PointeeTy = PtrTy->getNonOpaquePointerElementType();
     auto Name = solveTypeName(PointeeTy);
     if (Name == "UnknownType")
       return "PointerType";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121280.414058.patch
Type: text/x-patch
Size: 678 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220309/17b46796/attachment.bin>


More information about the llvm-commits mailing list