[llvm-branch-commits] [clang] [ConstantTime][Clang] Add __builtin_ct_select for constant-time selection (PR #166703)
Eli Friedman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Nov 6 13:24:58 PST 2025
================
@@ -6450,6 +6451,40 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
auto Str = CGM.GetAddrOfConstantCString(Name, "");
return RValue::get(Str.getPointer());
}
+ case Builtin::BI__builtin_ct_select: {
+ if (E->getNumArgs() != 3) {
+ CGM.getDiags().Report(E->getBeginLoc(),
+ E->getNumArgs() > 3
+ ? diag::err_typecheck_call_too_many_args
+ : diag::err_typecheck_call_too_few_args);
+ return GetUndefRValue(E->getType());
----------------
efriedma-quic wrote:
We shouldn't be generating diagnostics here; Sema should have already generated the relevant diagnostics, and if Sema generates a diagnostic, we don't reach codegen.
https://github.com/llvm/llvm-project/pull/166703
More information about the llvm-branch-commits
mailing list