================ @@ -582,6 +582,15 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call, // Temp().ptr; // Here ptr might not dangle. if (isa<MemberExpr>(Arg->IgnoreImpCasts())) return; + // Avoid false positives when the object is constructed from a conditional + // operator argument. A common case is: + // // 'ptr' might not be owned by the Owner object. + // std::string_view s = cond() ? Owner().ptr : sv; ---------------- Xazax-hun wrote:
I am a bit confused to be honest. Is there any other contexts where `Owner().ptr` is problematic? I'd expect our analysis to behave the same for a subexpression like that regardless the context. So I am surprised we need to insert special logic for the ternary operator. https://github.com/llvm/llvm-project/pull/120233 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits