-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
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)false-negativeWarning doesn't fire when it shouldWarning doesn't fire when it should
Description
https://godbolt.org/z/M5v3j6W84
#include <string>
#include <string_view>
std::string_view foo(std::string param) {
std::string_view res = param;
return res;
}We do not see the expired loans for the param (no destructors)
==========================================
Lifetime Analysis Facts:
==========================================
Function: foo
Block B2:
End of Block
Block B1:
Issue (0 (Path: param), ToOrigin: 0 (Expr: DeclRefExpr))
OriginFlow (Dest: 1 (Expr: ImplicitCastExpr), Src: 0 (Expr: DeclRefExpr))
OriginFlow (Dest: 2 (Expr: CXXMemberCallExpr), Src: 1 (Expr: ImplicitCastExpr))
OriginFlow (Dest: 3 (Expr: ImplicitCastExpr), Src: 2 (Expr: CXXMemberCallExpr))
OriginFlow (Dest: 4 (Decl: res), Src: 3 (Expr: ImplicitCastExpr))
Use (4 (Decl: res), Read)
OriginFlow (Dest: 5 (Expr: ImplicitCastExpr), Src: 4 (Decl: res))
OriginFlow (Dest: 6 (Expr: CXXConstructExpr), Src: 5 (Expr: ImplicitCastExpr))
OriginEscapes (6 (Expr: CXXConstructExpr))
End of Block
Block B0:
End of Block
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)false-negativeWarning doesn't fire when it shouldWarning doesn't fire when it should
Type
Projects
Status
No status