diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2013-06-25 01:24:22 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2013-06-25 01:24:22 +0000 |
commit | 0423b76be13eeca6663d278a636e1cb963da3091 (patch) | |
tree | 4eee3f92eeae28aaf930ca406d11337ce71564ae /clang/lib/Sema/SemaExceptionSpec.cpp | |
parent | 36c17ee5a16ea66f048beaea6ba351708a1a218b (diff) | |
download | bcm5719-llvm-0423b76be13eeca6663d278a636e1cb963da3091.tar.gz bcm5719-llvm-0423b76be13eeca6663d278a636e1cb963da3091.zip |
Fix noexcept for delete expressions.
Using "delete" on a pointer to an incomplete type can't throw.
While I'm here, clean up the signature of the canCalleeThrow() helper.
llvm-svn: 184810
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index dfdf5ec25f5..836385d031f 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -790,11 +790,8 @@ static CanThrowResult canSubExprsThrow(Sema &S, const Expr *CE) { return R; } -static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, - const Decl *D, - bool NullThrows = true) { - if (!D) - return NullThrows ? CT_Can : CT_Cannot; +static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D) { + assert(D && "Expected decl"); // See if we can get a function type from the decl somehow. const ValueDecl *VD = dyn_cast<ValueDecl>(D); @@ -945,7 +942,9 @@ CanThrowResult Sema::canThrow(const Expr *E) { cast<CXXDeleteExpr>(E)->getOperatorDelete()); if (const RecordType *RT = DTy->getAs<RecordType>()) { const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl()); - CT = mergeCanThrow(CT, canCalleeThrow(*this, E, RD->getDestructor())); + const CXXDestructorDecl *DD = RD->getDestructor(); + if (DD) + CT = mergeCanThrow(CT, canCalleeThrow(*this, E, DD)); } if (CT == CT_Can) return CT; |