[cfe-commits] r156056 - in /cfe/trunk: lib/Serialization/ASTReaderDecl.cpp test/PCH/objc_methods.h

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed May 2 19:26:32 PDT 2012


Author: akirtzidis
Date: Wed May  2 21:26:32 2012
New Revision: 156056

URL: http://llvm.org/viewvc/llvm-project?rev=156056&view=rev
Log:
[PCH] Clear switch case IDs when deserializing a objc method body.

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

Modified:
    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
    cfe/trunk/test/PCH/objc_methods.h

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=156056&r1=156055&r2=156056&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Wed May  2 21:26:32 2012
@@ -629,6 +629,8 @@
   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));

Modified: cfe/trunk/test/PCH/objc_methods.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/objc_methods.h?rev=156056&r1=156055&r2=156056&view=diff
==============================================================================
--- cfe/trunk/test/PCH/objc_methods.h (original)
+++ cfe/trunk/test/PCH/objc_methods.h Wed May  2 21:26:32 2012
@@ -9,3 +9,19 @@
 
 // FIXME: @compatibility_alias  AliasForTestPCH TestPCH;
 
+// http://llvm.org/PR12689
+ at interface PR12689
+ at end
+
+ at implementation PR12689
+-(void)mugi:(int)x {
+  switch(x) {
+    case 23: {}
+  }
+}
+-(void)bonk:(int)x {
+  switch(x) {
+    case 42: {}
+  }
+}
+ at end





More information about the cfe-commits mailing list