llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Srivarshitha M (16srivarshitha)

<details>
<summary>Changes</summary>

This PR upstreams `expressions.cpp` and `c89-implicit-int.c` from the ClangIR 
incubator to the mainline. 

Following the incremental approach discussed in #<!-- -->156747 and the 
feedback from the closed PR #<!-- -->157333, I have:
1. Copied the files directly from the incubator to preserve history.
2. Updated the `RUN` lines to use the `--check-prefix=CIR` flag.
3. Converted `CHECK:` lines to `CIR:`.
4. Standardized variable captures using the `%[[VAR:.*]]` regex syntax (in 
`expressions.cpp`).

Verified locally with `llvm-lit`. This is a partial fix for #<!-- -->156747.

*Note: As suggested in previous reviews, I am focusing only on the `CIR` checks 
for now to keep the upstreaming incremental. OGCG/LLVM verification can be 
added in a follow-up PR once the base tests land.*

---
Full diff: https://github.com/llvm/llvm-project/pull/183998.diff


2 Files Affected:

- (added) clang/test/CIR/CodeGen/c89-implicit-int.c (+10) 
- (added) clang/test/CIR/CodeGen/expressions.cpp (+11) 


``````````diff
diff --git a/clang/test/CIR/CodeGen/c89-implicit-int.c 
b/clang/test/CIR/CodeGen/c89-implicit-int.c
new file mode 100644
index 0000000000000..f3a98efcc480f
--- /dev/null
+++ b/clang/test/CIR/CodeGen/c89-implicit-int.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c89 -emit-cir %s -o 
%t.cir
+// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
+
+// Implicit int return type.
+test = 0;
+// CIR: cir.global external @test = #cir.int<0> : !s32i
+func (void) {
+// CIR: cir.func {{.*}} @func() -> !s32i
+  return 0;
+}
diff --git a/clang/test/CIR/CodeGen/expressions.cpp 
b/clang/test/CIR/CodeGen/expressions.cpp
new file mode 100644
index 0000000000000..cbd54e2fd4655
--- /dev/null
+++ b/clang/test/CIR/CodeGen/expressions.cpp
@@ -0,0 +1,11 @@
+// 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
+
+void test(int a) {
+// CIR: cir.func {{.*}} @{{.+}}test
+
+  // Should generate LValue parenthesis expression.
+  (a) = 1;
+  // CIR: %[[CONST:.*]] = cir.const #cir.int<1> : !s32i
+  // CIR: cir.store{{.*}} %[[CONST]], %{{.+}} : !s32i, !cir.ptr<!s32i>
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/183998
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to