diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-04-05 07:47:28 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-04-05 07:47:28 +0000 |
commit | 50f9de5d893694a7e46ba655ec9fce5dfeae9362 (patch) | |
tree | 4dd5939272714d80a8d1728b685a3899df323120 /test/CodeGen/sanitize-init-order.cpp | |
parent | 418780f132a6d790b248ef91e1067c3c3dd31350 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178856 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/sanitize-init-order.cpp')
-rw-r--r-- | test/CodeGen/sanitize-init-order.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/CodeGen/sanitize-init-order.cpp b/test/CodeGen/sanitize-init-order.cpp new file mode 100644 index 0000000000..3e94620193 --- /dev/null +++ b/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 |