From 50f9de5d893694a7e46ba655ec9fce5dfeae9362 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Fri, 5 Apr 2013 07:47:28 +0000 Subject: 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 --- test/CodeGen/sanitize-init-order.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/CodeGen/sanitize-init-order.cpp (limited to 'test/CodeGen/sanitize-init-order.cpp') 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 -- cgit v1.2.3-18-g5258