<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/154743>154743</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang][analyzer] Formatting of macros absent in plist reports
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ankurkraj
</td>
</tr>
</table>
<pre>
Clang analyzer does not format the macros in the plist reports . For eg.
For the macro
```c
#define dummy_unformatted do{int x=1;int y =2; if(x<y){printf("unformatted macro with bad spacing\n");}}while(0)
```
Ideally it should show something like this
```c
do {
int x = 1;
int y = 2;
if (x < y) {
printf("unformatted macro with bad spacing\n");
}
} while (0)
```
The plist reports contain the macro as is . This causes issues when the macros expansions are large and convoluted .
For eg. The below macro is almost unreadable while parsing plist files or on CodeChecker web
```c
#define COMPLEX_OPERATION(x,y,z) ((((x)&0xDEADBEEF)<<0x4)||(malloc(sizeof(int)*0x10)!=NULL&&free((void*)(x)),printf("Debug: %x\n",(unsigned)(x)^0xCAFEBABE),((y)*(z)+0x1337)>0xFF)?((external_func1((x)>>0x2)&&external_func2(~(y)|0xFEEDFACE))?((z)^0xABCDEF01):0x0):((cleanup_func((void*)(y))),(error_handler(0xDEAD)),0xBAADF00D))
```
Can we use clang format to format these macros individually while the plist diagnostics are created ?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVU2PozgQ_TXOpTSRMRDoQw58SiP1To9WvdLeWgYqwdOOnbVNh_Rhf_vKhvRkdmallZAwRblevarnMrdWHBXinqQlSesNn9yozZ6r18m8Gv5t0-nhuq8kV0fgisvrOxoYNFpQ2sFBmxN34EaEE--NtiBU-DpLYR0YPGvjLGyh1QbwuCW08KsPf0ILsqPL0_sPFg94EAphmE6n68ukFgSHAwDAoElWCuVgJnEdkTisrwBA4pqRuARxICyfSVxdCXsgWXk2QjlvI4zdxwrgcBFuhI4PYM-8F-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