Implemented access check for ivars accessed inside
c-style functions declared inside objc @implementations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66087 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 3637d14..1cbc0e7 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1082,12 +1082,15 @@
 Parser::DeclTy *Parser::ParseObjCAtEndDeclaration(SourceLocation atLoc) {
   assert(Tok.isObjCAtKeyword(tok::objc_end) &&
          "ParseObjCAtEndDeclaration(): Expected @end");
+  DeclTy *Result = ObjCImpDecl;
   ConsumeToken(); // the "end" identifier
-  if (ObjCImpDecl)
+  if (ObjCImpDecl) {
     Actions.ActOnAtEnd(atLoc, ObjCImpDecl);
+    ObjCImpDecl = 0;
+  }
   else
     Diag(atLoc, diag::warn_expected_implementation); // missing @implementation
-  return ObjCImpDecl;
+  return Result;
 }
 
 ///   compatibility-alias-decl: