Clang Project

clang_source_code/test/Analysis/html-diags.c
1// RUN: rm -fR %t
2// RUN: mkdir %t
3// RUN: %clang_analyze_cc1 -analyzer-output=html -analyzer-checker=core -o %t %s
4// RUN: ls %t | grep report
5
6// D30406: Test new html-single-file output
7// RUN: rm -fR %t
8// RUN: mkdir %t
9// RUN: %clang_analyze_cc1 -analyzer-output=html-single-file -analyzer-checker=core -o %t %s
10// RUN: ls %t | grep report
11
12// PR16547: Test relative paths
13// RUN: cd %t
14// RUN: %clang_analyze_cc1 -analyzer-output=html -analyzer-checker=core -o testrelative %s
15// RUN: ls %t/testrelative | grep report
16
17// Currently this test mainly checks that the HTML diagnostics doesn't crash
18// when handling macros will calls with macros.  We should actually validate
19// the output, but that requires being able to match against a specifically
20// generate HTML file.
21
22#define DEREF(p) *p = 0xDEADBEEF
23
24void has_bug(int *p) {
25  DEREF(p);
26}
27
28#define CALL_HAS_BUG(q) has_bug(q)
29
30void test_call_macro() {
31  CALL_HAS_BUG(0);
32}
33