[clang] [clang] Don't warn if the capturing object is also temporary. (PR #117733)

2024-11-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/117733 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Don't warn if the capturing object is also temporary. (PR #117733)

2024-11-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/117733 >From 30235e403de2130795201b00e2d23e25cdb68baa Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 26 Nov 2024 17:14:49 +0100 Subject: [PATCH] [clang] Add a lifetime capture testcase for temporary capturing obj

[clang] [clang] Don't warn if the capturing object is also temporary. (PR #117733)

2024-11-28 Thread Haojian Wu via cfe-commits
hokein wrote: > It is possible that the temporary capturing object uses the captured entity > in its destructor. This is a good point. We could potentially limit the suppression to cases where the destructor is trivial, but that might not be worth the added complexity. Agree that this is pro

[clang] [clang] Don't warn if the capturing object is also temporary. (PR #117733)

2024-11-27 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: I considered this during implementation. This is a little controversial. It is possible that the temporary capturing object uses the captured entity in its destructor. In principle, we can always detect the order of destructions of the temporaries and choose to suppress cases when

[clang] [clang] Don't warn if the capturing object is also temporary. (PR #117733)

2024-11-26 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Haojian Wu (hokein) Changes Fixes #117728 --- Full diff: https://github.com/llvm/llvm-project/pull/117733.diff 2 Files Affected: - (modified) clang/lib/Sema/SemaChecking.cpp (+7-3) - (modified) clang/test/Sema/warn-lifetime-analysis-ca

[clang] [clang] Don't warn if the capturing object is also temporary. (PR #117733)

2024-11-26 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/117733 Fixes #117728 >From bf697889ec6681dffc22120fef6d49ffddbd0b87 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 26 Nov 2024 17:14:49 +0100 Subject: [PATCH] [clang] Don't warn if the capturing object is also te