diff options
author | Erich Keane <erich.keane@intel.com> | 2017-10-17 20:57:24 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2017-10-17 20:57:24 +0000 |
commit | 8e61b3e50ca81efa93da7a6df174db91101ff064 (patch) | |
tree | f6605d38b3f100847f75cad919a349e25d430c15 /clang/lib/Sema/AnalysisBasedWarnings.cpp | |
parent | e38a984474650e7fca38b2b68508a85ae1dcd25e (diff) | |
download | bcm5719-llvm-8e61b3e50ca81efa93da7a6df174db91101ff064.tar.gz bcm5719-llvm-8e61b3e50ca81efa93da7a6df174db91101ff064.zip |
[CFG] Relax Wexceptions warning on rethrow
As reported here: https://bugs.llvm.org/show_bug.cgi?id=34973
"catch(...)" should catch EVERYTHING, even a rethrow. This
patch changes the order in which things are checked to ensure
that a '...' catch will get a rethrow.
Differential Revision: https://reviews.llvm.org/D39013
llvm-svn: 316030
Diffstat (limited to 'clang/lib/Sema/AnalysisBasedWarnings.cpp')
-rw-r--r-- | clang/lib/Sema/AnalysisBasedWarnings.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index bdfed6ead10..7a31711e727 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -289,14 +289,14 @@ enum ThrowState { static bool isThrowCaught(const CXXThrowExpr *Throw, const CXXCatchStmt *Catch) { + const Type *CaughtType = Catch->getCaughtType().getTypePtrOrNull(); + if (!CaughtType) + return true; const Type *ThrowType = nullptr; if (Throw->getSubExpr()) ThrowType = Throw->getSubExpr()->getType().getTypePtrOrNull(); if (!ThrowType) return false; - const Type *CaughtType = Catch->getCaughtType().getTypePtrOrNull(); - if (!CaughtType) - return true; if (ThrowType->isReferenceType()) ThrowType = ThrowType->castAs<ReferenceType>() ->getPointeeType() |