Is it possible to emit an LLVM argmemonly attribute from clang?

Hi all,

I have a C source file that calls functions defined in other C files. Those functions never touch global memory, so I’d like to add the ‘argmemonly’ function attribute to the forward declarations of those functions.

Is it possible to emit the ‘argmemonly’ attribute from Clang - perhaps using a built-in or function attribute?

Thanks!

Not with vanilla clang. We (read @wsmoses) tried to allow that in the past but there was push back: ⚙ D63845 [WIP] Create a clang attribute that lets users specify LLVM attributes

You can try the infer attributes pass or the patch above (though it will require a rebase).

1 Like

Okay, thanks for confirming.