From b94ed614522c7d1ccf4aecb6bd89cdfecee2ceeb Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 16 Mar 2016 14:36:11 +0000 Subject: Fix destructor definition of invalid classes The declaration of the destructor of an invalid class was not properly marked as noexcept. As a result, the definition of the same destructor, which was properly implicitly marked as noexcept, would not match the definition. This would cause the definition CXXDestructorDecl to be matked as invalid and omited from the AST. Differential Revision: http://reviews.llvm.org/D17988 llvm-svn: 263639 --- clang/lib/Sema/SemaDecl.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'clang/lib/Sema/SemaDecl.cpp') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 6032e0cea00..d8740d2beb1 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -13862,15 +13862,17 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl, I = CXXRecord->conversion_begin(), E = CXXRecord->conversion_end(); I != E; ++I) I.setAccess((*I)->getAccess()); - - if (!CXXRecord->isDependentType()) { - if (CXXRecord->hasUserDeclaredDestructor()) { - // Adjust user-defined destructor exception spec. - if (getLangOpts().CPlusPlus11) - AdjustDestructorExceptionSpec(CXXRecord, - CXXRecord->getDestructor()); - } + } + + if (!CXXRecord->isDependentType()) { + if (CXXRecord->hasUserDeclaredDestructor()) { + // Adjust user-defined destructor exception spec. + if (getLangOpts().CPlusPlus11) + AdjustDestructorExceptionSpec(CXXRecord, + CXXRecord->getDestructor()); + } + if (!CXXRecord->isInvalidDecl()) { // Add any implicitly-declared members to this class. AddImplicitlyDeclaredMembersToClass(CXXRecord); -- cgit v1.2.3