Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / copypaste / labels.cpp
blob18c5b22d3b1c21511e34c54499b618a5472a1516
1 // RUN: %clang_analyze_cc1 -std=gnu++11 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
3 // expected-no-diagnostics
6 bool foo1(int x) {
7 start:
8 if (x != 3) {
9 ++x;
10 void *ptr = &&start;
11 goto start;
13 end:
14 return false;
17 // Targeting a different label with the address-of-label operator.
18 bool foo2(int x) {
19 start:
20 if (x != 3) {
21 ++x;
22 void *ptr = &&end;
23 goto start;
25 end:
26 return false;
29 // Different target label in goto
30 bool foo3(int x) {
31 start:
32 if (x != 3) {
33 ++x;
34 void *ptr = &&start;
35 goto end;
37 end:
38 return false;
41 // FIXME: Can't detect same algorithm as in foo1 but with different label names.
42 bool foo4(int x) {
43 foo:
44 if (x != 3) {
45 ++x;
46 void *ptr = &&foo;
47 goto foo;
49 end:
50 return false;