================
@@ -0,0 +1,374 @@
+// RUN: %clang_cc1 -no-enable-noundef-analysis %s -triple=x86_64-linux-gnu
-fclangir -emit-cir -std=c++11 -fcxx-exceptions -fexceptions -o %t.cir
+// RUN: FileCheck -check-prefixes=CIR --input-file=%t.cir %s
+// RUN: %clang_cc1 -no-enable-noundef-analysis %s -triple=x86_64-linux-gnu
-fclangir -emit-llvm -std=c++11 -fcxx-exceptions -fexceptions -o %t-cir.ll
+// RUN: FileCheck -check-prefixes=LLVM --input-file=%t-cir.ll %s
+// RUN: %clang_cc1 -no-enable-noundef-analysis %s -triple=x86_64-linux-gnu
-emit-llvm -std=c++11 -fcxx-exceptions -fexceptions -o %t.ll
+// RUN: FileCheck -check-prefixes=OGCG --input-file=%t.ll %s
+
+struct A {
+ A(int);
+ ~A();
+};
+
+struct B {
+ B();
+ ~B();
+ operator int();
+ int x;
+};
+
+B makeB();
+
+A *deact_simple() { return new A(makeB()); }
+
+// CIR-LABEL: cir.func {{.*}} @_Z12deact_simplev() -> !cir.ptr<!rec_A> {
+// CIR: %[[RETVAL:.*]] = cir.alloca !cir.ptr<!rec_A>,
!cir.ptr<!cir.ptr<!rec_A>>, ["__retval"]
+// CIR: cir.scope {
+// CIR: %[[NEW_RESULT:.*]] = cir.alloca !cir.ptr<!rec_A>,
!cir.ptr<!cir.ptr<!rec_A>>, ["__new_result"]
+// CIR: %[[TMP:.*]] = cir.alloca !rec_B, !cir.ptr<!rec_B>, ["ref.tmp0"]
+// CIR: %[[ACTIVE:.*]] = cir.alloca !cir.bool, !cir.ptr<!cir.bool>,
["cleanup.isactive"]
+// CIR: %[[PTR:.*]] = cir.call @_Znwm({{.*}}) {{{.*}}builtin}
+// CIR: cir.cleanup.scope {
+// CIR: %[[TRUE:.*]] = cir.const #true
+// CIR: cir.store %[[TRUE]], %[[ACTIVE]] : !cir.bool, !cir.ptr<!cir.bool>
+// CIR: %[[MAKEB:.*]] = cir.call @_Z5makeBv() : () -> !rec_B
+// CIR: cir.store{{.*}} %[[MAKEB]], %[[TMP]] : !rec_B, !cir.ptr<!rec_B>
+// CIR: cir.cleanup.scope {
+// CIR: %[[CONV:.*]] = cir.call @_ZN1BcviEv(%[[TMP]])
+// CIR: cir.call @_ZN1AC1Ei({{.*}})
+// CIR: %[[FALSE:.*]] = cir.const #false
+// CIR: cir.store %[[FALSE]], %[[ACTIVE]] : !cir.bool,
!cir.ptr<!cir.bool>
+// CIR: } cleanup all {
+// CIR: cir.call @_ZN1BD1Ev(%[[TMP]]) nothrow
+// CIR: }
+// CIR: } cleanup eh {
+// CIR: %[[IS_ACTIVE:.*]] = cir.load{{.*}} %[[ACTIVE]] :
!cir.ptr<!cir.bool>, !cir.bool
+// CIR: cir.if %[[IS_ACTIVE]] {
+// CIR: cir.call @_ZdlPv(%[[PTR]]) nothrow {builtin}
----------------
efriedma-quic wrote:
This looks like what I expected, yes.
https://github.com/llvm/llvm-project/pull/187389
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits