summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-06-19 23:33:39 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2019-06-19 23:33:39 +0000
commit3707b05211f90f2d3b8f31d15b59e8f6c12f3b8b (patch)
tree88bf92b33caa3971b8320432a804b6a5c025e8db /clang/test
parentb03854f8e87e89051da5eae6c267020801fb39a0 (diff)
downloadbcm5719-llvm-3707b05211f90f2d3b8f31d15b59e8f6c12f3b8b.tar.gz
bcm5719-llvm-3707b05211f90f2d3b8f31d15b59e8f6c12f3b8b.zip
[analyzer] DeadStores: Add a crude suppression files generated by DriverKit IIG.
IIG is a replacement for MIG in DriverKit: IIG is autogenerating C++ code. Suppress dead store warnings on such code, as the tool seems to be producing them regularly, and the users of IIG are not in position to address these warnings, as they don't control the autogenerated code. IIG-generated code is identified by looking at the comments at the top of the file. Differential Revision: https://reviews.llvm.org/D63118 llvm-svn: 363892
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/deadstores-driverkit.cpp24
-rw-r--r--clang/test/Analysis/os_object_base.h8
2 files changed, 32 insertions, 0 deletions
diff --git a/clang/test/Analysis/deadstores-driverkit.cpp b/clang/test/Analysis/deadstores-driverkit.cpp
new file mode 100644
index 00000000000..446821b32ca
--- /dev/null
+++ b/clang/test/Analysis/deadstores-driverkit.cpp
@@ -0,0 +1,24 @@
+/* iig generated from SomethingSomething.iig */
+
+// The comment above is the whole point of the test.
+// That's how the suppression works.
+// It needs to be on the top.
+// Run-lines can wait.
+
+// RUN: %clang_analyze_cc1 -w -triple x86_64-apple-driverkit19.0 \
+// RUN: -analyzer-checker=deadcode -verify %s
+
+// expected-no-diagnostics
+
+#include "os_object_base.h"
+
+class OSSomething {
+ kern_return_t Invoke(const IORPC);
+ void foo(OSDispatchMethod supermethod) {
+ kern_return_t ret;
+ IORPC rpc;
+ // Test the DriverKit specific suppression in the dead stores checker.
+ if (supermethod) ret = supermethod((OSObject *)this, rpc); // no-warning
+ else ret = ((OSObject *)this)->Invoke(rpc); // no-warning
+ }
+};
diff --git a/clang/test/Analysis/os_object_base.h b/clang/test/Analysis/os_object_base.h
index 37a3fc07df7..4698185f2b3 100644
--- a/clang/test/Analysis/os_object_base.h
+++ b/clang/test/Analysis/os_object_base.h
@@ -19,6 +19,9 @@
using size_t = decltype(sizeof(int));
+typedef int kern_return_t;
+struct IORPC {};
+
struct OSMetaClass;
struct OSMetaClassBase {
@@ -37,8 +40,13 @@ struct OSMetaClassBase {
virtual void free();
virtual ~OSMetaClassBase(){};
+
+ kern_return_t Invoke(IORPC invoke);
};
+typedef kern_return_t (*OSDispatchMethod)(OSMetaClassBase *self,
+ const IORPC rpc);
+
struct OSObject : public OSMetaClassBase {
virtual ~OSObject(){}
OpenPOWER on IntegriCloud