]> granicus.if.org Git - clang/commitdiff
[PCH] Clear switch case IDs when deserializing a objc method body.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 3 May 2012 02:26:32 +0000 (02:26 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 3 May 2012 02:26:32 +0000 (02:26 +0000)
Fixes rdar://11353109 & http://llvm.org/bugs/show_bug.cgi?id=12689

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156056 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReaderDecl.cpp
test/PCH/objc_methods.h

index 8dd53ee7d206b0ade4315de880d2bd3311601038..15aa90b3516e502eb569f3d143dc2fc11bbb0c1d 100644 (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));
index c9b1ad4342c6c5cc8260892fe51db9cce52ec486..7b9e22decb61410c78a3807dea80512762daae54 100644 (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