https://github.com/usx95 created 
https://github.com/llvm/llvm-project/pull/207345

None

>From d528cd28638e3e5c9295d8baac2e626d9571a908 Mon Sep 17 00:00:00 2001
From: Utkarsh Saxena <[email protected]>
Date: Fri, 3 Jul 2026 08:16:51 +0000
Subject: [PATCH] annotation-suggestion-loc

---
 clang/lib/Sema/SemaLifetimeSafety.h           |  4 +-
 .../annotation-suggestions-fixits.cpp         | 36 ++++++------
 .../misplaced-lifetimebound-cross-tu.cpp      | 18 +++---
 .../misplaced-lifetimebound-intra-tu.cpp      | 58 +++++++++----------
 4 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/clang/lib/Sema/SemaLifetimeSafety.h 
b/clang/lib/Sema/SemaLifetimeSafety.h
index 3b9ea9eafbec5..48edf5f3f070f 100644
--- a/clang/lib/Sema/SemaLifetimeSafety.h
+++ b/clang/lib/Sema/SemaLifetimeSafety.h
@@ -296,7 +296,7 @@ class LifetimeSafetySemaHelperImpl : public 
LifetimeSafetySemaHelper {
 
     auto [InsertionPoint, FixItText] = getLifetimeBoundFixIt(ParmToAnnotate);
 
-    S.Diag(ParmToAnnotate->getBeginLoc(), DiagID)
+    S.Diag(InsertionPoint, DiagID)
         << ParmToAnnotate->getSourceRange()
         << FixItHint::CreateInsertion(InsertionPoint, FixItText);
 
@@ -376,7 +376,7 @@ class LifetimeSafetySemaHelperImpl : public 
LifetimeSafetySemaHelper {
     if (IsMacro || InsertionPoint.isInvalid())
       S.Diag(PVDDecl->getBeginLoc(), DiagID) << PVDDecl->getSourceRange();
     else
-      S.Diag(PVDDecl->getBeginLoc(), DiagID)
+      S.Diag(InsertionPoint, DiagID)
           << PVDDecl->getSourceRange()
           << FixItHint::CreateInsertion(InsertionPoint, FixItText);
 
diff --git a/clang/test/Sema/LifetimeSafety/annotation-suggestions-fixits.cpp 
b/clang/test/Sema/LifetimeSafety/annotation-suggestions-fixits.cpp
index e2fb9dd5df40a..dde1c8f7e2431 100644
--- a/clang/test/Sema/LifetimeSafety/annotation-suggestions-fixits.cpp
+++ b/clang/test/Sema/LifetimeSafety/annotation-suggestions-fixits.cpp
@@ -42,9 +42,9 @@ struct [[gsl::Pointer()]] View {
 };
 
 View return_view(View a) {
-  // CHECK: :[[@LINE-1]]:18: warning: parameter in intra-TU function should be 
marked {{\[\[}}clang::lifetimebound]] [-Wlifetime-safety-intra-tu-suggestions]
+  // CHECK: :[[@LINE-1]]:24: warning: parameter in intra-TU function should be 
marked {{\[\[}}clang::lifetimebound]] [-Wlifetime-safety-intra-tu-suggestions]
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:24-[[@LINE-2]]:24}:" 
{{\[\[}}clang::lifetimebound]]"
-  // CHECK-MACRO: :[[@LINE-3]]:18: warning: parameter in intra-TU function 
should be marked
+  // CHECK-MACRO: :[[@LINE-3]]:24: warning: parameter in intra-TU function 
should be marked
   // CHECK-MACRO: fix-it:"{{.*}}":{[[@LINE-4]]:24-[[@LINE-4]]:24}:" 
LIFETIMEBOUND_MACRO"
   // CHECK-BAD-MACRO: :[[@LINE-5]]:25: error: expected ')'
   // CHECK-BAD-MACRO: BAD_LIFETIMEBOUND_MACRO
@@ -52,9 +52,9 @@ View return_view(View a) {
 }
 
 MyObj &return_multi(MyObj &a, bool c, MyObj &b) {
-  // CHECK-DAG: :[[@LINE-1]]:21: warning: parameter in intra-TU function 
should be marked
+  // CHECK-DAG: :[[@LINE-1]]:29: warning: parameter in intra-TU function 
should be marked
   // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-2]]:29-[[@LINE-2]]:29}:" 
{{\[\[}}clang::lifetimebound]]"
-  // CHECK-DAG: :[[@LINE-3]]:39: warning: parameter in intra-TU function 
should be marked
+  // CHECK-DAG: :[[@LINE-3]]:47: warning: parameter in intra-TU function 
should be marked
   // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-4]]:47-[[@LINE-4]]:47}:" 
{{\[\[}}clang::lifetimebound]]"
   if (c)
     return a;
@@ -62,7 +62,7 @@ MyObj &return_multi(MyObj &a, bool c, MyObj &b) {
 }
 
 View return_partial(View a [[clang::lifetimebound]], bool c, View b) {
-  // CHECK: :[[@LINE-1]]:62: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:68: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:68-[[@LINE-2]]:68}:" 
{{\[\[}}clang::lifetimebound]]"
   if (c)
     return a;
@@ -70,25 +70,25 @@ View return_partial(View a [[clang::lifetimebound]], bool 
c, View b) {
 }
 
 View param_with_attr(View a [[maybe_unused]]) {
-  // CHECK: :[[@LINE-1]]:22: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:28: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:28-[[@LINE-2]]:28}:" 
{{\[\[}}clang::lifetimebound]]"
   return a;
 }
 
 View param_default(View a = View()) {
-  // CHECK: :[[@LINE-1]]:20: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:26: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:26-[[@LINE-2]]:26}:" 
{{\[\[}}clang::lifetimebound]]"
   return a;
 }
 
 int *arr_default(int a[2] = nullptr) {
-  // CHECK: :[[@LINE-1]]:18: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:23: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:23-[[@LINE-2]]:23}:" 
{{\[\[}}clang::lifetimebound]]"
   return a;
 }
 
 View multi_decl(View a);
-// CHECK: :[[@LINE-1]]:17: warning: parameter in intra-TU function should be 
marked
+// CHECK: :[[@LINE-1]]:23: warning: parameter in intra-TU function should be 
marked
 // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:23-[[@LINE-2]]:23}:" 
{{\[\[}}clang::lifetimebound]]"
 View multi_decl(View a);
 View multi_decl(View a) {
@@ -97,7 +97,7 @@ View multi_decl(View a) {
 
 template <typename T>
 T *template_identity(T *a) {
-  // CHECK: :[[@LINE-1]]:22: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:26: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:26-[[@LINE-2]]:26}:" 
{{\[\[}}clang::lifetimebound]]"
   return a;
 }
@@ -197,7 +197,7 @@ struct TrailingReturn {
 #define GNU_LIFETIMEBOUND_MACRO __attribute__((lifetimebound))
 
 View return_view_with_gnu_macro(View a) {
-  // CHECK: :[[@LINE-1]]:33: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:39: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:39-[[@LINE-2]]:39}:" 
GNU_LIFETIMEBOUND_MACRO"
   return a;
 }
@@ -223,7 +223,7 @@ View unnamed_macro(View a) {
 }
 
 View return_view_with_macro(View a) {
-  // CHECK: :[[@LINE-1]]:29: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:35: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:35-[[@LINE-2]]:35}:" 
MY_LIFETIMEBOUND_MACRO"
   return a;
 }
@@ -232,9 +232,9 @@ View return_view_with_macro(View a) {
 #define SECOND_LIFETIMEBOUND_MACRO [[clang::lifetimebound]]
 
 View return_view_with_latest_macro(View a) {
-  // CHECK: :[[@LINE-1]]:36: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:42: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:42-[[@LINE-2]]:42}:" 
SECOND_LIFETIMEBOUND_MACRO"
-  // CHECK-MACRO: :[[@LINE-3]]:36: warning: parameter in intra-TU function 
should be marked
+  // CHECK-MACRO: :[[@LINE-3]]:42: warning: parameter in intra-TU function 
should be marked
   // CHECK-MACRO: fix-it:"{{.*}}":{[[@LINE-4]]:42-[[@LINE-4]]:42}:" 
LIFETIMEBOUND_MACRO"
   return a;
 }
@@ -242,7 +242,7 @@ View return_view_with_latest_macro(View a) {
 #define REDEFINED_LIFETIMEBOUND_MACRO [[clang::lifetimebound]]
 
 View return_view_with_redefined_macro(View a) {
-  // CHECK: :[[@LINE-1]]:39: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:45: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:45-[[@LINE-2]]:45}:" 
REDEFINED_LIFETIMEBOUND_MACRO"
   return a;
 }
@@ -251,7 +251,7 @@ View return_view_with_redefined_macro(View a) {
 #define REDEFINED_LIFETIMEBOUND_MACRO [[maybe_unused]]
 
 View return_view_after_redefined_macro(View a) {
-  // CHECK: :[[@LINE-1]]:40: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:46: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:46-[[@LINE-2]]:46}:" 
SECOND_LIFETIMEBOUND_MACRO"
   return a;
 }
@@ -259,7 +259,7 @@ View return_view_after_redefined_macro(View a) {
 #define UNDEFINED_LIFETIMEBOUND_MACRO [[clang::lifetimebound]]
 
 View return_view_with_undefined_macro(View a) {
-  // CHECK: :[[@LINE-1]]:39: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:45: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:45-[[@LINE-2]]:45}:" 
UNDEFINED_LIFETIMEBOUND_MACRO"
   return a;
 }
@@ -267,7 +267,7 @@ View return_view_with_undefined_macro(View a) {
 #undef UNDEFINED_LIFETIMEBOUND_MACRO
 
 View return_view_after_undefined_macro(View a) {
-  // CHECK: :[[@LINE-1]]:40: warning: parameter in intra-TU function should be 
marked
+  // CHECK: :[[@LINE-1]]:46: warning: parameter in intra-TU function should be 
marked
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:46-[[@LINE-2]]:46}:" 
SECOND_LIFETIMEBOUND_MACRO"
   return a;
 }
diff --git 
a/clang/test/Sema/LifetimeSafety/misplaced-lifetimebound-cross-tu.cpp 
b/clang/test/Sema/LifetimeSafety/misplaced-lifetimebound-cross-tu.cpp
index cade7c7a81105..1ccdb5253bf0c 100644
--- a/clang/test/Sema/LifetimeSafety/misplaced-lifetimebound-cross-tu.cpp
+++ b/clang/test/Sema/LifetimeSafety/misplaced-lifetimebound-cross-tu.cpp
@@ -10,9 +10,9 @@ struct HeaderObj {
   ~HeaderObj() {}
 };
 
-HeaderObj &header_param(HeaderObj &  // expected-warning {{'lifetimebound' 
attribute on this definition is not visible to callers in other translation 
units; add it to the declaration instead}}
-                                     // CHECK: 
cross.h:[[#PARAM_WARN_LINE:]]:{{[0-9]+}}: warning: 'lifetimebound' attribute on 
this definition is not visible
-                        obj          // CHECK: 
fix-it:"{{.*}}cross.h":{[[#PARAM_WARN_LINE+2]]:{{[0-9]+}}-[[#PARAM_WARN_LINE+2]]:{{[0-9]+}}}:"
 {{\[\[}}clang::lifetimebound{{\]\]}}"
+HeaderObj &header_param(HeaderObj &  obj  // expected-warning 
{{'lifetimebound' attribute on this definition is not visible to callers in 
other translation units; add it to the declaration instead}}
+                                          // CHECK: 
cross.h:[[#PARAM_WARN_LINE:]]:{{[0-9]+}}: warning: 'lifetimebound' attribute on 
this definition is not visible
+                                          // CHECK: 
fix-it:"{{.*}}cross.h":{[[#PARAM_WARN_LINE]]:{{[0-9]+}}-[[#PARAM_WARN_LINE]]:{{[0-9]+}}}:"
 {{\[\[}}clang::lifetimebound{{\]\]}}"
                         );
 
 struct HeaderS {
@@ -25,16 +25,16 @@ struct HeaderS {
 
 //--- cross_1.h
 struct HeaderObj;
-HeaderObj &multi_header_param(HeaderObj &  // expected-warning 
{{'lifetimebound' attribute on this definition is not visible to callers in 
other translation units; add it to the declaration instead}}
-                                           // CHECK: 
cross_1.h:[[#PARAM_WARN_LINE:]]:{{[0-9]+}}: warning: 'lifetimebound' attribute 
on this definition is not visible
-                              obj          // CHECK: 
fix-it:"{{.*}}cross_1.h":{[[#PARAM_WARN_LINE+2]]:{{[0-9]+}}-[[#PARAM_WARN_LINE+2]]:{{[0-9]+}}}:"
 {{\[\[}}clang::lifetimebound{{\]\]}}"
+HeaderObj &multi_header_param(HeaderObj &  obj  // expected-warning 
{{'lifetimebound' attribute on this definition is not visible to callers in 
other translation units; add it to the declaration instead}}
+                                                // CHECK: 
cross_1.h:[[#PARAM_WARN_LINE:]]:{{[0-9]+}}: warning: 'lifetimebound' attribute 
on this definition is not visible
+                                                // CHECK: 
fix-it:"{{.*}}cross_1.h":{[[#PARAM_WARN_LINE]]:{{[0-9]+}}-[[#PARAM_WARN_LINE]]:{{[0-9]+}}}:"
 {{\[\[}}clang::lifetimebound{{\]\]}}"
                               );
 
 //--- cross_2.h
 struct HeaderObj;
-HeaderObj &multi_header_param(HeaderObj &  // expected-warning 
{{'lifetimebound' attribute on this definition is not visible to callers in 
other translation units; add it to the declaration instead}}
-                                           // CHECK: 
cross_2.h:[[#PARAM_WARN_LINE:]]:{{[0-9]+}}: warning: 'lifetimebound' attribute 
on this definition is not visible
-                              obj          // CHECK: 
fix-it:"{{.*}}cross_2.h":{[[#PARAM_WARN_LINE+2]]:{{[0-9]+}}-[[#PARAM_WARN_LINE+2]]:{{[0-9]+}}}:"
 {{\[\[}}clang::lifetimebound{{\]\]}}"
+HeaderObj &multi_header_param(HeaderObj &  obj  // expected-warning 
{{'lifetimebound' attribute on this definition is not visible to callers in 
other translation units; add it to the declaration instead}}
+                                                // CHECK: 
cross_2.h:[[#PARAM_WARN_LINE:]]:{{[0-9]+}}: warning: 'lifetimebound' attribute 
on this definition is not visible
+                                                // CHECK: 
fix-it:"{{.*}}cross_2.h":{[[#PARAM_WARN_LINE]]:{{[0-9]+}}-[[#PARAM_WARN_LINE]]:{{[0-9]+}}}:"
 {{\[\[}}clang::lifetimebound{{\]\]}}"
                               );
 
 //--- cross.cpp
diff --git 
a/clang/test/Sema/LifetimeSafety/misplaced-lifetimebound-intra-tu.cpp 
b/clang/test/Sema/LifetimeSafety/misplaced-lifetimebound-intra-tu.cpp
index 25f5b6e94c28c..28dd65211b268 100644
--- a/clang/test/Sema/LifetimeSafety/misplaced-lifetimebound-intra-tu.cpp
+++ b/clang/test/Sema/LifetimeSafety/misplaced-lifetimebound-intra-tu.cpp
@@ -10,16 +10,16 @@ struct MyObj {
   ~MyObj() {}
 };
 
-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 // 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 &obj [[clang::lifetimebound]]) { // expected-note 
{{'lifetimebound' attribute appears here on the definition}}
   return obj;
 }
 
-MyObj &earliest_redecl_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 &earliest_redecl_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 &earliest_redecl_param(MyObj &obj);
 MyObj &earliest_redecl_param(MyObj &obj [[clang::lifetimebound]]) { // 
expected-note {{'lifetimebound' attribute appears here on the definition}}
@@ -32,12 +32,12 @@ struct S {
                                   );  // 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 &param_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 &param_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 &both(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-DAG: 
fix-it:"{{.*}}":{[[@LINE]]:{{[0-9]+}}-[[@LINE]]:{{[0-9]+}}}:" 
{{\[\[clang::lifetimebound\]\]}}"
+  const MyObj &both(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-DAG: 
fix-it:"{{.*}}":{[[@LINE-1]]:{{[0-9]+}}-[[@LINE-1]]:{{[0-9]+}}}:" 
{{\[\[clang::lifetimebound\]\]}}"
                     bool
                     );             // expected-warning {{'lifetimebound' 
attribute on this definition is not visible to callers before the definition; 
add it to the declaration instead}}
                                    // CHECK-DAG: 
fix-it:"{{.*}}":{[[@LINE-1]]:{{[0-9]+}}-[[@LINE-1]]:{{[0-9]+}}}:" 
{{\[\[clang::lifetimebound\]\]}}"
@@ -61,8 +61,8 @@ const MyObj &S::both(
 template <class T>
 struct MixedSpecializations {
   T data;
-  T &both(T &   // expected-warning {{'lifetimebound' attribute on this 
definition is not visible to callers before the definition; add it to the 
declaration instead}}
-          arg,  // CHECK-DAG: 
fix-it:"{{.*}}":{[[@LINE]]:{{[0-9]+}}-[[@LINE]]:{{[0-9]+}}}:" 
{{\[\[clang::lifetimebound\]\]}}"
+  T &both(T& arg, // expected-warning {{'lifetimebound' attribute on this 
definition is not visible to callers before the definition; add it to the 
declaration instead}}
+                  // CHECK-DAG: 
fix-it:"{{.*}}":{[[@LINE-1]]:{{[0-9]+}}-[[@LINE-1]]:{{[0-9]+}}}:" 
{{\[\[clang::lifetimebound\]\]}}"
           bool
           );    // expected-warning {{'lifetimebound' attribute on this 
definition is not visible to callers before the definition; add it to the 
declaration instead}}
                 // CHECK-DAG: 
fix-it:"{{.*}}":{[[@LINE-1]]:{{[0-9]+}}-[[@LINE-1]]:{{[0-9]+}}}:" 
{{\[\[clang::lifetimebound\]\]}}"
@@ -80,8 +80,8 @@ struct InternalObj {
 };
 
 namespace {
-InternalObj &anon_param(InternalObj &  // 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\]\]}}"
+InternalObj &anon_param(InternalObj & 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\]\]}}"
                         );
 
 InternalObj &anon_param(InternalObj &obj [[clang::lifetimebound]]) { // 
expected-note {{'lifetimebound' attribute appears here on the definition}}
@@ -100,8 +100,8 @@ InternalObj &AnonS::anon_this() [[clang::lifetimebound]] { 
// expected-note {{'l
 }
 } // namespace
 
-static InternalObj &static_param(InternalObj &  // 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\]\]}}"
+static InternalObj &static_param(InternalObj & 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\]\]}}"
                                  );
 
 static InternalObj &static_param(InternalObj &obj [[clang::lifetimebound]]) { 
// expected-note {{'lifetimebound' attribute appears here on the definition}}
@@ -112,8 +112,8 @@ struct IntraSuppressedObj {
   ~IntraSuppressedObj() {}
 };
 
-IntraSuppressedObj &intra_suppressed(IntraSuppressedObj &  // 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\]\]}}"
+IntraSuppressedObj &intra_suppressed(IntraSuppressedObj &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\]\]}}"
                                      );
 
 IntraSuppressedObj &intra_suppressed(
@@ -122,8 +122,8 @@ IntraSuppressedObj &intra_suppressed(
 }
 
 struct View {
-  friend View friend_redecl(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\]\]}}"
+  friend View friend_redecl(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\]\]}}"
                             );
 };
 
@@ -136,8 +136,8 @@ 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 &  // 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 &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 <>
@@ -148,8 +148,8 @@ template <>
 MyObj &spec_func<MyObj>(MyObj &obj) { return obj; }
 
 MyObj get_default_obj();
-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\]\]}}"
+const MyObj &default_arg_param(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\]\]}}"
                                = get_default_obj());
 
 const MyObj &default_arg_param(const MyObj &obj [[clang::lifetimebound]]) { // 
expected-note {{'lifetimebound' attribute appears here on the definition}}
@@ -161,8 +161,8 @@ struct Base {
 };
 
 struct Derived : Base {
-  auto virtual_get(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\]\]}}"
+  auto virtual_get(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 -> const MyObj& override;
 };
 
@@ -172,8 +172,8 @@ auto Derived::virtual_get(const MyObj& obj 
[[clang::lifetimebound]]) const -> co
 
 #define GNU_LIFETIMEBOUND_MACRO __attribute__((lifetimebound))
 
-MyObj &gnu_macro_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]+}}}:" 
GNU_LIFETIMEBOUND_MACRO"
+MyObj &gnu_macro_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]+}}}:" 
GNU_LIFETIMEBOUND_MACRO"
                        );
 
 MyObj &gnu_macro_param(MyObj &obj [[clang::lifetimebound]]) { // expected-note 
{{'lifetimebound' attribute appears here on the definition}}
@@ -194,9 +194,9 @@ const MyObj &OnlyGNUMember::only_gnu_this() 
[[clang::lifetimebound]] { // expect
 #define CONFIGURED_LIFETIMEBOUND_MACRO [[clang::lifetimebound]]
 #define LATEST_VISIBLE_LIFETIMEBOUND_MACRO [[clang::lifetimebound]]
 
-MyObj &configured_macro_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]+}}}:" 
LATEST_VISIBLE_LIFETIMEBOUND_MACRO"
-                                      // CHECK-CONFIG: 
fix-it:"{{.*}}":{[[@LINE-1]]:{{[0-9]+}}-[[@LINE-1]]:{{[0-9]+}}}:" 
CONFIGURED_LIFETIMEBOUND_MACRO"
+MyObj &configured_macro_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]+}}}:" 
LATEST_VISIBLE_LIFETIMEBOUND_MACRO"
+                                         // CHECK-CONFIG: 
fix-it:"{{.*}}":{[[@LINE-2]]:{{[0-9]+}}-[[@LINE-2]]:{{[0-9]+}}}:" 
CONFIGURED_LIFETIMEBOUND_MACRO"
                               );
 
 MyObj &configured_macro_param(MyObj &obj [[clang::lifetimebound]]) { // 
expected-note {{'lifetimebound' attribute appears here on the definition}}

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to