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/temporaries.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/temporaries.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/temporaries.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/temporaries.cpp b/clang/test/CodeGenCXX/temporaries.cpp index 21372effbcf..bad51ba353c 100644 --- a/clang/test/CodeGenCXX/temporaries.cpp +++ b/clang/test/CodeGenCXX/temporaries.cpp @@ -198,6 +198,20 @@ B::B() f(); } +struct C { + C(); + + const B& b; +}; + +C::C() + // CHECK: call void @_ZN6PR50771BC1Ev + : b(B()) { + // CHECK: call void @_ZN6PR50771fEv + f(); + + // CHECK: call void @_ZN6PR50771BD1Ev +} } A f8() { @@ -802,3 +816,16 @@ namespace PR14130 { // CHECK: call void @_ZN7PR141301SC1Ei({{.*}} @_ZGRN7PR141301vE_, i32 0) // CHECK: store {{.*}} @_ZGRN7PR141301vE_, {{.*}} @_ZN7PR141301vE } + +namespace Ctor { + struct A { A(); ~A(); }; + void f(); + struct B { + A &&a; + B() : a{} { f(); } + } b; + // CHECK: define {{.*}}void @_ZN4Ctor1BC1Ev( + // CHECK: call void @_ZN4Ctor1AC1Ev( + // CHECK: call void @_ZN4Ctor1fEv( + // CHECK: call void @_ZN4Ctor1AD1Ev( +} |