Handle redeclarations of catch variables in catch blocks.
Fix to regression caused by r167650, caught by Richard Smith in code review.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167653 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp
index 50413c3..0093915 100644
--- a/lib/Sema/IdentifierResolver.cpp
+++ b/lib/Sema/IdentifierResolver.cpp
@@ -138,8 +138,11 @@
if (S->getFlags() & Scope::FnTryScope)
return S->getParent()->isDeclScope(D);
if (S->getParent()->getFlags() & Scope::ControlScope) {
- if (S->getParent()->getFlags() & Scope::FnCatchScope)
+ if (S->getParent()->getFlags() & Scope::FnCatchScope) {
S = S->getParent();
+ if (S->isDeclScope(D))
+ return true;
+ }
return S->getParent()->isDeclScope(D);
}
}