Issue |
128195
|
Summary |
diags without usable source location after #127338
|
Labels |
new issue
|
Assignees |
|
Reporter |
nico
|
```
$ cat repro.cc
class Location {
public:
static Location CurrentWithoutFunctionName(
const char* file_name = __builtin_FILE(),
int line_number = __builtin_LINE());
};
class NotReachedNoreturnError {
public:
explicit NotReachedNoreturnError(
const Location& location =
Location::CurrentWithoutFunctionName());
[[noreturn]] [[clang::nomerge]] [[clang::noinline]] [[clang::not_tail_called]]
~NotReachedNoreturnError();
};
#define NOTREACHED() NotReachedNoreturnError()
int f() {
NOTREACHED();
return 4;
}
int g() {
return 4;
NOTREACHED();
}
```
```
$ out/gn/bin/clang -c repro.cc -Wunreachable-code-aggressive
repro.cc:22:10: warning: 'return' will never be executed [-Wunreachable-code-return]
22 | return 4;
| ^
repro.cc:12:11: warning: code will never be executed [-Wunreachable-code]
12 | Location::CurrentWithoutFunctionName());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
```
The first diag points at the line that has the problem. That's good.
The second diag doesn't point even close to the problem. If the macro is in a header and the diag is in a file that uses the macro 20+ times, it's very hard to see where the problem is.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs