Issue |
154743
|
Summary |
[clang][analyzer] Formatting of macros absent in plist reports
|
Labels |
clang
|
Assignees |
|
Reporter |
ankurkraj
|
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 ?
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs