================
@@ -93,10 +115,43 @@ View friend_redecl(MyObj &obj) {
template <typename T>
// FIXME: Current analysis suggests adding to the primary template
declaration, which is not ideal, as it will affect all specializations.
MyObj &spec_func(T &obj); // expected-warning {{'lifetimebound' attribute on
this definition is not visible to callers before the definition; add it to the
declaration instead}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:{{[0-9]+}}-[[@LINE-1]]:{{[0-9]+}}}:"
{{\[\[clang::lifetimebound\]\]}}"
template <>
// FIXME: Attribute is inhetired, diagnostic's wording is not correct.
MyObj &spec_func<MyObj>(MyObj &obj [[clang::lifetimebound]]); // expected-note
{{'lifetimebound' attribute appears here on the definition}}
template <>
MyObj &spec_func<MyObj>(MyObj &obj) { return obj; }
+
+MyObj get_default_obj();
+const MyObj &default_arg_param(const MyObj&
+ obj // CHECK:
fix-it:"{{.*}}":{[[@LINE]]:{{[0-9]+}}-[[@LINE]]:{{[0-9]+}}}:"
{{\[\[clang::lifetimebound\]\]}}"
+ = get_default_obj()); // expected-warning@-2 {{'lifetimebound' attribute
on this definition is not visible to callers before the definition; add it to
the declaration instead}}
+
----------------
usx95 wrote:
Formatting suggestion:
```cpp
const MyObj &default_arg_param(const MyObj& // expected-warning
{{'lifetimebound' attribute on this definition is not visible to callers before
the definition; add it to the declaration instead}}
obj // CHECK:
fix-it:"{{.*}}":{[[@LINE]]:{{[0-9]+}}-[[@LINE]]:{{[0-9]+}}}:"
{{\[\[clang::lifetimebound\]\]}}"
= get_default_obj());
```
Can you please do that at other places using `// expected-warning@-2` to attach
directly at the correct line number.
https://github.com/llvm/llvm-project/pull/199149
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits