[clang] Allow the no_stack_protector attribute on local variables (PR #173311)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 13 13:38:46 PST 2026


================
@@ -5736,6 +5736,17 @@ option.
     }];
 }
 
+def StackProtectorIgnoreDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+The ``stack_protector_ignore`` attribute skips analysis of the given local
+variable when determining if a function should use a stack protector.
+
+If ``-fstack-protector-all`` is specified then the given function will still
+use a stack protector, even if some/all variables have this attribute.
----------------
AaronBallman wrote:

This is backwards from how things usually work; is this a requirement? Generally speaking, the closer to the source code the marking is, the higher priority it is. e.g., an attribute overrides a pragma which overrides a command line flag. So I think it'd be natural for a user to expect `stack_protector_ignore` attribute to override the command line flag. WDYT?

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


More information about the cfe-commits mailing list