| 51 | const llvm::DataLayout *DL; |
| 52 | |
| 53 | bool hasOpaqueType(llvm::Type *ty) { |
| 54 | if (auto aty = llvm::dyn_cast<llvm::StructType>(ty)) { |
| 55 | if (aty->isOpaque()) |
| 56 | return true; |
| 57 | |
| 58 | for (auto elemty : aty->elements()) |
| 59 | if (hasOpaqueType(elemty)) |
| 60 | return true; |
| 61 | } else if (auto aty = llvm::dyn_cast<llvm::ArrayType>(ty)) |
| 62 | return hasOpaqueType(aty->getElementType()); |
| 63 | else if (auto vty = llvm::dyn_cast<llvm::VectorType>(ty)) |
| 64 | return hasOpaqueType(vty->getElementType()); |
| 65 | |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | } |
| 70 |