[cfe-commits] r102776 - in /cfe/trunk/lib: AST/ASTContext.cpp CodeGen/CGBlocks.cpp

John McCall rjmccall at apple.com
Fri Apr 30 14:35:41 PDT 2010


Author: rjmccall
Date: Fri Apr 30 16:35:41 2010
New Revision: 102776

URL: http://llvm.org/viewvc/llvm-project?rev=102776&view=rev
Log:
When synthesizing Objective C records, give the synthetic fields public
access.  Fixes an assertion.

Fixes rdar://problem/7927811.  Too lazy to reduce a test case.


Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/lib/CodeGen/CGBlocks.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=102776&r1=102775&r2=102776&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Apr 30 16:35:41 2010
@@ -2833,6 +2833,7 @@
                                            FieldTypes[i], /*TInfo=*/0,
                                            /*BitWidth=*/0,
                                            /*Mutable=*/false);
+      Field->setAccess(AS_public);
       CFConstantStringTypeDecl->addDecl(Field);
     }
 
@@ -2872,6 +2873,7 @@
                                            FieldTypes[i], /*TInfo=*/0,
                                            /*BitWidth=*/0,
                                            /*Mutable=*/false);
+      Field->setAccess(AS_public);
       NSConstantStringTypeDecl->addDecl(Field);
     }
     
@@ -2909,6 +2911,7 @@
                                            FieldTypes[i], /*TInfo=*/0,
                                            /*BitWidth=*/0,
                                            /*Mutable=*/false);
+      Field->setAccess(AS_public);
       ObjCFastEnumerationStateTypeDecl->addDecl(Field);
     }
 
@@ -2946,6 +2949,7 @@
                                          FieldTypes[i], /*TInfo=*/0,
                                          /*BitWidth=*/0,
                                          /*Mutable=*/false);
+    Field->setAccess(AS_public);
     T->addDecl(Field);
   }
 
@@ -2994,6 +2998,7 @@
                                          FieldTypes[i], /*TInfo=*/0,
                                          /*BitWidth=*/0,
                                          /*Mutable=*/false);
+    Field->setAccess(AS_public);
     T->addDecl(Field);
   }
 
@@ -3071,6 +3076,7 @@
                                          &Idents.get(FieldNames[i]),
                                          FieldTypes[i], /*TInfo=*/0,
                                          /*BitWidth=*/0, /*Mutable=*/false);
+    Field->setAccess(AS_public);
     T->addDecl(Field);
   }
 
@@ -3115,6 +3121,7 @@
                                          &Idents.get(FieldNames[i]),
                                          FieldTypes[i], /*TInfo=*/0,
                                          /*BitWidth=*/0, /*Mutable=*/false);
+    Field->setAccess(AS_public);
     T->addDecl(Field);
   }
 
@@ -3135,6 +3142,7 @@
     FieldDecl *Field = FieldDecl::Create(*this, T, SourceLocation(),
                                          Name, FieldType, /*TInfo=*/0,
                                          /*BitWidth=*/0, /*Mutable=*/false);
+    Field->setAccess(AS_public);
     T->addDecl(Field);
   }
 

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=102776&r1=102775&r2=102776&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Fri Apr 30 16:35:41 2010
@@ -706,7 +706,7 @@
                                                   BlockDeclRefDecls);
   // FIXME: This leaks
   ImplicitParamDecl *SelfDecl =
-    ImplicitParamDecl::Create(getContext(), 0,
+    ImplicitParamDecl::Create(getContext(), const_cast<BlockDecl*>(BD),
                               SourceLocation(), II,
                               ParmTy);
 





More information about the cfe-commits mailing list