[PATCH] D15810: [analyzer] Handle another Android assert function.

Yury Gribov via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 29 10:01:16 PST 2015


ygribov updated this revision to Diff 43742.
ygribov added a comment.
Herald added a subscriber: srhines.

Added a test.


Repository:
  rL LLVM

http://reviews.llvm.org/D15810

Files:
  lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
  test/Analysis/NoReturn.m

Index: test/Analysis/NoReturn.m
===================================================================
--- test/Analysis/NoReturn.m
+++ 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: lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
+++ 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.43742.patch
Type: text/x-patch
Size: 1269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151229/5ebdca90/attachment.bin>


More information about the llvm-commits mailing list