summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/diagnostics/explicit-suppression.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-04-02 00:26:15 +0000
committerJordan Rose <jordan_rose@apple.com>2013-04-02 00:26:15 +0000
commitd11ef1aaf784bdb1830ecfb8808937cc17cef32c (patch)
treede5ad496db91ce654eab4296f56352cef3e708cb /clang/test/Analysis/diagnostics/explicit-suppression.cpp
parent24eea5d003e73e46e2259b8630e8105b8d67c901 (diff)
downloadbcm5719-llvm-d11ef1aaf784bdb1830ecfb8808937cc17cef32c.tar.gz
bcm5719-llvm-d11ef1aaf784bdb1830ecfb8808937cc17cef32c.zip
[analyzer] Allow suppressing diagnostics reported within the 'std' namespace
This is controlled by the 'suppress-c++-stdlib' analyzer-config flag. It is currently off by default. This is more suppression than we'd like to do, since obviously there can be user-caused issues within 'std', but it gives us the option to wield a large hammer to suppress false positives the user likely can't work around. llvm-svn: 178513
Diffstat (limited to 'clang/test/Analysis/diagnostics/explicit-suppression.cpp')
-rw-r--r--clang/test/Analysis/diagnostics/explicit-suppression.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/clang/test/Analysis/diagnostics/explicit-suppression.cpp b/clang/test/Analysis/diagnostics/explicit-suppression.cpp
new file mode 100644
index 00000000000..6bc950f5d50
--- /dev/null
+++ b/clang/test/Analysis/diagnostics/explicit-suppression.cpp
@@ -0,0 +1,71 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config suppress-c++-stdlib=false -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config suppress-c++-stdlib=true -DSUPPRESSED=1 -verify %s
+
+#ifdef SUPPRESSED
+// expected-no-diagnostics
+#endif
+
+#include "../Inputs/system-header-simulator-cxx.h"
+
+void clang_analyzer_eval(bool);
+
+void testCopyNull(int *I, int *E) {
+ std::copy(I, E, (int *)0);
+#ifndef SUPPRESSED
+ // This line number comes from system-header-simulator-cxx.h.
+ // expected-warning@65 {{Dereference of null pointer}}
+#endif
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// PR15613: expected-* can't refer to diagnostics in other source files.
+// The current implementation only matches line numbers, but has an upper limit
+// of the number of lines in the main source file.
OpenPOWER on IntegriCloud