[clang] [Clang] Add GCC's __builtin_stack_address() to Clang. (PR #121332)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 31 01:09:54 PST 2025
================
@@ -899,6 +899,12 @@ def FrameAddress : Builtin {
let Prototype = "void*(_Constant unsigned int)";
}
+def StackAddress : Builtin {
+ let Spellings = ["__builtin_stack_address"];
+ let Attributes = [NoThrow];
----------------
aalhwc wrote:
I may be wrong here but I am not sure if this is an instance of a `Const` or even `Pure` function. Two consecutive calls to `__builtin_stack_address` can return different values which makes it im`Pure`. Since `Const` functions are a subset of `Pure` functions, it also can't be `Const`. This is based on [GCC](https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html)'s documentation regarding function attributes.
https://github.com/llvm/llvm-project/pull/121332
More information about the cfe-commits
mailing list