rsmith added a comment. Attributes are specified in include/clang/Basic/Attr.td with a (hopefully) fairly self-explanatory declarative syntax. You'll then need to add code to lib/Sema/SemaDeclAttr.cpp to create a corresponding attribute object and attach it to the declaration.
Two implementation approaches seem feasible: either check that the VarDecl has constant initialization at the point when the attribute is attached in SemaDeclAttr.cpp, or attach the attribute without checking and instead perform the check from `Sema::CheckCompleteVariableDeclaration`, around where we currently call `isConstantInitializer` to produce a warning on non-constant initialization -- the effect of the attribute would then be to promote that warning to an error. https://reviews.llvm.org/D23385 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits