summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/TaintManager.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-10-20 00:29:24 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-10-20 00:29:24 +0000
commit25dac79edf0c7b8c8481ce358c074352c7289006 (patch)
tree13541c314e8bce2393463f2ab2db2e26ad7503a3 /clang/lib/StaticAnalyzer/Core/TaintManager.cpp
parent8d6ff4c0af843e1a61b76d89812aed91e358de34 (diff)
downloadbcm5719-llvm-25dac79edf0c7b8c8481ce358c074352c7289006.tar.gz
bcm5719-llvm-25dac79edf0c7b8c8481ce358c074352c7289006.zip
[analyzer] Be more plugin-friendly by moving static locals into .cpp files.
The GDMIndex functions return a pointer that's used as a key for looking up data, but addresses of local statics defined in header files aren't the same across shared library boundaries and the result is that analyzer plugins can't access this data. Event types are uniqued by using the addresses of a local static defined in a header files, but it isn't the same across shared library boundaries and plugins can't currently handle ImplicitNullDerefEvents. Patches by Joe Ranieri! Differential Revision: https://reviews.llvm.org/D52905 Differential Revision: https://reviews.llvm.org/D52906 llvm-svn: 344823
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/TaintManager.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/TaintManager.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/TaintManager.cpp b/clang/lib/StaticAnalyzer/Core/TaintManager.cpp
new file mode 100644
index 00000000000..c34b0ca1839
--- /dev/null
+++ b/clang/lib/StaticAnalyzer/Core/TaintManager.cpp
@@ -0,0 +1,23 @@
+//== TaintManager.cpp ------------------------------------------ -*- C++ -*--=//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h"
+
+using namespace clang;
+using namespace ento;
+
+void *ProgramStateTrait<TaintMap>::GDMIndex() {
+ static int index = 0;
+ return &index;
+}
+
+void *ProgramStateTrait<DerivedSymTaint>::GDMIndex() {
+ static int index;
+ return &index;
+}
OpenPOWER on IntegriCloud