attributes on function arguments

I tried to implement a novel attribute, “attribute((nocapture))” which would apply LLVM’s “nocapture” attribute to pointer-typed parameters or arguments in a function declaration or call. There don’t seem to be any attributes like this to copy the technique.

The attribute goes onto the ParamVarDecl just fine but those don’t seem to line up with the CGFunctionInfo’s args due to things like implicit “this” and such. Also, it doesn’t seem like ArgInfo is a good place to put an attribute like nocapture.

Does anyone have a suggestion for how this should work in Clang? I’ve attached my attempt at an implementation.


Now with added patch!

2009/5/30 Nick Lewycky <>

nocapture.patch (6.67 KB)

Um, no you didn't. :frowning: