================
@@ -234,8 +234,14 @@ class Pointer {
 
   /// Returns the type of the innermost field.
   QualType getType() const {
-    if (inPrimitiveArray() && Offset != Base)
-      return 
getFieldDesc()->getType()->getAsArrayTypeUnsafe()->getElementType();
+    if (inPrimitiveArray() && Offset != Base) {
+      // Unfortunately, complex types are not array types in clang, but they 
are
+      // for us.
+      if (const auto *AT = getFieldDesc()->getType()->getAsArrayTypeUnsafe())
+        return AT->getElementType();
+      if (const auto *CT = getFieldDesc()->getType()->castAs<ComplexType>())
----------------
AaronBallman wrote:

```suggestion
      if (const auto *CT = getFieldDesc()->getType()->getAs<ComplexType>())
```
Otherwise you wouldn't need the `if` at all because we'd assert if the type was 
wrong.

https://github.com/llvm/llvm-project/pull/79269
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to