Adding a function attribute with an argument

Hi,

I’m trying to add a function attribute to clang/llvm.

I need an attribute that will have an additional information of a variable name.

e.g. I would like to add support for something like:

void foo() attribute ((xyz(v)) {…}

such that on the IR stage I can realize that the function foo has the attribute xyz and an argument v that marks variable v (which is a variable inside foo) for my needs.

I was able to add a function attribute without an argument, but I don’t understand how to parse/save/analyze the argument.

I would appreciate any ideas/examples/references.

Thanks a lot,

Tehila.

Hi,

I’m trying to add a function attribute to clang/llvm.

I need an attribute that will have an additional information of a variable name.

e.g. I would like to add support for something like:

void foo() attribute ((xyz(v)) {…}

such that on the IR stage I can realize that the function foo has the attribute xyz and an argument v that marks variable v (which is a variable inside foo) for my needs.

I was able to add a function attribute without an argument, but I don’t understand how to parse/save/analyze the argument.

I would appreciate any ideas/examples/references.

Thanks a lot,

Tehila.