diff options
author | Florian Hahn <florian.hahn@arm.com> | 2018-07-17 09:23:31 +0000 |
---|---|---|
committer | Florian Hahn <florian.hahn@arm.com> | 2018-07-17 09:23:31 +0000 |
commit | 0aa117dd2c57608903a0b79e2661f4f5bff42dc1 (patch) | |
tree | 6cc4758ae7b18c91085d635682085367f818212b /clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp | |
parent | ea5d3f23e05413c9ec006b6e0dfde091353dba1a (diff) | |
download | bcm5719-llvm-0aa117dd2c57608903a0b79e2661f4f5bff42dc1.tar.gz bcm5719-llvm-0aa117dd2c57608903a0b79e2661f4f5bff42dc1.zip |
Temporarily revert r337226 "Restructure checking for, and warning on, lifetime extension."
This change breaks on ARM because pointers to clang::InitializedEntity are only
4 byte aligned and do not have 3 bits to store values. A possible solution
would be to change the fields in clang::InitializedEntity to enforce a bigger
alignment requirement.
The error message is
llvm/include/llvm/ADT/PointerIntPair.h:132:3: error: static_assert failed "PointerIntPair with integer size too large for pointer"
static_assert(IntBits <= PtrTraits::NumLowBitsAvailable,
include/llvm/ADT/PointerIntPair.h:73:13: note: in instantiation of template class 'llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> >' requested here
Value = Info::updateInt(Info::updatePointer(0, PtrVal),
llvm/include/llvm/ADT/PointerIntPair.h:51:5: note: in instantiation of member function 'llvm::PointerIntPair<const clang::InitializedEntity *, 3, (anonymous namespace)::LifetimeKind, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *>, llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> > >::setPointerAndInt' requested here
setPointerAndInt(PtrVal, IntVal);
^
llvm/tools/clang/lib/Sema/SemaInit.cpp:6237:12: note: in instantiation of member function 'llvm::PointerIntPair<const clang::InitializedEntity *, 3, (anonymous namespace)::LifetimeKind, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *>, llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> > >::PointerIntPair' requested here
return {Entity, LK_Extended};
Full log here:
http://lab.llvm.org:8011/builders/clang-cmake-armv7-global-isel/builds/1330
http://lab.llvm.org:8011/builders/clang-cmake-armv7-full/builds/1394
llvm-svn: 337255
Diffstat (limited to 'clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp b/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp index 0184a1d6e73..3299763997e 100644 --- a/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -236,6 +236,36 @@ void fn9() { // CHECK: ret void } +struct haslist1 { + std::initializer_list<int> il; + haslist1(int i); +}; + +// CHECK-LABEL: define void @_ZN8haslist1C2Ei +haslist1::haslist1(int i) +// CHECK: alloca [3 x i32] +// CHECK: store i32 % +// CHECK: store i32 2 +// CHECK: store i32 3 + : il{i, 2, 3} +{ + destroyme2 dm2; +} + +struct haslist2 { + std::initializer_list<destroyme1> il; + haslist2(); +}; + +// CHECK-LABEL: define void @_ZN8haslist2C2Ev +haslist2::haslist2() + : il{destroyme1(), destroyme1()} +{ + destroyme2 dm2; + // CHECK: call void @_ZN10destroyme2D1Ev + // CHECK: call void @_ZN10destroyme1D1Ev +} + void fn10(int i) { // CHECK-LABEL: define void @_Z4fn10i // CHECK: alloca [3 x i32] |