summaryrefslogtreecommitdiff
path: root/clang/test/CIR/CodeGen/struct.cpp
diff options
context:
space:
mode:
authorAmr Hesham <amr96@programmer.net>2025-10-04 11:52:09 +0200
committerGitHub <noreply@github.com>2025-10-04 09:52:09 +0000
commit7c666e24807b4b2a07370a11706a4bff8f34aef2 (patch)
treeb6e1ebf0dc2e80c9c550c0b98461f2d306bc1af6 /clang/test/CIR/CodeGen/struct.cpp
parent8243c368b750cfe127aed3cd96c675b4499be7f9 (diff)
[CIR] Implement UnaryExtension for AggregateExpr (#161820)
Implement the UnaryExtension support for AggregateExpr
Diffstat (limited to 'clang/test/CIR/CodeGen/struct.cpp')
-rw-r--r--clang/test/CIR/CodeGen/struct.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/CIR/CodeGen/struct.cpp b/clang/test/CIR/CodeGen/struct.cpp
index c0f0e0b5b853..52367bd9c6ca 100644
--- a/clang/test/CIR/CodeGen/struct.cpp
+++ b/clang/test/CIR/CodeGen/struct.cpp
@@ -184,6 +184,20 @@ void generic_selection() {
// OGCG: %[[D_ADDR:.*]] = alloca %struct.CompleteS, align 4
// OGCG: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %[[D_ADDR]], ptr align 4 %[[A_ADDR]], i64 8, i1 false)
+void unary_extension() {
+ CompleteS a = __extension__ CompleteS();
+}
+
+// CIR: %[[A_ADDR:.*]] = cir.alloca !rec_CompleteS, !cir.ptr<!rec_CompleteS>, ["a", init]
+// CIR: %[[ZERO_INIT:.*]] = cir.const #cir.zero : !rec_CompleteS
+// CIR: cir.store{{.*}} %[[ZERO_INIT]], %[[A_ADDR]] : !rec_CompleteS, !cir.ptr<!rec_CompleteS>
+
+// LLVM: %[[A_ADDR:.*]] = alloca %struct.CompleteS, i64 1, align 4
+// LLVM: store %struct.CompleteS zeroinitializer, ptr %[[A_ADDR]], align 4
+
+// OGCG: %[[A_ADDR:.*]] = alloca %struct.CompleteS, align 4
+// OGCG: call void @llvm.memset.p0.i64(ptr align 4 %[[A_ADDR]], i8 0, i64 8, i1 false)
+
void bin_comma() {
CompleteS a = (CompleteS(), CompleteS());
}