[clang] 538c850 - [clang][docs] Fix typos in SafeBuffers.rst (#163547)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 27 02:45:56 PDT 2025
Author: Afanasyev Ivan
Date: 2025-10-27T17:45:52+08:00
New Revision: 538c8509efe8bcfcc0b1b6ad40dbc72b735e7fb5
URL: https://github.com/llvm/llvm-project/commit/538c8509efe8bcfcc0b1b6ad40dbc72b735e7fb5
DIFF: https://github.com/llvm/llvm-project/commit/538c8509efe8bcfcc0b1b6ad40dbc72b735e7fb5.diff
LOG: [clang][docs] Fix typos in SafeBuffers.rst (#163547)
Added:
Modified:
clang/docs/SafeBuffers.rst
Removed:
################################################################################
diff --git a/clang/docs/SafeBuffers.rst b/clang/docs/SafeBuffers.rst
index da75907e174a0..205e621e9d0eb 100644
--- a/clang/docs/SafeBuffers.rst
+++ b/clang/docs/SafeBuffers.rst
@@ -262,7 +262,7 @@ You can achieve this by refactoring the function to accept a ``std::span``
as a parameter::
int get_last_element(std::span<int> sp) {
- return sp[size - 1];
+ return sp[sp.size() - 1];
}
This solution puts the responsibility for making sure the span is well-formed
@@ -411,7 +411,7 @@ backwards compatibility -- in terms of both API and ABI -- by adding
a "compatibility overload"::
int get_last_element(std::span<int> sp) {
- return sp[size - 1];
+ return sp[sp.size() - 1];
}
[[clang::unsafe_buffer_usage]] // Please use the new function.
More information about the cfe-commits
mailing list