Annotations on extern


is there anything similar to attribute((annotate(“foo”))) that works on declarations (and their parameters) instead of definitions?

I am trying to get Clang to pass an annotation such as

extern void foo(int *a attribute((annotate(“foo”))) , int *b)

or, if the above isnt possible, an annotation on the entire function

extern void foo(int *a , int *b) attribute((annotate(“foo”)))

down to the LLVM IR in any way. At the moment, this is for a prototype and I would like to have a quick and dirty way that I can iterate on – so ideally something string-based.

Is there a solution I have missed, or should I roll my own attribute. If so, what would the cleanest way of emitting this in the IR be – perhaps weak symbols in the LLVM IR?