Skip to content

[-Wunsafe-buffer-usage] Add a subgroup -Wunsafe-buffer-usage-in-container #75665

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
Dec 18, 2023

Conversation

ziqingluo-90
Copy link
Contributor

Add a sub diagnostic group under -Wunsafe-buffer-usage controlled by -Wunsafe-buffer-usage-in-container. The subgroup will include warnings on misuses of std::span, std::vector, and std::array.

…ainer`

Add a sub diagnostic group under `-Wunsafe-buffer-usage` controlled by
`-Wunsafe-buffer-usage-in-container`.  The subgroup will include
warnings on misuses of `std::span`, `std::vector`, and `std::array`.
@ziqingluo-90 ziqingluo-90 requested a review from haoNoQ December 15, 2023 22:25
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Dec 15, 2023
@llvmbot
Copy link
Member

llvmbot commented Dec 15, 2023

@llvm/pr-subscribers-clang

Author: Ziqing Luo (ziqingluo-90)

Changes

Add a sub diagnostic group under -Wunsafe-buffer-usage controlled by -Wunsafe-buffer-usage-in-container. The subgroup will include warnings on misuses of std::span, std::vector, and std::array.


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

1 Files Affected:

  • (modified) clang/include/clang/Basic/DiagnosticGroups.td (+2-1)
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 80b5680b94f6ca..7cf347e92d9972 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1488,4 +1488,5 @@ def DXILValidation : DiagGroup<"dxil-validation">;
 def ReadOnlyPlacementChecks : DiagGroup<"read-only-types">;
 
 // Warnings and fixes to support the "safe buffers" programming model.
-def UnsafeBufferUsage : DiagGroup<"unsafe-buffer-usage">;
+def UnsafeBufferUsageInContainer : DiagGroup<"unsafe-buffer-usage-in-container">;
+def UnsafeBufferUsage : DiagGroup<"unsafe-buffer-usage", [UnsafeBufferUsageInContainer]>;

@ziqingluo-90 ziqingluo-90 merged commit 4123b95 into llvm:main Dec 18, 2023
ziqingluo-90 added a commit to ziqingluo-90/apple-llvm-project that referenced this pull request Dec 18, 2023
…ainer` (llvm#75665)

Add a sub diagnostic group under `-Wunsafe-buffer-usage` controlled by
`-Wunsafe-buffer-usage-in-container`. The subgroup will include warnings
on misuses of `std::span`, `std::vector`, and `std::array`.

(cherry picked from commit 4123b95)
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.

3 participants