Properly pop out of Objective-C method declarations when they are (ill-formedly)
found within contexts other than the translation unit.
llvm-svn: 110417
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index a1580f1..96839a5 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -343,8 +343,10 @@
return DC;
}
+ // ObjCMethodDecls are parsed (for some reason) outside the context
+ // of the class.
if (isa<ObjCMethodDecl>(DC))
- return Context.getTranslationUnitDecl();
+ return DC->getLexicalParent()->getLexicalParent();
return DC->getLexicalParent();
}