[clang] [Clang][Docs] Documented sentinel attribute (PR #196088)

Tony Guillot via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 05:10:34 PDT 2026


================
@@ -10055,3 +10055,65 @@ different languages to coexist on the same call stack while each interpreting
 exceptions according to their own rules.
   }];
 }
+
+def SentinelDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+The ``sentinel`` attribute can be applied to variadic functions and pointers to
+variadic functions, to diagnose each function call that does not pass a
+sentinel value (a null pointer constant) as the last argument to the function
+call. The attribute accepts two optional arguments: the first argument is the
+position of the expected sentinel value, starting from the last parameter. The
+second argument describes whether the last fixed parameter is treated as a
+valid sentinel value when set to '1'.
+All arguments described above defaults to '0' when elided.
----------------
to268 wrote:

See #205539 

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


More information about the cfe-commits mailing list