[cfe-dev] [RFC] New attribute `annotate_type`

Aaron Ballman via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 11 09:53:55 PDT 2021


On Mon, Oct 11, 2021 at 10:28 AM Martin Brænne via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
>
> I would like to propose a new attribute `annotate_type` that would be analogous to the existing `annotate` attribute but for use on types. As for `annotate`, the typical use case would be to add annotations to be used by static analysis tools.
>
> I have a draft patch implementing this attribute (https://reviews.llvm.org/D111548), but before it's reviewed I wanted to solicit some feedback more broadly on whether people feel this makes sense.

Thanks for the proposal! One question I have is whether we need an
additional attribute for this instead of reworking [[clang::annotate]]
so that it applies to either a type or a declaration. Is a separate
attribute necessary because there may be unfortunate problems with
using __attribute__((annotate)) as the spelling?

What kind of type semantic impacts does this attribute have on the
type identity for things like overloading, name mangling, type
conversion, etc?

Also, one problem here is -- [[clang::annotate]] isn't just used for
the static analyzer, it's also something that can be used by backend
tools (for example, when using attribute plugins). Do we need to
consider what information should be lowered to LLVM IR when this new
attribute appears on a type?

Thanks!

~Aaron

>
> Thanks,
>
> Martin
>
> --
>
> Martin Brænne
>
> Software Engineer
>
> mboehme at google.com
>
>
> Google Germany GmbH
> Erika-Mann-Straße 33
> 80363 München
>
> Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
>
> Registergericht und -nummer: Hamburg, HRB 86891
>
> Sitz der Gesellschaft: Hamburg
>
>
> Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind, leiten Sie diese bitte nicht weiter, informieren Sie den Absender und löschen Sie die E-Mail und alle Anhänge. Vielen Dank.
>
>
>
> This e-mail is confidential. If you are not the right addressee please do not forward it, please inform the sender, and please erase this e-mail including any attachments. Thanks.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


More information about the cfe-dev mailing list