[cfe-dev] Using the annotate attribute on classes

Khilan Gudka Khilan.Gudka at cl.cam.ac.uk
Mon Mar 30 04:23:56 PDT 2015


Hi Jonathan

Thanks for your reply. I forgot to mention that I was interested in having
the attribute propagate through to the IR (to then later pick up in an IR
analysis pass), which it doesn't appear to be (even when specifying the
annotate attribute as you say).

Here is my test program:

class A {
  public:
    void foo() { }
} __attribute__((annotate("hello")));

int main(int argc, char** argv) {
  A a1;
  a1.foo();
  A* a2 = new A;
  a2->foo();
  return 0;
}

Cheers

--
Khilan Gudka
Research Associate
Security Group
Computer Laboratory
University of Cambridge
http://www.cl.cam.ac.uk/~kg365/

On 30 March 2015 at 11:03, Jonathan Coe <jonathanbcoe at gmail.com> wrote:

> I think it goes after the class definition.
>
> class C {} __attribute__(X);
>
>
>
> On 30 Mar 2015, at 10:46, Khilan Gudka <Khilan.Gudka at cl.cam.ac.uk> wrote:
>
> Hi all
>
> I'm looking for a way to annotate a c++ class and the annotate attribute
> doesn't seem to work on class declarations? Is there a special way to do it
> or is it just not possible?
>
> Cheers
>
> --
> Khilan Gudka
> Research Associate
> Security Group
> Computer Laboratory
> University of Cambridge
> http://www.cl.cam.ac.uk/~kg365/
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150330/db6d715a/attachment.html>


More information about the cfe-dev mailing list