2007-10-05 04:19:06 +08:00
|
|
|
// RUN: clang -fsyntax-only -verify %s
|
|
|
|
|
2007-09-20 03:14:32 +08:00
|
|
|
void * proc();
|
|
|
|
|
2008-03-10 14:06:04 +08:00
|
|
|
@interface NSConstantString
|
|
|
|
@end
|
|
|
|
|
2007-09-20 03:14:32 +08:00
|
|
|
@interface Frob
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface Frob1
|
|
|
|
@end
|
|
|
|
|
|
|
|
void * foo()
|
|
|
|
{
|
2007-12-28 03:57:00 +08:00
|
|
|
@try {
|
|
|
|
return proc();
|
|
|
|
}
|
|
|
|
@catch (Frob* ex) {
|
|
|
|
@throw;
|
|
|
|
}
|
|
|
|
@catch (Frob1* ex) {
|
|
|
|
@throw proc();
|
|
|
|
}
|
|
|
|
@finally {
|
|
|
|
@try {
|
|
|
|
return proc();
|
|
|
|
}
|
|
|
|
@catch (Frob* ex) {
|
|
|
|
@throw 1,2;
|
|
|
|
}
|
|
|
|
@catch(...) {
|
|
|
|
@throw (4,3,proc());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@try { // expected-error {{@try statment without a @catch and @finally clause}}
|
|
|
|
return proc();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void bar()
|
|
|
|
{
|
|
|
|
@try {}// expected-error {{@try statment without a @catch and @finally clause}}
|
2008-03-10 14:06:04 +08:00
|
|
|
@"s"; // expected-warning {{result unused}}
|
2007-12-28 03:57:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void baz()
|
|
|
|
{
|
|
|
|
@try {}// expected-error {{@try statment without a @catch and @finally clause}}
|
2008-03-10 14:06:04 +08:00
|
|
|
@try {}
|
2007-12-28 03:57:00 +08:00
|
|
|
@finally {}
|
2007-09-20 03:14:32 +08:00
|
|
|
}
|
|
|
|
|
2008-02-06 05:27:35 +08:00
|
|
|
void noTwoTokenLookAheadRequiresABitOfFancyFootworkInTheParser() {
|
|
|
|
@try {
|
|
|
|
// Do something
|
|
|
|
} @catch (...) {}
|
|
|
|
@try {
|
|
|
|
// Do something
|
|
|
|
} @catch (...) {}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|