File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
lib/Analysis/LifetimeSafety Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ class LifetimeChecker {
6969 else if (const auto *OEF = F->getAs <OriginEscapesFact>())
7070 checkAnnotations (OEF);
7171 issuePendingWarnings ();
72- issueAnnotationWarnings ();
72+ suggestAnnotations ();
7373 }
7474
7575 // / Checks if an escaping origin holds a placeholder loan, indicating a
@@ -154,7 +154,7 @@ class LifetimeChecker {
154154 }
155155 }
156156
157- void issueAnnotationWarnings () {
157+ void suggestAnnotations () {
158158 if (!Reporter)
159159 return ;
160160 for (const auto &[PVD, EscapeExpr] : AnnotationWarningsMap)
Original file line number Diff line number Diff line change @@ -64,6 +64,31 @@ View reassigned_to_another_parameter (
6464 return a; // expected-note {{param returned here}}
6565}
6666
67+ struct ReturnsSelf {
68+ const ReturnsSelf& get () const {
69+ return *this ;
70+ }
71+ };
72+
73+ struct ViewProvider {
74+ MyObj data;
75+ View getView () const {
76+ return data;
77+ }
78+ };
79+
80+ // FIXME: Fails to generate lifetime suggestions for the implicit 'this' parameter, as this feature is not yet implemented.
81+ void test_get_on_temporary () {
82+ const ReturnsSelf& s_ref = ReturnsSelf ().get ();
83+ (void )s_ref;
84+ }
85+
86+ // FIXME: Fails to generate lifetime suggestions for the implicit 'this' parameter, as this feature is not yet implemented.
87+ void test_getView_on_temporary () {
88+ View sv = ViewProvider{1 }.getView ();
89+ (void )sv;
90+ }
91+
6792// ===----------------------------------------------------------------------===//
6893// Negative Test Cases
6994// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments