[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 27 10:21:42 PDT 2024
================
@@ -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
----------------
Sirraide wrote:
> it would appear that in this case the attribute isn't quoted, which seems inconsistent.
Afaik types that are used to describe names of entities are automatically quoted. If you can’t access the name of the attribute or sth in that vein here, one option I think would be to get an `IdentifierInfo*` for the name and pass that in instead (`getASTContext().Idents.get("foobar")`).
https://github.com/llvm/llvm-project/pull/84983
More information about the cfe-commits
mailing list