[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 03:08:02 PDT 2024


================
@@ -7963,6 +7967,148 @@ static Attr *getCCTypeAttr(ASTContext &Ctx, ParsedAttr &Attr) {
   llvm_unreachable("unexpected attribute kind!");
 }
 
+ExprResult Sema::ActOnEffectExpression(Expr *CondExpr, FunctionEffectMode &Mode,
+                                       bool RequireConstexpr) {
+  // see checkFunctionConditionAttr, Sema::CheckCXXBooleanCondition
+  if (RequireConstexpr || !CondExpr->isTypeDependent()) {
+    ExprResult E = PerformContextuallyConvertToBool(CondExpr);
+    if (E.isInvalid())
+      return E;
+    CondExpr = E.get();
+    if (RequireConstexpr || !CondExpr->isValueDependent()) {
+      llvm::APSInt CondInt;
+      E = VerifyIntegerConstantExpression(
----------------
Sirraide wrote:

> Is there a way at this time to detect that the expression is not only dependent but an unexpanded pack?

Iirc pack dependence is a thing. You should be able to check for that.

> If I add void g() { f<true, false>(); } there is a second attempt to resolve the expression but it is still dependent, so clearly there is an error here

I’ll have to check how we currently handle these cases because I’m not terribly familiar w/ packs myself.

https://github.com/llvm/llvm-project/pull/84983


More information about the cfe-commits mailing list