summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp3
-rw-r--r--clang/test/Analysis/NoReturn.m8
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
index d7a880c6604..0e1064ef53a 100644
--- a/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
@@ -64,6 +64,9 @@ void NoReturnFunctionChecker::checkPostCall(const CallEvent &CE,
.Case("assfail", true)
.Case("db_error", true)
.Case("__assert", true)
+ // For the purpose of static analysis, we do not care that
+ // this MSVC function will return if the user decides to continue.
+ .Case("_wassert", true)
.Case("__assert_rtn", true)
.Case("__assert_fail", true)
.Case("dtrace_assfail", true)
diff --git a/clang/test/Analysis/NoReturn.m b/clang/test/Analysis/NoReturn.m
index a58efdd0294..c74d54eae52 100644
--- a/clang/test/Analysis/NoReturn.m
+++ b/clang/test/Analysis/NoReturn.m
@@ -123,3 +123,11 @@ void PR11959(int *p) {
*p = 0xDEADBEEF; // no-warning
}
+// Test that hard-coded Microsoft _wassert name is recognized as a noreturn
+#define assert(_Expression) (void)( (!!(_Expression)) || (_wassert(#_Expression, __FILE__, __LINE__), 0) )
+extern void _wassert(const char * _Message, const char *_File, unsigned _Line);
+void test_wassert() {
+ assert(0);
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+}
OpenPOWER on IntegriCloud