[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

via cfe-commits cfe-commits at lists.llvm.org
Sat May 4 10:26:40 PDT 2024


================
@@ -1870,6 +1870,28 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType,
       FromFn = QT->getAs<FunctionType>();
       Changed = true;
     }
+
+    // For C, when called from checkPointerTypesForAssignment,
+    // we need not to alter FromFn, or else even an innocuous cast
+    // like dropping effects will fail. In C++ however we do want to
+    // alter FromFn. TODO: Is this correct?
+    if (getLangOpts().CPlusPlus) {
+      FromFPT =
+          dyn_cast<FunctionProtoType>(FromFn); // in case FromFn changed above
----------------
Sirraide wrote:

> No, that one’s different.

Specifically, what that code is doing is it checks whether `FromFn` is a `FunctionProtoType`, and then goes ahead and assumes that `ToFn` must be as well if it is.

https://github.com/llvm/llvm-project/pull/84983


More information about the cfe-commits mailing list