| Issue |
56057
|
| Summary |
clang-tidy warns bugprone-branch-clone if some symbols are undefined
|
| Labels |
|
| Assignees |
|
| Reporter |
ishaangandhi
|
Given the following file, utils.H:
```
#include <unavailable_header.H>
void getUncrossPrice()
{
if (unavailable)
{
function1(uncrossPrice);
}
else
{
function2(uncrossPrice);
}
}
```
**I've reduced this test case down as far as I could. Removing any other aspect makes the warning stop appearing.**
I get the following warning:
```
clang-tidy utils.H -checks="bugprone-branch-clone"
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "/devsandbox/hfdev/igandhi/strategy/libs/monotc/OTCUtils.H"
No compilation database found in /devsandbox/hfdev/igandhi/strategy/libs/monotc or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
1 warning and 1 error generated.
Error while processing /devsandbox/hfdev/igandhi/strategy/libs/monotc/OTCUtils.H.
/devsandbox/hfdev/igandhi/strategy/libs/monotc/OTCUtils.H:2:10: error: 'unavailable_header.H' file not found [clang-diagnostic-error]
#include <unavailable_header.H>
^~~~~~~~~~~~~~~~~~~~~
/devsandbox/hfdev/igandhi/strategy/libs/monotc/OTCUtils.H:7:5: warning: if with identical then and else branches [bugprone-branch-clone]
if (unavailable)
^
/devsandbox/hfdev/igandhi/strategy/libs/monotc/OTCUtils.H:11:5: note: else branch starts here
else
^
Found compiler error(s).
```
What I would expect is for `clang-tidy` to report the errors, but not the warning.
This is on clang-tidy v13.0.0.
I'd be happy to try to fix this, if confirmed.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs