mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 17:36:05 +00:00
Add a workaround for decls that come from friend decls pointing to undeclared classes.
llvm-svn: 80438
This commit is contained in:
parent
6df9e076ea
commit
adf36b2379
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user