create a custom LLVM attribute

28 views Asked by At

I want to create a custom attribute that marks a function in case if certain condition is met. As a first step I included below code in Attr.td file

def myattribute : InheritableAttr {

  let Spellings = [GCC<"myattribute">];
  let Subjects = SubjectList<[Function]>;
  let SimpleHandler = 1;
  let Documentation = [Undocumented];

}

as well as this code in SemaDeclAttr.cpp file

case ParsedAttr::AT_myattribute:

    handleSimpleAttribute<myattributeAttr>(S, D, AL);

    break;

but when i try to use this in the pass it gives me following error

error: ‘myattribute’ is not a member of ‘llvm::Attribute’

i am new to llvm could anyone tell me whats happening???

1

There are 1 answers

0
Mehdi Aghakishiyev On

It might be because of the spelling, have you tried using AT_Myattribute instead of AT_myattribute?