diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-08-29 20:47:47 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-08-29 20:47:47 +0000 |
| commit | adf36b237996270221b43fcabdabe3dbe87330fd (patch) | |
| tree | be8e7c1790f05dcdbd0a61d59cd297572c2396ca /clang/lib/AST | |
| parent | 6df9e076ea410d49d73e967b577a40ed50b454e2 (diff) | |
| download | bcm5719-llvm-adf36b237996270221b43fcabdabe3dbe87330fd.tar.gz bcm5719-llvm-adf36b237996270221b43fcabdabe3dbe87330fd.zip | |
Add a workaround for decls that come from friend decls pointing to undeclared classes.
llvm-svn: 80438
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/DeclBase.cpp | 14 | ||||
| -rw-r--r-- | clang/lib/AST/DeclPrinter.cpp | 5 |
2 files changed, 16 insertions, 3 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 3ced0eff4c5..3a010b0cdf5 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -379,8 +379,18 @@ SourceLocation Decl::getBodyRBrace() const { #ifndef NDEBUG void Decl::CheckAccessDeclContext() const { - assert((Access != AS_none || isa<TranslationUnitDecl>(this) || - !isa<CXXRecordDecl>(getDeclContext())) && + // If the decl is the toplevel translation unit or if we're not in a + // record decl context, we don't need to check anything. + if (isa<TranslationUnitDecl>(this) || + !isa<CXXRecordDecl>(getDeclContext())) + return; + + // FIXME: This check should not be necessary - If a friend decl refers to an + // undeclared decl, then that decl shouldn't be in any decl context. + if (getFriendObjectKind() == FOK_Undeclared) + return; + + assert(Access != AS_none && "Access specifier is AS_none inside a record decl"); } diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index 191d356755f..275f2db82b5 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -202,7 +202,10 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) { if (PrintAccess) { AccessSpecifier AS = D->getAccess(); - if (AS != CurAS) { + + if (AS != CurAS && + // FIXME: This check shouldn't be necessary. + D->getFriendObjectKind() == Decl::FOK_Undeclared) { Print(AS); Out << ":\n"; CurAS = AS; |

