Regarding Clang Custom Attributes, Visibility of Custom Attr in IR

Hi

i wish to add Attribute on Function so i added

def MutateFunction : InheritableAttr {
let Spellings = [GNU<“mutate_function_hint”>];
let Args = [UnsignedArgument<“SIndex”>,UnsignedArgument<“RIndex”>];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [Undocumented];
}

i have added function to hadle it, which simply adds attribute to Decl object

When i dump this declaration in SemaDeclAttr.cpp: handleMutateFunction i get

FunctionDecl 0xc9f9270 <kernel.cpp:6:12, line:7:1> col:1 k ‘void (class Rad::Nav &)’

-ParmVarDecl 0xc9f9000 <col:3, col:18> col:18 inParam ‘class Rad::Nav&’
`-MutateFunction 0xc9f92e0 <line:6:40, col:68> 50 10

But this attribute is not visible in final IR.
attribute #1 = { nounwind … }

How can i get it in #1?
Thanks in advance>

Hi

i wish to add Attribute on Function so i added

def MutateFunction : InheritableAttr {
  let Spellings = [GNU<"mutate_function_hint">];
  let Args = [UnsignedArgument<"SIndex">,UnsignedArgument<"RIndex">];
  let Subjects = SubjectList<[Function], ErrorDiag>;
  let Documentation = [Undocumented];
}

i have added function to hadle it, which simply adds attribute to Decl
object

When i dump this declaration in SemaDeclAttr.cpp: handleMutateFunction i get

FunctionDecl 0xc9f9270 <kernel.cpp:6:12, line:7:1> col:1 k 'void (class
Rad::Nav<short> &)'
>-ParmVarDecl 0xc9f9000 <col:3, col:18> col:18 inParam 'class
Rad::Nav<short>&'
`-MutateFunction 0xc9f92e0 <line:6:40, col:68> 50 10

But this attribute is not visible in final IR.
attribute #1 = { nounwind .... }

How can i get it in #1?
Thanks in advance>

Attributes in Clang do not translate automatically into attributes in
LLVM; you have to modify the codegen to lower your attribute to an
LLVM attribute. See CodeGenFunction.cpp for places where addFnAttr()
are called as an example of one way to do this.

HTH!

~Aaron