[PCH] Clear switch case IDs when deserializing a objc method body.

Fixes rdar://11353109 & http://llvm.org/bugs/show_bug.cgi?id=12689

llvm-svn: 156056
This commit is contained in:
Argyrios Kyrtzidis 2012-05-03 02:26:32 +00:00
parent 1655aee1e3
commit 2a5deff59d
2 changed files with 18 additions and 0 deletions

View File

@ -629,6 +629,8 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
if (Record[Idx++]) {
// In practice, this won't be executed (since method definitions
// don't occur in header files).
// Switch case IDs are per method body.
Reader.ClearSwitchCaseIDs();
MD->setBody(Reader.ReadStmt(F));
MD->setSelfDecl(ReadDeclAs<ImplicitParamDecl>(Record, Idx));
MD->setCmdDecl(ReadDeclAs<ImplicitParamDecl>(Record, Idx));

View File

@ -9,3 +9,19 @@
// FIXME: @compatibility_alias AliasForTestPCH TestPCH;
// http://llvm.org/PR12689
@interface PR12689
@end
@implementation PR12689
-(void)mugi:(int)x {
switch(x) {
case 23: {}
}
}
-(void)bonk:(int)x {
switch(x) {
case 42: {}
}
}
@end