summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp')
-rw-r--r--clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp b/clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp
new file mode 100644
index 00000000000..e7c9e9ac2a5
--- /dev/null
+++ b/clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks %s -emit-llvm -o - | FileCheck %s -check-prefix=UNINIT
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern %s -emit-llvm -o - | FileCheck %s -check-prefix=PATTERN
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=zero %s -emit-llvm -o - | FileCheck %s -check-prefix=ZERO
+
+template<typename T> void used(T &) noexcept;
+
+extern "C" {
+
+// UNINIT-LABEL: test_attribute_uninitialized(
+// UNINIT: alloca
+// UNINIT-NEXT: call void
+// ZERO-LABEL: test_attribute_uninitialized(
+// ZERO: alloca
+// ZERO-NEXT: call void
+// PATTERN-LABEL: test_attribute_uninitialized(
+// PATTERN: alloca
+// PATTERN-NEXT: call void
+void test_attribute_uninitialized() {
+ [[clang::uninitialized]] int i;
+ used(i);
+}
+
+} // extern "C"
OpenPOWER on IntegriCloud