This is an archive of the discontinued LLVM Phabricator instance.

Update attribute example to fit the new Annotation API
AbandonedPublic

Authored by psionic12 on Nov 11 2020, 12:17 AM.

Details

Summary

Since AnnotationAttr can add extra arguments
now, update Attribute plugin example to fit this API
to make this example compiled.

Diff Detail

Event Timeline

psionic12 created this revision.Nov 11 2020, 12:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 11 2020, 12:17 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
psionic12 requested review of this revision.Nov 11 2020, 12:17 AM
psionic12 added inline comments.Nov 11 2020, 12:25 AM
clang/examples/Attribute/Attribute.cpp
59

AnnotationAttr is used as an extra information in attribute plugin designs. Usually after handling the customized attribute, coders will add an AnnotationAttr into the AST, for later use.

Before the new API released, create an AnnotationAttr is not very hard.

But now AnnotationAttr accepts a StringLiteralExpr as it's first argument, in order to do the same thing I mentioned above, we have to create an StringLiteralExpr from nowhere, which looks not very elegant to me.

Tyker added a comment.Nov 11 2020, 4:58 AM

I recently made it much easier to create AnnotationAttr in this context with https://reviews.llvm.org/rGd093401a2617d3c46aaed9eeaecf877e3ae1a9f1.

psionic12 abandoned this revision.Nov 23 2020, 11:14 PM