From 8e61b3e50ca81efa93da7a6df174db91101ff064 Mon Sep 17 00:00:00 2001 From: Erich Keane Date: Tue, 17 Oct 2017 20:57:24 +0000 Subject: [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 --- clang/lib/Sema/AnalysisBasedWarnings.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'clang/lib/Sema/AnalysisBasedWarnings.cpp') 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() ->getPointeeType() -- cgit v1.2.3