================ @@ -234,6 +234,32 @@ static void instantiateDependentAnnotationAttr( } } +template <typename Attr> +static void sharedInstantiateConstructorDestructorAttr( + Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const Attr *A, + Decl *New, ASTContext &C) { + Expr *tempInstPriority = nullptr; + { + EnterExpressionEvaluationContext Unevaluated( + S, Sema::ExpressionEvaluationContext::Unevaluated); + ExprResult Result = S.SubstExpr(A->getPriority(), TemplateArgs); + if (Result.isInvalid()) + return; + tempInstPriority = Result.get(); + if (std::optional<llvm::APSInt> CE = + tempInstPriority->getIntegerConstantExpr(C)) { + // Consistent with non-templated priority arguments, which must fit in a + // 32-bit unsigned integer. + if (!CE->isIntN(32)) { + S.Diag(tempInstPriority->getExprLoc(), diag::err_ice_too_large) + << toString(*CE, 10, false) << /*Size=*/32 << /*Unsigned=*/1; + return; + } + } + } + New->addAttr(new (C) Attr(C, *A, tempInstPriority)); ---------------- erichkeane wrote:
```suggestion New->addAttr(Attr::Create(C, *A, tempInstPriority)); ``` Forgot about these, we auto generate 'create' functions for attributes, since we can do automated work in them. We are ... in transition to switching to the 'Create' functions. https://github.com/llvm/llvm-project/pull/151400 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits