diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Analysis/diagnostics/diag-cross-file-boundaries.c | 12 | ||||
-rw-r--r-- | clang/test/Analysis/html-diag-singlefile.c | 14 | ||||
-rw-r--r-- | clang/test/Analysis/html-diag-singlefile.h (renamed from clang/test/Analysis/diagnostics/diag-cross-file-boundaries.h) | 0 | ||||
-rw-r--r-- | clang/test/Analysis/html-diags-analyze-headers.c | 10 | ||||
-rw-r--r-- | clang/test/Analysis/html-diags-analyze-headers.h | 5 | ||||
-rw-r--r-- | clang/test/Analysis/html-diags-multifile.c | 5 | ||||
-rw-r--r-- | clang/test/Analysis/html-diags.c | 6 | ||||
-rw-r--r-- | clang/test/Coverage/html-diagnostics.c | 7 | ||||
-rw-r--r-- | clang/test/Coverage/html-multifile-diagnostics.c | 21 | ||||
-rw-r--r-- | clang/test/Coverage/html-multifile-diagnostics.h | 3 |
10 files changed, 68 insertions, 15 deletions
diff --git a/clang/test/Analysis/diagnostics/diag-cross-file-boundaries.c b/clang/test/Analysis/diagnostics/diag-cross-file-boundaries.c deleted file mode 100644 index b975af3fb29..00000000000 --- a/clang/test/Analysis/diagnostics/diag-cross-file-boundaries.c +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s -// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=html -o PR12421.html %s 2>&1 | FileCheck %s - -// Test for PR12421 -#include "diag-cross-file-boundaries.h" - -int main(){ - f(); - return 0; -} - -// CHECK: warning: Path diagnostic report is not generated. diff --git a/clang/test/Analysis/html-diag-singlefile.c b/clang/test/Analysis/html-diag-singlefile.c new file mode 100644 index 00000000000..fc0dcc7a423 --- /dev/null +++ b/clang/test/Analysis/html-diag-singlefile.c @@ -0,0 +1,14 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=html-single-file -o D30406.html %s 2>&1 | FileCheck %s + +// Check that single file HTML output does not process multi-file diagnostics. +// (This used to test for PR12421, before the introduction of the html-single-file format) + +#include "html-diag-singlefile.h" + +int main(){ + f(); + return 0; +} + +// CHECK: warning: Path diagnostic report is not generated. diff --git a/clang/test/Analysis/diagnostics/diag-cross-file-boundaries.h b/clang/test/Analysis/html-diag-singlefile.h index 1af7d1f1fbb..1af7d1f1fbb 100644 --- a/clang/test/Analysis/diagnostics/diag-cross-file-boundaries.h +++ b/clang/test/Analysis/html-diag-singlefile.h diff --git a/clang/test/Analysis/html-diags-analyze-headers.c b/clang/test/Analysis/html-diags-analyze-headers.c new file mode 100644 index 00000000000..fa5f21de047 --- /dev/null +++ b/clang/test/Analysis/html-diags-analyze-headers.c @@ -0,0 +1,10 @@ +// RUN: mkdir -p %t.dir +// RUN: %clang_analyze_cc1 -analyzer-opt-analyze-headers -analyzer-output=html -analyzer-checker=core -o %t.dir %s +// RUN: ls %t.dir | grep report +// RUN: rm -rf %t.dir + +// This tests that we emit HTML diagnostics for reports in headers when the +// analyzer is run with -analyzer-opt-analyze-headers. This was handled +// incorrectly in the first iteration of D30406. + +#include "html-diags-analyze-headers.h" diff --git a/clang/test/Analysis/html-diags-analyze-headers.h b/clang/test/Analysis/html-diags-analyze-headers.h new file mode 100644 index 00000000000..3641ca9c040 --- /dev/null +++ b/clang/test/Analysis/html-diags-analyze-headers.h @@ -0,0 +1,5 @@ +#include "html-diags-multifile.h" + +void test_call_macro() { + has_bug(0); +} diff --git a/clang/test/Analysis/html-diags-multifile.c b/clang/test/Analysis/html-diags-multifile.c index ce1f72b6bb1..ff7b625ad08 100644 --- a/clang/test/Analysis/html-diags-multifile.c +++ b/clang/test/Analysis/html-diags-multifile.c @@ -1,10 +1,9 @@ // RUN: mkdir -p %t.dir // RUN: %clang_analyze_cc1 -analyzer-output=html -analyzer-checker=core -o %t.dir %s -// RUN: ls %t.dir | not grep report +// RUN: ls %t.dir | grep report // RUN: rm -fR %t.dir -// This tests that we do not currently emit HTML diagnostics for reports that -// cross file boundaries. +// This tests that we emit HTML diagnostics for reports that cross file boundaries. #include "html-diags-multifile.h" diff --git a/clang/test/Analysis/html-diags.c b/clang/test/Analysis/html-diags.c index 182bcfbdfa1..dd185b542a3 100644 --- a/clang/test/Analysis/html-diags.c +++ b/clang/test/Analysis/html-diags.c @@ -3,6 +3,12 @@ // RUN: %clang_analyze_cc1 -analyzer-output=html -analyzer-checker=core -o %T/dir %s // RUN: ls %T/dir | grep report +// D30406: Test new html-single-file output +// RUN: rm -fR %T/dir +// RUN: mkdir %T/dir +// RUN: %clang_analyze_cc1 -analyzer-output=html-single-file -analyzer-checker=core -o %T/dir %s +// RUN: ls %T/dir | grep report + // PR16547: Test relative paths // RUN: cd %T/dir // RUN: %clang_analyze_cc1 -analyzer-output=html -analyzer-checker=core -o testrelative %s diff --git a/clang/test/Coverage/html-diagnostics.c b/clang/test/Coverage/html-diagnostics.c index 045943ae8b1..34b86cd9829 100644 --- a/clang/test/Coverage/html-diagnostics.c +++ b/clang/test/Coverage/html-diagnostics.c @@ -1,11 +1,18 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t %s // RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s +// +// RUN: rm -rf %t +// RUN: %clang_cc1 -analyze -analyzer-output=html-single-file -analyzer-checker=core -o %t %s +// RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s // REQUIRES: staticanalyzer // CHECK: <h3>Annotated Source Code</h3> +// Make sure it's not generated as a multi-file HTML output +// CHECK-NOT: <h4 class=FileName>{{.*}} + // Without tweaking expr, the expr would hit to the line below // emitted to the output as comment. // CHECK: {{[D]ereference of null pointer}} diff --git a/clang/test/Coverage/html-multifile-diagnostics.c b/clang/test/Coverage/html-multifile-diagnostics.c new file mode 100644 index 00000000000..abd54ae8393 --- /dev/null +++ b/clang/test/Coverage/html-multifile-diagnostics.c @@ -0,0 +1,21 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t %s +// RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s + +// REQUIRES: staticanalyzer + +// CHECK: <h3>Annotated Source Code</h3> + +// Make sure it's generated as multi-file HTML output +// CHECK: <h4 class=FileName>{{.*}}html-multifile-diagnostics.c</h4> +// CHECK: <h4 class=FileName>{{.*}}html-multifile-diagnostics.h</h4> + +// Without tweaking expr, the expr would hit to the line below +// emitted to the output as comment. +// CHECK: {{[D]ereference of null pointer}} + +#include "html-multifile-diagnostics.h" + +void f0() { + f1((int*)0); +} diff --git a/clang/test/Coverage/html-multifile-diagnostics.h b/clang/test/Coverage/html-multifile-diagnostics.h new file mode 100644 index 00000000000..4a99ff0df9c --- /dev/null +++ b/clang/test/Coverage/html-multifile-diagnostics.h @@ -0,0 +1,3 @@ +void f1(int *ptr) { + *ptr = 0; +} |