Skip to content

Commit

Permalink
[Coroutines] Support opaque pointers in solveTypeName()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nikic committed Mar 10, 2022
1 parent 0803dba commit 479d684
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,10 @@ static StringRef solveTypeName(Type *Ty) {
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";
Expand Down

0 comments on commit 479d684

Please sign in to comment.