summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/sanitize-init-order.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-04-05 07:47:28 +0000
committerAlexey Samsonov <samsonov@google.com>2013-04-05 07:47:28 +0000
commitcb9efbe6d727d2eb8a62fd7df2a91055b037f11b (patch)
treef89b864218a0ff2c0d8e417615aad20eb8bb7f63 /clang/test/CodeGen/sanitize-init-order.cpp
parent46b8665ea49afebea3161dbad80f81b4d81fd83f (diff)
downloadbcm5719-llvm-cb9efbe6d727d2eb8a62fd7df2a91055b037f11b.tar.gz
bcm5719-llvm-cb9efbe6d727d2eb8a62fd7df2a91055b037f11b.zip
Allow EmitConstantInit() to emit constant initializers for objects with trivial constructors and non-trivial destructors. Test that such objects are ignored by init-order checker.
llvm-svn: 178856
Diffstat (limited to 'clang/test/CodeGen/sanitize-init-order.cpp')
-rw-r--r--clang/test/CodeGen/sanitize-init-order.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/CodeGen/sanitize-init-order.cpp b/clang/test/CodeGen/sanitize-init-order.cpp
new file mode 100644
index 00000000000..3e94620193f
--- /dev/null
+++ b/clang/test/CodeGen/sanitize-init-order.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsanitize=address,init-order -emit-llvm -o - %s | FileCheck %s
+
+struct PODStruct {
+ int x;
+};
+PODStruct s1;
+
+struct PODWithDtor {
+ ~PODWithDtor() { }
+ int x;
+};
+PODWithDtor s2;
+
+struct PODWithCtorAndDtor {
+ PODWithCtorAndDtor() { }
+ ~PODWithCtorAndDtor() { }
+ int x;
+};
+PODWithCtorAndDtor s3;
+
+// Check that ASan init-order checking ignores structs with trivial default
+// constructor.
+// CHECK: !llvm.asan.dynamically_initialized_globals = !{[[GLOB:![0-9]+]]}
+// CHECK: [[GLOB]] = metadata !{%struct.PODWithCtorAndDtor
OpenPOWER on IntegriCloud