================
@@ -8,24 +8,30 @@ struct MyObj {
~MyObj() {}
};
-MyObj &free_param(MyObj &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\]\]}}"
+MyObj &free_param(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\]\]}}"
+);
MyObj &free_param(MyObj &obj [[clang::lifetimebound]]) { // expected-note
{{'lifetimebound' attribute appears here on the definition}}
return obj;
}
struct S {
MyObj data;
- const MyObj &implicit_this_only(); // 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\]\]}}"
+ const MyObj &implicit_this_only(
+ ); // 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\]\]}}"
- const MyObj ¶m_only(const MyObj &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\]\]}}"
+ const MyObj ¶m_only(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\]\]}}"
+ );
- const MyObj &both(const MyObj &obj, bool); // expected-warning 2
{{'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\]\]}}"
- // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:{{[0-9]+}}-[[@LINE-2]]:{{[0-9]+}}}:"
{{\[\[clang::lifetimebound\]\]}}"
+ const MyObj &both(const MyObj & // 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+4]]:{{[0-9]+}}-[[@LINE+4]]:{{[0-9]+}}}:"
{{\[\[clang::lifetimebound\]\]}}"
----------------
davidmenggx wrote:
The ordering of checks here and on line 56 is needed due to the order the
diagnostics are emitted between the implicit `this` param and the other param.
If this is unclear, I can revert back to the original format
https://github.com/llvm/llvm-project/pull/199149
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits