1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks %s -emit-llvm -o - | FileCheck %s -check-prefix=UNINIT
2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern %s -emit-llvm -o - | FileCheck %s -check-prefix=PATTERN
3 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=zero %s -emit-llvm -o - | FileCheck %s -check-prefix=ZERO
4
5 template<typename T> void used(T &) noexcept;
6
7 extern "C" {
8
9 // UNINIT-LABEL: test_attribute_uninitialized(
10 // UNINIT: alloca
11 // UNINIT-NEXT: call void
12 // ZERO-LABEL: test_attribute_uninitialized(
13 // ZERO: alloca
14 // ZERO-NOT: !annotation
15 // ZERO-NEXT: call void
16 // PATTERN-LABEL: test_attribute_uninitialized(
17 // PATTERN: alloca
18 // PATTERN-NOT: !annotation
19 // PATTERN-NEXT: call void
test_attribute_uninitialized()20 void test_attribute_uninitialized() {
21 [[clang::uninitialized]] int i;
22 used(i);
23 }
24
25 #pragma clang attribute push([[clang::uninitialized]], apply_to = variable(is_local))
26 // UNINIT-LABEL: test_pragma_attribute_uninitialized(
27 // UNINIT: alloca
28 // UNINIT-NEXT: call void
29 // ZERO-LABEL: test_pragma_attribute_uninitialized(
30 // ZERO: alloca
31 // ZERO-NEXT: call void
32 // PATTERN-LABEL: test_pragma_attribute_uninitialized(
33 // PATTERN: alloca
34 // PATTERN-NEXT: call void
test_pragma_attribute_uninitialized()35 void test_pragma_attribute_uninitialized() {
36 int i;
37 used(i);
38 }
39 #pragma clang attribute pop
40
41 } // extern "C"
42