[clang] [Parser][BoundsSafety] Print attribute as macro if it's system defined (PR #107619)
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 6 15:19:38 PDT 2024
================
@@ -14,12 +16,26 @@ void Func() {
auto NODEREF auto_i2 = i; // expected-warning{{'noderef' can only be used on an array or pointer type}}
}
+// The diagnostic message is hard-coded as 'noderef' so using a system macro doesn't change the behavior
+void Func_system_macro() {
+ int _SYS_NODEREF i; // expected-warning{{'noderef' can only be used on an array or pointer type}}
+ int _SYS_NODEREF *i_ptr;
+
+ auto _SYS_NODEREF *auto_i_ptr2 = i_ptr;
+ auto _SYS_NODEREF auto_i2 = i; // expected-warning{{'noderef' can only be used on an array or pointer type}}
+}
+
+
// Added test for fix for P41835
#define _LIBCPP_FLOAT_ABI __attribute__((pcs("aapcs")))
struct A {
_LIBCPP_FLOAT_ABI int operator()() throw(); // expected-warning{{'pcs' calling convention is not supported for this target}}
};
+struct A_system_macro {
+ _SYS_LIBCPP_FLOAT_ABI int operator()() throw(); // expected-warning{{'_SYS_LIBCPP_FLOAT_ABI' calling convention is not supported for this target}}
----------------
zygoloid wrote:
Yes, if we're always pointing the caret at the attribute itself so we get an 'expanded from macro' note, that seems fine.
https://github.com/llvm/llvm-project/pull/107619
More information about the cfe-commits
mailing list