================
@@ -11,6 +11,11 @@ struct S {
void h(const char*) __attribute__((nonnull(1))); // \
expected-error{{invalid for the implicit this argument}}
+
+ void i(this S* self, const char*) __attribute__((nonnull(1)));
+
+ void j(this S* self, const char*) __attribute__((nonnull(3))); // \
+ expected-error{{'nonnull' attribute parameter 1 is out of bounds}}
----------------
vvuksanovic wrote:
Do you mean something like this:
```cpp
void k(this S* self, const char*) __attribute__((nonnull(2, 3))); // \
expected-error{{'nonnull' attribute parameter 2 is out of bounds}}
```
All indexes for `nonnull` are treated the same, so it works as param index 1.
Also, what do you suggest the diagnostic message for this should be:
```cpp
void i(this S* self, const char*) __attribute__((nonnull(1)));
```
It it had an implicit 'this', it would emit "'nonnull' attribute is invalid for
the implicit this argument". Should I change it to something like "'nonnull'
attribute is invalid for the 'this' argument".
https://github.com/llvm/llvm-project/pull/165586
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits