[clang] 9102ccd - [CXX Safe Buffer] Update the documentation for unsafe_buffer_usage attribute (#135087)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 10 11:00:05 PDT 2025
Author: Malavika Samak
Date: 2025-04-10T11:00:02-07:00
New Revision: 9102ccd2f7025dff6b858b813d089bec152365ba
URL: https://github.com/llvm/llvm-project/commit/9102ccd2f7025dff6b858b813d089bec152365ba
DIFF: https://github.com/llvm/llvm-project/commit/9102ccd2f7025dff6b858b813d089bec152365ba.diff
LOG: [CXX Safe Buffer] Update the documentation for unsafe_buffer_usage attribute (#135087)
Update the documentation for the unsafe_buffer_usage attribute to
capture the new behavior introduced by
https://github.com/llvm/llvm-project/pull/125671
Co-authored-by: MalavikaSamak <malavika2 at apple.com>
Added:
Modified:
clang/include/clang/Basic/AttrDocs.td
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td
index c8b371280e35d..97a5f24d35d7d 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -7517,9 +7517,11 @@ the field it is attached to, and it may also lead to emission of automatic fix-i
hints which would help the user replace the use of unsafe functions(/fields) with safe
alternatives, though the attribute can be used even when the fix can't be automated.
-* Attribute attached to functions: The attribute does not suppress
- ``-Wunsafe-buffer-usage`` inside the function to which it is attached.
- These warnings still need to be addressed.
+* Attribute attached to functions: The attribute suppresses all
+ ``-Wunsafe-buffer-usage`` warnings within the function it is attached to, as the
+ function is now classified as unsafe. The attribute should be used carefully, as it
+ will silence all unsafe operation warnings inside the function; including any new
+ unsafe operations introduced in the future.
The attribute is warranted even if the only way a function can overflow
the buffer is by violating the function's preconditions. For example, it
More information about the cfe-commits
mailing list