From 2f8e6b87effdff1db310b362d48ca949dc41a8fd Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Thu, 25 Sep 2014 20:55:00 +0000 Subject: Move calls to ResolveExceptionSpec out of SetDeclDefaulted and into DefineImplicit* This fixes an assertion failure in CodeGen where we were not resolving an exception specification. llvm-svn: 218466 --- clang/lib/Sema/SemaDeclCXX.cpp | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'clang/lib/Sema/SemaDeclCXX.cpp') diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index bf53ae38ddb..acf7f2ac960 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -8583,6 +8583,11 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, return; } + // The exception specification is needed because we are defining the + // function. + ResolveExceptionSpec(CurrentLocation, + Constructor->getType()->castAs()); + SourceLocation Loc = Constructor->getLocEnd().isValid() ? Constructor->getLocEnd() : Constructor->getLocation(); @@ -9047,6 +9052,11 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation, return; } + // The exception specification is needed because we are defining the + // function. + ResolveExceptionSpec(CurrentLocation, + Destructor->getType()->castAs()); + SourceLocation Loc = Destructor->getLocEnd().isValid() ? Destructor->getLocEnd() : Destructor->getLocation(); @@ -9890,6 +9900,11 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, } } + // The exception specification is needed because we are defining the + // function. + ResolveExceptionSpec(CurrentLocation, + CopyAssignOperator->getType()->castAs()); + if (Invalid) { CopyAssignOperator->setInvalidDecl(); return; @@ -10312,6 +10327,11 @@ void Sema::DefineImplicitMoveAssignment(SourceLocation CurrentLocation, } } + // The exception specification is needed because we are defining the + // function. + ResolveExceptionSpec(CurrentLocation, + MoveAssignOperator->getType()->castAs()); + if (Invalid) { MoveAssignOperator->setInvalidDecl(); return; @@ -10481,6 +10501,11 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation, ActOnCompoundStmt(Loc, Loc, None, /*isStmtExpr=*/false).getAs()); } + // The exception specification is needed because we are defining the + // function. + ResolveExceptionSpec(CurrentLocation, + CopyConstructor->getType()->castAs()); + CopyConstructor->markUsed(Context); MarkVTableUsed(CurrentLocation, ClassDecl); @@ -10641,6 +10666,11 @@ void Sema::DefineImplicitMoveConstructor(SourceLocation CurrentLocation, Loc, Loc, None, /*isStmtExpr=*/ false).getAs()); } + // The exception specification is needed because we are defining the + // function. + ResolveExceptionSpec(CurrentLocation, + MoveConstructor->getType()->castAs()); + MoveConstructor->markUsed(Context); MarkVTableUsed(CurrentLocation, ClassDecl); @@ -12314,11 +12344,6 @@ void Sema::SetDeclDefaulted(Decl *Dcl, SourceLocation DefaultLoc) { CheckExplicitlyDefaultedSpecialMember(MD); - // The exception specification is needed because we are defining the - // function. - ResolveExceptionSpec(DefaultLoc, - MD->getType()->castAs()); - if (MD->isInvalidDecl()) return; -- cgit v1.2.3