Index: clang-tidy/utils/ExceptionAnalyzer.h =================================================================== --- clang-tidy/utils/ExceptionAnalyzer.h +++ clang-tidy/utils/ExceptionAnalyzer.h @@ -138,10 +138,15 @@ throwsException(const Stmt *St, const ExceptionInfo::Throwables &Caught, llvm::SmallSet &CallStack); + ExceptionInfo analyzeImpl(const FunctionDecl *Func); + + template ExceptionInfo analyzeDispatch(const T *Node); + bool IgnoreBadAlloc = true; llvm::StringSet<> IgnoredExceptions; std::map FunctionCache; }; + } // namespace utils } // namespace tidy } // namespace clang Index: clang-tidy/utils/ExceptionAnalyzer.cpp =================================================================== --- clang-tidy/utils/ExceptionAnalyzer.cpp +++ clang-tidy/utils/ExceptionAnalyzer.cpp @@ -205,7 +205,7 @@ } ExceptionAnalyzer::ExceptionInfo -ExceptionAnalyzer::analyze(const FunctionDecl *Func) { +ExceptionAnalyzer::analyzeImpl(const FunctionDecl *Func) { ExceptionInfo ExceptionList; // Check if the function has already been analyzed and reuse that result. @@ -221,6 +221,14 @@ } else ExceptionList = FunctionCache[Func]; + return ExceptionList; +} + +template +ExceptionAnalyzer::ExceptionInfo +ExceptionAnalyzer::analyzeDispatch(const T *Node) { + ExceptionInfo ExceptionList = analyzeImpl(Node); + if (ExceptionList.getBehaviour() == State::NotThrowing || ExceptionList.getBehaviour() == State::Unknown) return ExceptionList; @@ -231,6 +239,12 @@ return ExceptionList; } + +ExceptionAnalyzer::ExceptionInfo +ExceptionAnalyzer::analyze(const FunctionDecl *Func) { + return analyzeDispatch(Func); +} + } // namespace utils } // namespace tidy