diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2010-02-25 09:32:59 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2010-02-25 09:32:59 +0000 |
commit | b306bcc266a7ee2313b12f8d78af7c03b76dba7a (patch) | |
tree | 634ad5d6bff99f21f156ec0a0f995eb8f5dbeca2 /clang/lib/Sema/SemaDecl.cpp | |
parent | 0076d94466748209a5b2b81b9b732b1eb309d8db (diff) | |
download | bcm5719-llvm-b306bcc266a7ee2313b12f8d78af7c03b76dba7a.tar.gz bcm5719-llvm-b306bcc266a7ee2313b12f8d78af7c03b76dba7a.zip |
Fix a really trivial crasher and begin fleshing out one of the namespace test
cases.
llvm-svn: 97134
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 27eb2510ec5..47c787b0c42 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -4778,12 +4778,15 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // If a friend declaration in a non-local class first declares a // class or function, the friend class or function is a member of // the innermost enclosing namespace. - while (!SearchDC->isFileContext()) - SearchDC = SearchDC->getParent(); + SearchDC = SearchDC->getEnclosingNamespaceContext(); - // The entity of a decl scope is a DeclContext; see PushDeclContext. - while (S->getEntity() != SearchDC) + // Look up through our scopes until we find one with an entity which + // matches our declaration context. + while (S->getEntity() && + ((DeclContext *)S->getEntity())->getPrimaryContext() != SearchDC) { S = S->getParent(); + assert(S && "No enclosing scope matching the enclosing namespace."); + } } CreateNewDecl: |