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