summaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaExceptionSpec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r--clang/lib/Sema/SemaExceptionSpec.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp
index ecfd79a50542..ac3666394d0e 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/lib/Sema/SemaExceptionSpec.cpp
@@ -1205,15 +1205,16 @@ CanThrowResult Sema::canThrow(const Stmt *S) {
if (DTy.isNull() || DTy->isDependentType()) {
CT = CT_Dependent;
} else {
- CT = canCalleeThrow(*this, DE, DE->getOperatorDelete());
- if (const RecordType *RT = DTy->getAs<RecordType>()) {
- const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
- const CXXDestructorDecl *DD = RD->getDestructor();
- if (DD)
- CT = mergeCanThrow(CT, canCalleeThrow(*this, DE, DD));
+ const FunctionDecl *OperatorDelete = DE->getOperatorDelete();
+ CT = canCalleeThrow(*this, DE, OperatorDelete);
+ if (!OperatorDelete->isDestroyingOperatorDelete()) {
+ if (const auto *RD = DTy->getAsCXXRecordDecl()) {
+ if (const CXXDestructorDecl *DD = RD->getDestructor())
+ CT = mergeCanThrow(CT, canCalleeThrow(*this, DE, DD));
+ }
+ if (CT == CT_Can)
+ return CT;
}
- if (CT == CT_Can)
- return CT;
}
return mergeCanThrow(CT, canSubStmtsThrow(*this, DE));
}
@@ -1395,6 +1396,11 @@ CanThrowResult Sema::canThrow(const Stmt *S) {
case Expr::ConceptSpecializationExprClass:
case Expr::RequiresExprClass:
case Expr::HLSLOutArgExprClass:
+ case Stmt::OpenACCEnterDataConstructClass:
+ case Stmt::OpenACCExitDataConstructClass:
+ case Stmt::OpenACCWaitConstructClass:
+ case Stmt::OpenACCInitConstructClass:
+ case Stmt::OpenACCShutdownConstructClass:
// These expressions can never throw.
return CT_Cannot;
@@ -1406,6 +1412,8 @@ CanThrowResult Sema::canThrow(const Stmt *S) {
case Stmt::OpenACCComputeConstructClass:
case Stmt::OpenACCLoopConstructClass:
case Stmt::OpenACCCombinedConstructClass:
+ case Stmt::OpenACCDataConstructClass:
+ case Stmt::OpenACCHostDataConstructClass:
case Stmt::AttributedStmtClass:
case Stmt::BreakStmtClass:
case Stmt::CapturedStmtClass: