Implement instance variable references.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44016 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index fe96bea..124eb14 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -82,6 +82,12 @@
         !getLangOptions().CPlusPlus)
       D = ImplicitlyDefineFunction(Loc, II, S);
     else {
+      if (CurMethodDecl) {
+        ObjcInterfaceDecl *IFace = CurMethodDecl->getClassInterface();
+        ObjcInterfaceDecl *clsDeclared;
+        if (ObjcIvarDecl *IV = IFace->lookupInstanceVariable(&II, clsDeclared))
+          return new ObjCIvarRefExpr(IV, IV->getType(), Loc);
+      }
       // If this name wasn't predeclared and if this is not a function call,
       // diagnose the problem.
       return Diag(Loc, diag::err_undeclared_var_use, II.getName());