| Issue |
177594
|
| Summary |
clang-tidy: quote problematic code even when no source location is available
|
| Labels |
clang-tidy
|
| Assignees |
|
| Reporter |
avrahamshukron
|
Clang tidy may sometimes emit cryptic error/warning that are impossible to trace:
```
error: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses,-warnings-as-errors]
1 warning generated.
1 warning treated as error
```
Note the lack of source file:line before `error:` or the lack of quoted problematic code.
This can be easily triggered if the scanned file is compiled with some flag that violate any check.
For example passing `-DRESULT=1*2`
to a file that looks like:
```cpp
int main()
{
return 0;
}
```
will emit `bugprone-macro-parentheses` with no source or quoted text.
Minimal reproducible example: https://godbolt.org/z/E49denvh5
In this case I think the tool can be improved by emitting something like:
```
command-line: error: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses,-warnings-as-errors]
clang -DRESULT=1*2 main.cpp
^
```
So that it will be clear where is the error coming from.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs