[clang] [CIR] Add if statement support (PR #134333)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 4 09:47:50 PDT 2025


================
@@ -0,0 +1,254 @@
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
+
+int if0(bool a) {
+
+  if (a)
----------------
erichkeane wrote:

We should have tests for the `init` section of an `if` (`if (auto x = something; x.something_else)`), or the 'init-as-condition' case (`if (auto x = something)`), and ALSO that both of those are in scope in the `else`. 

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


More information about the cfe-commits mailing list