[clang] Use pushFullExprCleanup for deferred destroy (PR #88670)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 15 11:59:34 PDT 2024
================
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -emit-llvm -fexceptions -o - %s -triple x86_64-linux-gnu | FileCheck -check-prefixes=EH,CHECK %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -triple x86_64-linux-gnu | FileCheck -check-prefixes=NOEH,CHECK %s
+namespace std {
+ typedef decltype(sizeof(int)) size_t;
+
+ // libc++'s implementation
+ template <class _E>
+ class initializer_list
+ {
+ const _E* __begin_;
+ size_t __size_;
+ initializer_list(const _E* __b, size_t __s);
+ };
+}
+
+class Object {
+public:
+ Object() = default;
+ struct KV;
+ explicit Object(std::initializer_list<KV> Properties);
+};
+
+class Value {
+public:
+ Value(std::initializer_list<Value> Elements);
----------------
efriedma-quic wrote:
```
class Object {
public:
struct KV;
Object(KV);
};
struct A { A(); ~A(); };
class Value {
public:
Value(A);
Value(const char *V);
~Value();
};
class ObjectKey {
public:
ObjectKey(const char *S);
~ObjectKey();
};
struct Object::KV {
ObjectKey K;
Value V;
};
bool foo();
void DestroyInConditionalCleanup() {
foo() ? Object{{"key1", A()}} : Object{{"key2", "val2"}};
}
```
Not really a big deal either way, though; just a minor cleanup.
https://github.com/llvm/llvm-project/pull/88670
More information about the cfe-commits
mailing list