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

via cfe-commits cfe-commits at lists.llvm.org
Sat May 4 10:31: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())
----------------
Sirraide wrote:

It might be fine in that case; the main reason why I suggested `isUsable()` is mostly ‘just in case’, i.e. if I don’t know off the top of my head whether there are any code paths there that could possibly lead to something being unset, then I generally prefer using `isUsable()` just in case.

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


More information about the cfe-commits mailing list