Objective-C: Fixes an ivar lookup bug where
'ivar' was used inside a record/union used
as argument to __typeof. // rdar14037151 pr5984
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183048 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index b7810da..c5f689f 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -824,6 +824,8 @@
ObjCMethodDecl *Sema::getCurMethodDecl() {
DeclContext *DC = getFunctionLevelDeclContext();
+ while (isa<RecordDecl>(DC))
+ DC = DC->getParent();
return dyn_cast<ObjCMethodDecl>(DC);
}