================ @@ -7525,25 +7525,21 @@ static Attr *getCCTypeAttr(ASTContext &Ctx, ParsedAttr &Attr) { std::optional<FunctionEffectMode> Sema::ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName) { - auto BadExpr = [&]() { - Diag(CondExpr->getExprLoc(), diag::err_attribute_argument_type) - << ("'" + AttributeName.str() + "'") << AANT_ArgumentIntegerConstant - << CondExpr->getSourceRange(); + if (DiagnoseUnexpandedParameterPack(CondExpr)) return std::nullopt; - }; - - if (CondExpr->isTypeDependent() || CondExpr->isValueDependent()) { - if (CondExpr->containsUnexpandedParameterPack()) - return BadExpr(); + if (CondExpr->isTypeDependent() || CondExpr->isValueDependent()) return FunctionEffectMode::Dependent; - } std::optional<llvm::APSInt> ConditionValue = CondExpr->getIntegerConstantExpr(Context); - if (!ConditionValue) - return BadExpr(); - return ConditionValue->getExtValue() ? FunctionEffectMode::True - : FunctionEffectMode::False; + if (!ConditionValue) { + Diag(CondExpr->getExprLoc(), diag::err_attribute_argument_type) + << ("'" + AttributeName.str() + "'") << AANT_ArgumentIntegerConstant ---------------- dougsonos wrote:
The difficulty here is: - this is a pre-existing diagnostic; I didn't see a need for a new one just for quotes - the other users of the pre-existing diagnostic use `<<` with a `ParsedAttr`, which apparently quotes the attribute (?), but this function can be called from `TreeTransform` (for template instantiation), where there is only a `FunctionEffect` (whose name is passed in). And then there are usages like: ``` Diag(AttrLoc, diag::err_attribute_argument_type) << "vector_size" << AANT_ArgumentIntegerConstant << SizeExpr->getSourceRange(); ``` , passing a string constant; it would appear that in this case the attribute isn't quoted, which seems inconsistent. https://github.com/llvm/llvm-project/pull/84983 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits