================
@@ -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;
-    QT = Pointee;
+    }
+    TypePtr = Pointee.getTypePtr();
   }
-  if (const auto *FPT = QT->getAs<FunctionProtoType>())
+  if (const auto *FPT = TypePtr->getAs<FunctionProtoType>())
----------------
Sirraide wrote:

> I discovered that it uses isAnyPointerType() which fails for PTMF (as 
> commented above).

Ah, right, I missed the comment there... member pointers aren’t pointers; 
annoying. I wonder if we should add a `bool` parameter to a bunch of those 
functions along the lines of `bool Type::isAnyPointerType(bool 
IncludeMemberPointers = false)` because the terminology is a bit unfortunate 
here.

Wait, but actually, why does `getPointeeType` include member pointers but 
`getPointeeOrArrayElementType` doesn’t? As in, I know why, it’s because of the 
call to `isAnyPointerType()`, but I’m not convinced that’s the intent here. 

We happen to have a meeting in about an hour, so I’ll just ask about it there; 
I’ll get back to you on this after that.

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