[clang] [libcxx] [Clang] Add __builtin_invoke and use it in libc++ (PR #116709)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue May 20 07:17:58 PDT 2025


================
@@ -5406,6 +5408,103 @@ ExprResult Sema::ConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo,
                                    RParenLoc, CurFPFeatureOverrides());
 }
 
+ExprResult Sema::BuiltinInvoke(CallExpr *TheCall) {
+  SourceLocation Loc = TheCall->getBeginLoc();
+  auto Args = MutableArrayRef(TheCall->getArgs(), TheCall->getNumArgs());
+  assert(llvm::none_of(Args,
+                       [](Expr *Arg) { return Arg->isTypeDependent(); }));
+
+  if (Args.size() == 0) {
----------------
erichkeane wrote:

Instead of all of these separate diagnostics, is there a reason we can't just use `Sema::checkArgCountAtLeast` and friends?   This one looks like a 'at least 1'.  5427 looks like `Sema::checkArgCountAtMost`, and 5440 `Sema::checkArgCount`.

WDYT?

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


More information about the cfe-commits mailing list