[PATCH] D15810: [analyzer] Handle another Android assert function.
Devin Coughlin via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 29 16:12:32 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL256605: [analyzer] Handle another Android assert function. (authored by dcoughlin).
Changed prior to commit:
http://reviews.llvm.org/D15810?vs=43742&id=43770#toc
Repository:
rL LLVM
http://reviews.llvm.org/D15810
Files:
cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
cfe/trunk/test/Analysis/NoReturn.m
Index: cfe/trunk/test/Analysis/NoReturn.m
===================================================================
--- cfe/trunk/test/Analysis/NoReturn.m
+++ cfe/trunk/test/Analysis/NoReturn.m
@@ -131,3 +131,15 @@
int *p = 0;
*p = 0xDEADBEEF; // no-warning
}
+#undef assert
+
+// Test that hard-coded Android __assert2 name is recognized as a noreturn
+#define assert(_Expression) ((_Expression) ? (void)0 : __assert2(0, 0, 0, 0));
+extern void __assert2(const char *, int, const char *, const char *);
+extern void _wassert(const char * _Message, const char *_File, unsigned _Line);
+void test___assert2() {
+ assert(0);
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+}
+#undef assert
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
@@ -66,6 +66,7 @@
.Case("assfail", true)
.Case("db_error", true)
.Case("__assert", true)
+ .Case("__assert2", 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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15810.43770.patch
Type: text/x-patch
Size: 1329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151230/af296944/attachment.bin>
More information about the llvm-commits
mailing list