[clang] [CIR] Fix missing return value warning in maybePromoteBoolResult (PR #142673)

Morris Hafner via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 3 14:22:31 PDT 2025


https://github.com/mmha created https://github.com/llvm/llvm-project/pull/142673

This is NFC and simply adds an llvm_unreachable

>From 5e67287af5e55e3792e359812e539d8375d32f10 Mon Sep 17 00:00:00 2001
From: Morris Hafner <mhafner at nvidia.com>
Date: Tue, 3 Jun 2025 23:19:50 +0200
Subject: [PATCH] [CIR] Fix missing return value warning in
 maybePromoteBoolResult

This is NFC and simply adds an llvm_unreachable
---
 clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
index 77287ec45972d..0d9252a55d280 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
@@ -104,6 +104,7 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
       return builder.createBoolToInt(value, dstTy);
     if (mlir::isa<cir::BoolType>(dstTy))
       return value;
+    llvm_unreachable("Can only promote integer or boolean types");
   }
 
   //===--------------------------------------------------------------------===//



More information about the cfe-commits mailing list