diff options
author | John McCall <rjmccall@apple.com> | 2010-02-02 08:02:49 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-02-02 08:02:49 +0000 |
commit | 49786a6c31ae410b9bca94699bb3b70088c9f147 (patch) | |
tree | 39c544116f00a9e99414c7ca6b8ec2e519603ddc /clang/test/CodeGenCXX/global-init.cpp | |
parent | 75b1f959da8e4e9985b321a1f1c685296e924fc9 (diff) | |
download | bcm5719-llvm-49786a6c31ae410b9bca94699bb3b70088c9f147.tar.gz bcm5719-llvm-49786a6c31ae410b9bca94699bb3b70088c9f147.zip |
Codegen CXXConstructExprs with trivial constructors as constants.
Eliminates a lot of spurious global initializers, fixing PR6205.
llvm-svn: 95077
Diffstat (limited to 'clang/test/CodeGenCXX/global-init.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/global-init.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/global-init.cpp b/clang/test/CodeGenCXX/global-init.cpp index b375aef4c8e..fd8c1597556 100644 --- a/clang/test/CodeGenCXX/global-init.cpp +++ b/clang/test/CodeGenCXX/global-init.cpp @@ -7,6 +7,10 @@ struct A { struct B { B(); ~B(); }; +struct C { void *field; }; + +// CHECK: @c = global %struct.C zeroinitializer, align 8 + // CHECK: call void @_ZN1AC1Ev(%struct.A* @a) // CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @a, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*)) A a; @@ -14,3 +18,9 @@ A a; // CHECK: call void @_ZN1BC1Ev(%struct.A* @b) // CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1BD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @b, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*)) B b; + +// PR6205: this should not require a global initializer +// CHECK-NOT: call void @_ZN1CC1Ev(%struct.C* @c) +C c; + +// CHECK: define internal void @__cxx_global_initialization() { |