[clang] [clang][frontend] Support applying the annotate attribute to statements (PR #111841)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 07:47:12 PDT 2024


================
@@ -2125,6 +2126,19 @@ TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E,
                                          Arg, PackIndex);
 }
 
+const AnnotateAttr *
+TemplateInstantiator::TransformAnnotateAttr(const AnnotateAttr *AA) {
+  SmallVector<Expr *> Args;
+  for (Expr *Arg : AA->args()) {
+    ExprResult Res = getDerived().TransformExpr(Arg);
+    if (!Res.isUsable())
+      return AA;
----------------
erichkeane wrote:

We won't be silently dropping them though, `TransformExpr` will do diagnostics.  So we'll just be dropping the ones that are invalid.

https://github.com/llvm/llvm-project/pull/111841


More information about the cfe-commits mailing list