aboutsummaryrefslogtreecommitdiff
path: root/clang/docs
diff options
context:
space:
mode:
authorHaojian Wu <hokein.wu@gmail.com>2024-07-01 17:43:07 +0200
committerGitHub <noreply@github.com>2024-07-01 17:43:07 +0200
commit5c287efee77930ab15fe5579bed00b2750bbb254 (patch)
tree2ac3d5a4a56ecae867a8bbfcc5593e0064cc0409 /clang/docs
parent2e81f7db1f1c161a1683bcad55e0c04677a17a9d (diff)
downloadllvm-5c287efee77930ab15fe5579bed00b2750bbb254.zip
llvm-5c287efee77930ab15fe5579bed00b2750bbb254.tar.gz
llvm-5c287efee77930ab15fe5579bed00b2750bbb254.tar.bz2
[Clang] Extend lifetime bound analysis to support assignments for the built-in pointer type (#96475)
The lifetime bound warning in Clang currently only considers initializations. This patch extends the warning to include assignments. - **Support for assignments of built-in pointer types**: this is done is by reusing the existing statement-local implementation. Clang now warns if the pointer is assigned to a temporary object that being destoryed at the end of the full assignment expression. With this patch, we will detect more cases under the on-by-default diagnostic `-Wdangling`. I have added a new category for this specific diagnostic so that people can temporarily disable it if their codebase is not yet clean. This is the first step to address #63310, focusing only on pointer types. Support for C++ assignment operators will come in a follow-up patch. Fixes #54492
Diffstat (limited to 'clang/docs')
-rw-r--r--clang/docs/ReleaseNotes.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index f893d8a..90c2469 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -641,6 +641,10 @@ Improvements to Clang's diagnostics
used rather than when they are needed for constant evaluation or when code is generated for them.
The check is now stricter to prevent crashes for some unsupported declarations (Fixes #GH95495).
+- Clang now diagnoses dangling cases where a pointer is assigned to a temporary
+ that will be destroyed at the end of the full expression.
+ Fixes #GH54492.
+
Improvements to Clang's time-trace
----------------------------------