================ @@ -2154,29 +2156,51 @@ static void handleUnusedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { D->addAttr(::new (S.Context) UnusedAttr(S.Context, AL)); } +static ExprResult sharedGetConstructorDestructorAttrExpr(Sema &S, + const ParsedAttr &AL) { + // If no Expr node exists on the attribute, return a nullptr result (default + // priority to be used). If Expr node exists but is not valid, return an + // invalid result. Otherwise, return the Expr. + Expr *E = nullptr; + if (AL.getNumArgs() == 1) { + E = AL.getArgAsExpr(0); + if (E->isValueDependent()) { + if (!E->isTypeDependent() && !E->getType()->isIntegerType()) { + S.Diag(AL.getLoc(), diag::err_attribute_argument_type) + << AL << AANT_ArgumentIntegerConstant << E->getSourceRange(); + return ExprResult(/*Invalid=*/true); + } + } else { + uint32_t priority; + if (!S.checkUInt32Argument(AL, AL.getArgAsExpr(0), priority)) { + return ExprResult(/*Invalid=*/true); ---------------- erichkeane wrote:
```suggestion return ExprError(); ``` 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