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