This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE356799: [NFC] ExceptionEscapeCheck: small refactoring
(authored by lebedevri, committed by ).
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
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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits