Page MenuHomePhabricator

D59650.diff
No OneTemporary

File Metadata

Created
Mon, Dec 9, 9:21 PM

D59650.diff

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<const FunctionDecl *, 32> &CallStack);
+ ExceptionInfo analyzeImpl(const FunctionDecl *Func);
+
+ template <typename T> ExceptionInfo analyzeDispatch(const T *Node);
+
bool IgnoreBadAlloc = true;
llvm::StringSet<> IgnoredExceptions;
std::map<const FunctionDecl *, ExceptionInfo> 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 <typename T>
+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

Event Timeline