summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-09-28 00:13:36 +0000
committerSteve Naroff <snaroff@apple.com>2008-09-28 00:13:36 +0000
commitedec9ba58dd7f5bdbc9e9307801f9c39c94c44c1 (patch)
treeed541f76c754fc74f54915186272ef575ff391b5 /clang/lib/Sema/SemaExpr.cpp
parent843fe14fab94a093db9fc5c0fd409ddf00e30718 (diff)
downloadbcm5719-llvm-edec9ba58dd7f5bdbc9e9307801f9c39c94c44c1.tar.gz
bcm5719-llvm-edec9ba58dd7f5bdbc9e9307801f9c39c94c44c1.zip
Fix <rdar://problem/6252226> parser thinks block argument is undefined identifier in NSServices.m
llvm-svn: 56761
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e8b4d8cb4b3..dfa53ac4398 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -366,9 +366,14 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
}
// If we are parsing a block, check the block parameter list.
if (CurBlock) {
- for (unsigned i = 0, e = CurBlock->Params.size(); i != e; ++i)
- if (CurBlock->Params[i]->getIdentifier() == &II)
- D = CurBlock->Params[i];
+ BlockSemaInfo *BLK = CurBlock;
+ do {
+ for (unsigned i = 0, e = BLK->Params.size(); i != e && D == 0; ++i)
+ if (BLK->Params[i]->getIdentifier() == &II)
+ D = BLK->Params[i];
+ if (D)
+ break; // Found!
+ } while ((BLK = BLK->PrevBlockInfo)); // Look through any enclosing blocks.
}
if (D == 0) {
// Otherwise, this could be an implicitly declared function reference (legal
OpenPOWER on IntegriCloud