[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

Nikolas Klauser via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 14:40:44 PST 2025


================
@@ -839,6 +839,12 @@ def BuiltinAssumeAligned : Builtin {
   let Prototype = "void*(void const*, size_t, ...)";
 }
 
+def BuiltinAssumeDereferenceable : Builtin {
+  let Spellings = ["__builtin_assume_dereferenceable"];
+  let Attributes = [NoThrow, Const, Constexpr];
----------------
philnik777 wrote:

Not sure how you want to use it with `vector`, but I'd be fine with making `constexpr` support a follow-up patch. Given that `vector` is `constexpr` I'd really like to see the support implemented before adding it to libc++ though, since it'd require quite a bit of working around non-constexpr support otherwise.

https://github.com/llvm/llvm-project/pull/121789


More information about the llvm-commits mailing list