[PATCH] D59650: [NFC] ExceptionEscapeCheck: small refactoring
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 22 06:28:18 PDT 2019
lebedev.ri updated this revision to Diff 191868.
lebedev.ri marked 3 inline comments as done.
lebedev.ri added a comment.
Address some nits.
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59650/new/
https://reviews.llvm.org/D59650
Files:
clang-tidy/utils/ExceptionAnalyzer.cpp
clang-tidy/utils/ExceptionAnalyzer.h
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59650.191868.patch
Type: text/x-patch
Size: 1828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190322/4b8c8fa1/attachment-0001.bin>
More information about the cfe-commits
mailing list