[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Profile / cxx-hash-v2.cpp
blob995fe008f52365f96bb16a6b773cdd11f81b62b8
1 // REQUIRES: shell
3 // Check that all of the hashes in this file are unique (i.e, that none of the
4 // profiles for these functions are mutually interchangeable).
5 //
6 // RUN: llvm-profdata show -all-functions %S/Inputs/cxx-hash-v2.profdata.v5 | grep "Hash: 0x" | sort > %t.hashes
7 // RUN: uniq %t.hashes > %t.hashes.unique
8 // RUN: diff %t.hashes %t.hashes.unique
10 // RUN: llvm-profdata merge %S/Inputs/cxx-hash-v2.proftext -o %t.profdata
11 // RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -triple x86_64-apple-macosx10.9 -main-file-name cxx-hash-v2.mm %s -o /dev/null -emit-llvm -fprofile-instrument-use-path=%t.profdata 2>&1 | FileCheck %s -allow-empty
12 // RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -triple x86_64-apple-macosx10.9 -main-file-name cxx-hash-v2.mm %s -o /dev/null -emit-llvm -fprofile-instrument-use-path=%S/Inputs/cxx-hash-v2.profdata.v5 2>&1 | FileCheck %s -allow-empty
14 // CHECK-NOT: warning: profile data may be out of date
16 int x;
17 int arr[1] = {0};
19 void loop_after_if_else() {
20 if (1)
21 x = 1;
22 else
23 x = 2;
24 while (0)
25 ++x;
28 void loop_in_then_block() {
29 if (1) {
30 while (0)
31 ++x;
32 } else {
33 x = 2;
37 void loop_in_else_block() {
38 if (1) {
39 x = 1;
40 } else {
41 while (0)
42 ++x;
46 void if_inside_of_for() {
47 for (x = 0; x < 0; ++x) {
48 x = 1;
49 if (1)
50 x = 2;
54 void if_outside_of_for() {
55 for (x = 0; x < 0; ++x)
56 x = 1;
57 if (1)
58 x = 2;
61 void if_inside_of_while() {
62 while (0) {
63 x = 1;
64 if (1)
65 x = 2;
69 void if_outside_of_while() {
70 while (0)
71 x = 1;
72 if (1)
73 x = 2;
76 void nested_dos() {
77 do {
78 do {
79 ++x;
80 } while (0);
81 } while (0);
84 void consecutive_dos() {
85 do {
86 } while (0);
87 do {
88 ++x;
89 } while (0);
92 void loop_empty() {
93 for (x = 0; x < 5; ++x) {}
96 void loop_return() {
97 for (x = 0; x < 5; ++x)
98 return;
101 void loop_continue() {
102 for (x = 0; x < 5; ++x)
103 continue;
106 void loop_break() {
107 for (x = 0; x < 5; ++x)
108 break;
111 void no_gotos() {
112 static void *dispatch[] = {&&done};
113 x = 0;
114 done:
115 ++x;
118 void direct_goto() {
119 static void *dispatch[] = {&&done};
120 x = 0;
121 goto done;
122 done:
123 ++x;
126 void indirect_goto() {
127 static void *dispatch[] = {&&done};
128 x = 0;
129 goto *dispatch[x];
130 done:
131 ++x;
134 void nested_for_ranges() {
135 for (int a : arr)
136 for (int b : arr)
137 ++x;
140 void consecutive_for_ranges() {
141 for (int a : arr) {}
142 for (int b : arr)
143 ++x;
146 void nested_try_catch() {
147 try {
148 try {
149 ++x;
150 } catch (...) {}
151 } catch (...) {}
154 void consecutive_try_catch() {
155 try {} catch (...) {}
156 try {
157 ++x;
158 } catch (...) {}
161 void no_throw() {}
163 void has_throw() {
164 throw 0;
167 void single_lnot() {
168 if (!x) {}
171 void double_lnot() {
172 if (!!x) {}
175 int main() {
176 return 0;