2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc %s -emit-llvm-bc -o - | opt -std-compile-opts -disable-output
|
2007-10-05 07:45:31 +08:00
|
|
|
|
|
|
|
int foo(int i) {
|
|
|
|
int j = 0;
|
|
|
|
switch (i) {
|
2007-12-01 01:44:57 +08:00
|
|
|
case -1:
|
|
|
|
j = 1; break;
|
2007-10-05 07:45:31 +08:00
|
|
|
case 1 :
|
|
|
|
j = 2; break;
|
|
|
|
case 2:
|
|
|
|
j = 3; break;
|
|
|
|
default:
|
|
|
|
j = 42; break;
|
|
|
|
}
|
|
|
|
j = j + 1;
|
|
|
|
return j;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 04:54:07 +08:00
|
|
|
int foo2(int i) {
|
|
|
|
int j = 0;
|
|
|
|
switch (i) {
|
|
|
|
case 1 :
|
|
|
|
j = 2; break;
|
|
|
|
case 2 ... 10:
|
|
|
|
j = 3; break;
|
|
|
|
default:
|
|
|
|
j = 42; break;
|
|
|
|
}
|
|
|
|
j = j + 1;
|
|
|
|
return j;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-09 04:57:48 +08:00
|
|
|
int foo3(int i) {
|
|
|
|
int j = 0;
|
|
|
|
switch (i) {
|
|
|
|
default:
|
|
|
|
j = 42; break;
|
|
|
|
case 111:
|
|
|
|
j = 111; break;
|
|
|
|
case 0 ... 100:
|
|
|
|
j = 1; break;
|
|
|
|
case 222:
|
|
|
|
j = 222; break;
|
|
|
|
}
|
|
|
|
return j;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int foo4(int i) {
|
|
|
|
int j = 0;
|
|
|
|
switch (i) {
|
|
|
|
case 111:
|
|
|
|
j = 111; break;
|
|
|
|
case 0 ... 100:
|
|
|
|
j = 1; break;
|
|
|
|
case 222:
|
|
|
|
j = 222; break;
|
|
|
|
default:
|
|
|
|
j = 42; break;
|
|
|
|
case 501 ... 600:
|
|
|
|
j = 5; break;
|
|
|
|
}
|
|
|
|
return j;
|
|
|
|
}
|
2007-12-01 13:27:33 +08:00
|
|
|
|
|
|
|
void foo5(){
|
|
|
|
switch(0){
|
|
|
|
default:
|
|
|
|
if (0) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-13 00:08:04 +08:00
|
|
|
void foo6(){
|
|
|
|
switch(0){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void foo7(){
|
|
|
|
switch(0){
|
|
|
|
foo7();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|