[llvm-dev] Regarding Clang Custom Attributes, Visibility of Custom Attr in IR

Mahesh Attarde via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 12 02:49:38 PDT 2015


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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150812/3a752f75/attachment.html>


More information about the llvm-dev mailing list