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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 22 08:00:02 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.
----------------
erichkeane wrote:

```suggestion
All arguments described above default to '0' when elided.
```

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


More information about the cfe-commits mailing list