aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/Sema.h
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-09-02 01:07:03 +0000
committerJohn McCall <rjmccall@apple.com>2009-09-02 01:07:03 +0000
commit1a26c27eba32f8766c0eeec73fe43634cd814825 (patch)
treef39b6acf83d50ef8e4933585ecf009e1f026920b /lib/Sema/Sema.h
parent9124bccde8e4b3531474b108d74720feac898d75 (diff)
Fix a little crasher in friend decls. Thanks again to Eli for finding this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80748 91177308-0d34-0410-b5e6-96231b3b80d8
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;