aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/Sema.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/Sema.h')
-rw-r--r--lib/Sema/Sema.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 63d2831fab..e2205d6df5 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -715,10 +715,11 @@ public:
/// Finds the scope corresponding to the given decl context, if it
/// happens to be an enclosing scope. Otherwise return NULL.
Scope *getScopeForDeclContext(Scope *S, DeclContext *DC) {
- DC = DC->getPrimaryContext();
+ DeclContext *TargetDC = DC->getPrimaryContext();
do {
- if (((DeclContext*) S->getEntity())->getPrimaryContext() == DC)
- return S;
+ if (DeclContext *ScopeDC = (DeclContext*) S->getEntity())
+ if (ScopeDC->getPrimaryContext() == TargetDC)
+ return S;
} while ((S = S->getParent()));
return NULL;