================
@@ -8836,13 +8836,22 @@ void FixedPointValueToString(SmallVectorImpl<char> 
&Str, llvm::APSInt Val,
                              unsigned Scale);
 
 inline FunctionEffectsRef FunctionEffectsRef::get(QualType QT) {
+  const Type *TypePtr = QT.getTypePtr();
   while (true) {
-    QualType Pointee = QT->getPointeeType();
-    if (Pointee.isNull())
+    // Note that getPointeeType() seems to successfully navigate some 
constructs
+    // for which isAnyPointerType() returns false (e.g.
+    // pointer-to-member-function).
+    QualType Pointee = TypePtr->getPointeeType();
+    if (Pointee.isNull()) {
+      if (TypePtr->isArrayType()) {
+        TypePtr = TypePtr->getBaseElementTypeUnsafe();
+        continue;
+      }
       break;
----------------
Sirraide wrote:

```suggestion
    if (QualType Pointee = TypePtr->getPointeeType())
      TypePtr = Pointee.getTypePtr();
    else if (TypePtr->isArrayType())
      TypePtr = TypePtr->getBaseElementTypeUnsafe();
    else
      break;
```
Another option would be to write the entire loop body like this (github won’t 
let me make a suggestion across deleted lines...), but I don’t have strong 
opinions on this, so feel pick whichever one you prefer I’d say.

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

Reply via email to