diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-22 19:52:55 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-22 19:52:55 +0000 |
commit | 13bf9892dc2a37a4c4a0fcce8cb79ed8798a236f (patch) | |
tree | 7de36123533f812e0fcea10b020e7eb2a1c8556b /clang/test/CodeGenCXX/cxx1z-decomposition.cpp | |
parent | 6dbf4a86a7c8d2a63aebb96c3e7d1ac477a40d9e (diff) | |
download | bcm5719-llvm-13bf9892dc2a37a4c4a0fcce8cb79ed8798a236f.tar.gz bcm5719-llvm-13bf9892dc2a37a4c4a0fcce8cb79ed8798a236f.zip |
Part of P1091R3: permit structured bindings to be declared 'static' and
'thread_local' in C++20.
llvm-svn: 361424
Diffstat (limited to 'clang/test/CodeGenCXX/cxx1z-decomposition.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/cxx1z-decomposition.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/cxx1z-decomposition.cpp b/clang/test/CodeGenCXX/cxx1z-decomposition.cpp index b9212006053..8e71b1230c4 100644 --- a/clang/test/CodeGenCXX/cxx1z-decomposition.cpp +++ b/clang/test/CodeGenCXX/cxx1z-decomposition.cpp @@ -116,3 +116,50 @@ void test_bitfield(A &a) { // CHECK: or i16 %{{.*}}, 5 // CHECK: store i16 %{{.*}}, i16* %[[BITFIELD]], } + +// CHECK-LABEL: define {{.*}}@_Z18test_static_simple +void test_static_simple() { + static auto [x1, x2] = make<A>(); + // CHECK: load atomic {{.*}}i64* @_ZGVZ18test_static_simplevEDC2x12x2E + // CHECK: br i1 + // CHECK: @__cxa_guard_acquire( + // CHECK: call {{.*}} @_Z4makeI1AERT_v( + // CHECK: memcpy{{.*}} @_ZZ18test_static_simplevEDC2x12x2E + // CHECK: @__cxa_guard_release( +} + +// CHECK-LABEL: define {{.*}}@_Z17test_static_tuple +void test_static_tuple() { + // Note that the desugaring specified for this construct requires three + // separate guarded initializations. It is possible for an exception to be + // thrown after the first initialization and before the second, and if that + // happens, we are not permitted to rerun the first initialization, so we + // can't combine these into a single guarded initialization in general. + static auto [x1, x2] = make<B>(); + + // Initialization of the implied variable. + // CHECK: load atomic {{.*}} @_ZGVZ17test_static_tuplevEDC2x12x2E + // CHECK: br i1 + // CHECK: @__cxa_guard_acquire({{.*}} @_ZGVZ17test_static_tuplevEDC2x12x2E) + // CHECK: call {{.*}} @_Z4makeI1BERT_v( + // CHECK: @__cxa_guard_release({{.*}} @_ZGVZ17test_static_tuplevEDC2x12x2E) + + // Initialization of the secret 'x1' variable. + // CHECK: load atomic {{.*}} @_ZGVZ17test_static_tuplevE2x1 + // CHECK: br i1 + // CHECK: @__cxa_guard_acquire({{.*}} @_ZGVZ17test_static_tuplevE2x1) + // CHECK: call {{.*}} @_Z3getILi0EEDa1B( + // CHECK: call {{.*}} @_ZN1XC1E1Y({{.*}} @_ZGRZ17test_static_tuplevE2x1_, + // CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN1XD1Ev {{.*}} @_ZGRZ17test_static_tuplevE2x1_ + // CHECK: store {{.*}} @_ZGRZ17test_static_tuplevE2x1_, {{.*}} @_ZZ17test_static_tuplevE2x1 + // CHECK: call void @__cxa_guard_release({{.*}} @_ZGVZ17test_static_tuplevE2x1) + + // Initialization of the secret 'x2' variable. + // CHECK: load atomic {{.*}} @_ZGVZ17test_static_tuplevE2x2 + // CHECK: br i1 + // CHECK: @__cxa_guard_acquire({{.*}} @_ZGVZ17test_static_tuplevE2x2) + // CHECK: call {{.*}} @_Z3getILi1EEDa1B( + // CHECK: store {{.*}}, {{.*}} @_ZGRZ17test_static_tuplevE2x2_ + // CHECK: store {{.*}} @_ZGRZ17test_static_tuplevE2x2_, {{.*}} @_ZZ17test_static_tuplevE2x2 + // CHECK: call void @__cxa_guard_release({{.*}} @_ZGVZ17test_static_tuplevE2x2) +} |