[clang] C++26 Annotation (PR #166287)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 19 15:49:35 PST 2025


================
@@ -934,6 +937,48 @@ def AlwaysInline : DeclOrStmtAttr {
   let Documentation = [AlwaysInlineDocs];
 }
 
+def CXX26Annotation : InheritableParamAttr {
+  let Spellings = [];
+  let Args = [ExprArgument<"Arg">];
+  let AdditionalMembers = [{
+private:
+  APValue Value;
+  SourceLocation EqLoc;
+
+public:
+  static CXX26AnnotationAttr *Create(ASTContext &Ctx, \
+                                     const AttributeCommonInfo &CommonInfo) {
+    return CXX26AnnotationAttr::Create(Ctx, nullptr,  CommonInfo);
+  }
+  static CXX26AnnotationAttr *CreateImplicit( \
+          ASTContext &Ctx, \
+          const AttributeCommonInfo &CommonInfo) {
+    return CXX26AnnotationAttr::CreateImplicit(Ctx, nullptr, CommonInfo);
+  }
+
+  APValue getValue() const { return Value; }
+  void setValue(APValue V) { Value = V; }
+
+  SourceLocation getEqLoc() const { return EqLoc; }
+  void setEqLoc(SourceLocation Loc) { EqLoc = Loc; }
+  }];
+
+  let PostInstantiationStmts = [{
+    Expr::EvalResult V;
----------------
zebullax wrote:

I believe there might be a more canonical way to achieve that via `Sema::InstantiateAttrs` , I'm giving this a try and that will remove this PostInstantiateStmts thingy

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


More information about the cfe-commits mailing list