aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-06 00:46:05 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-06 00:46:05 +0000
commit9983d2d76c8107672b5907124266f482ba03823f (patch)
tree190198b65dfa9ddd33f67830a5f7969f1498e3e2 /lib/Sema/SemaDecl.cpp
parentf65339e0f1b9ccfc0c92c85f68bb2e72ea48a27b (diff)
Properly pop out of Objective-C method declarations when they are (ill-formedly)
found within contexts other than the translation unit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index a1580f14dc..96839a5421 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -343,8 +343,10 @@ DeclContext *Sema::getContainingDC(DeclContext *DC) {
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();
}