Skip to content

[clang] Enable the -Wdangling-assignment-gsl diagnostic by default. #100708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

hokein
Copy link
Collaborator

@hokein hokein commented Jul 26, 2024

No description provided.

@hokein hokein requested review from Xazax-hun and usx95 July 26, 2024 07:19
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 26, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 26, 2024

@llvm/pr-subscribers-clang

Author: Haojian Wu (hokein)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/100708.diff

2 Files Affected:

  • (modified) clang/docs/ReleaseNotes.rst (+2)
  • (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+1-1)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 5dddd8f1c5af5..bba03f8ccccd3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -130,6 +130,8 @@ Improvements to Clang's diagnostics
 
 - Clang now diagnoses undefined behavior in constant expressions more consistently. This includes invalid shifts, and signed overflow in arithmetic.
 
+- -Wdangling-assignment-gsl is enabled by default.
+
 Improvements to Clang's time-trace
 ----------------------------------
 
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 810abe4f23e31..50211a6ab5186 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -10133,7 +10133,7 @@ def warn_dangling_lifetime_pointer : Warning<
   InGroup<DanglingGsl>;
 def warn_dangling_lifetime_pointer_assignment : Warning<"object backing the "
   "pointer %0 will be destroyed at the end of the full-expression">,
-  InGroup<DanglingAssignmentGsl>, DefaultIgnore;
+  InGroup<DanglingAssignmentGsl>;
 def warn_new_dangling_initializer_list : Warning<
   "array backing "
   "%select{initializer list subobject of the allocated object|"

Copy link
Collaborator

@Xazax-hun Xazax-hun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@usx95 usx95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks good since we are past the branch cut.

@hokein hokein merged commit 481eb4f into llvm:main Jul 26, 2024
11 checks passed
aarongable pushed a commit to chromium/chromium that referenced this pull request Jul 29, 2024
This is turned on in ToT clang in llvm/llvm-project#100708.

Will fix async and re-enable.

Bug: 356172342
Change-Id: I04ad6bf211fd8109dbe899259ddeafe1d9b4ff3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5744583
Commit-Queue: Zequan Wu <[email protected]>
Auto-Submit: Arthur Eubanks <[email protected]>
Commit-Queue: Arthur Eubanks <[email protected]>
Reviewed-by: Zequan Wu <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1334447}
devsnek pushed a commit to denoland/chromium_build that referenced this pull request Aug 19, 2024
This is turned on in ToT clang in llvm/llvm-project#100708.

Will fix async and re-enable.

Bug: 356172342
Change-Id: I04ad6bf211fd8109dbe899259ddeafe1d9b4ff3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5744583
Commit-Queue: Zequan Wu <[email protected]>
Auto-Submit: Arthur Eubanks <[email protected]>
Commit-Queue: Arthur Eubanks <[email protected]>
Reviewed-by: Zequan Wu <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1334447}
NOKEYCHECK=True
GitOrigin-RevId: 194a37840491cd70fbec7a3619ccd0cca5e53310
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants