aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-08-08 17:48:49 +0000
committerAnders Carlsson <andersca@mac.com>2009-08-08 17:48:49 +0000
commitfb7ef75a28af7b6a7f666df2a5db53cf90d957b1 (patch)
tree293347783307d8920f8ca2a4b42195d5036f915a /lib/Sema/Sema.cpp
parent8517d9b731f065cdfc55ec0f3ddf5d564d988648 (diff)
getFunctionLevelDeclContext needs to get the previous DeclContext if EnterDeclaratorContext has been called. Fixes PR4694. (Doug, please review)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78480 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r--lib/Sema/Sema.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 0259a3d18d..b839e76969 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -310,7 +310,8 @@ void Sema::ActOnEndOfTranslationUnit() {
//===----------------------------------------------------------------------===//
DeclContext *Sema::getFunctionLevelDeclContext() {
- DeclContext *DC = CurContext;
+ DeclContext *DC = PreDeclaratorDC ? PreDeclaratorDC : CurContext;
+
while (isa<BlockDecl>(DC))
DC = DC->getParent();