-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
0 / 30 of 3 issues completedOpen
0 / 30 of 3 issues completed
Copy link
Labels
clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Description
The idea is to use the lifetime analysis to conclude which parameters escape via return and can be annotated via [[clang::lifetimebound]].
std::string_view Select(bool cond, std::string_view a, std::string_view b) {
if (cond)
return a;
else
return b;
} We can implement this as a clang warning:
std::string_view Select(bool cond, std::string_view a, std::string_view b)
^^^^^^^^^^^^^ warning: param should be marked [[clang::lifetimebound]]
^^^^^^^^^^^^^ warning: param should be marked [[clang::lifetimebound]]Sub-issues
Metadata
Metadata
Assignees
Labels
clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Type
Projects
Status
No status