[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 16 15:36:53 PST 2025
================
@@ -246,6 +246,26 @@ void PTMFTester::convert() [[clang::nonblocking]]
(this->*mConvertFunc)();
}
+// Allow implicit conversion from array to pointer.
+void nb14(unsigned idx) [[clang::nonblocking]]
+{
+ using FP = void (*)() [[clang::nonblocking]];
+ using FPArray = FP[2];
+ auto nb = +[]() [[clang::nonblocking]] {};
+
+ FPArray src{ nb, nullptr };
+ FP f = src[idx]; // This should not generate a warning.
+
+ FP twoDim[2][2] = {};
+ FP g = twoDim[1][1];
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wvla-extension"
+ FP vla[idx];
+#pragma clang diagnostic pop
----------------
Sirraide wrote:
I think it’s fine to either just throw `-Wno-vla-extension` into the `RUN` line or to add `expected-` directives for this and the notes it produces. We generally try to avoid disabling and then reenabling warnings with `#pragma`s in tests because that just ends up being a bit hard to follow...
https://github.com/llvm/llvm-project/pull/121525
More information about the cfe-commits
mailing list