[PATCH] D91239: Update attribute example to fit the new Annotation API

Yafei Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 00:25:17 PST 2020


psionic12 added inline comments.


================
Comment at: clang/examples/Attribute/Attribute.cpp:59
+
+    // First we have to create an `StringLiteralExpr`.
+    StringRef AnnotationString = "example";
----------------
`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. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91239/new/

https://reviews.llvm.org/D91239



More information about the cfe-commits mailing list