================
@@ -503,8 +503,8 @@ static const Expr *getSubExprInSizeOfExpr(const Expr &E) {
// Providing that `Ptr` is a pointer and `Size` is an unsigned-integral
// expression, returns true iff they follow one of the following safe
// patterns:
-// 1. Ptr is `DRE.data()` and Size is `DRE.size()`, where DRE is a hardened
-// container or view;
+// 1. Ptr is `DRE.data()` and Size is `DRE.size()` (or `DRE.size_bytes()` for
+// char pointers), called on the same container or view object `DRE`;
----------------
ziqingluo-90 wrote:
hmm... I believe well-developed libraries should follow the semantics
conventions for `data() `and `size()`. Project-local data types might be sloppy
with this convention. How about we only let functions annotated with
`[[clang::unsafe_buffer_usage("container")]]` use this duck typing approach?
https://github.com/llvm/llvm-project/pull/227108
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits