summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/global-init.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-08-07 05:18:29 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-08-07 05:18:29 +0000
commita33e4fe603d8e9a06606aac8c790296b22375c87 (patch)
tree8c18f1adb2f76d52f79b76b5690bb540009164fd /clang/test/CodeGenCXX/global-init.cpp
parentb8146afcd15577e2140ea74253d52078877f50f6 (diff)
downloadbcm5719-llvm-a33e4fe603d8e9a06606aac8c790296b22375c87.tar.gz
bcm5719-llvm-a33e4fe603d8e9a06606aac8c790296b22375c87.zip
Update documentation of HasSideEffects to match its callers' expectations, and
update implementation to match. An elidable, non-trivial constructor call is a side-effect under this definition, but wasn't under the old one, because we are not required to evaluate it even though it may have an effect. Also rationalize checking for volatile reads: just look for lvalue-to-rvalue conversions on volatile glvalues, and ignore whether a DeclRefExpr etc is for a volatile variable. llvm-svn: 161393
Diffstat (limited to 'clang/test/CodeGenCXX/global-init.cpp')
-rw-r--r--clang/test/CodeGenCXX/global-init.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/clang/test/CodeGenCXX/global-init.cpp b/clang/test/CodeGenCXX/global-init.cpp
index da5467ac3f4..2a53ad9e3e7 100644
--- a/clang/test/CodeGenCXX/global-init.cpp
+++ b/clang/test/CodeGenCXX/global-init.cpp
@@ -129,6 +129,14 @@ namespace test6 {
const std::type_info *const t = &typeid(p);
// CHECK-NOT: @_ZN5test6L1tE
+ extern B *volatile v;
+ // CHECK: store {{.*}} @_ZN5test6L1wE
+ B *const w = dynamic_cast<B*>(v);
+
+ // CHECK: load volatile
+ // CHECK: store {{.*}} @_ZN5test6L1xE
+ const int x = *(volatile int*)0x1234;
+
namespace {
int a = int();
volatile int b = int();
@@ -145,7 +153,7 @@ namespace test6 {
namespace test7 {
struct A { A(); };
struct B { ~B(); int n; };
- struct C { C() = default; C(const C&); };
+ struct C { C() = default; C(const C&); int n; };
struct D {};
// CHECK: call void @_ZN5test71AC1Ev({{.*}}@_ZN5test7L1aE)
@@ -161,8 +169,12 @@ namespace test7 {
// CHECK-NOT: @_ZN5test7L2c1E
// CHECK: @_ZN5test7L2c2E
- const C c1 = C(); // elidable copy
- const C c2 = static_cast<C&&>(C()); // non-elidable copy
+ // CHECK-NOT: @_ZN5test7L2c3E
+ // CHECK: @_ZN5test7L2c4E
+ const C c1 = C();
+ const C c2 = static_cast<const C&>(C());
+ const int c3 = C().n;
+ const int c4 = C(C()).n;
// CHECK-NOT: @_ZN5test7L1dE
const D d = D();
OpenPOWER on IntegriCloud