<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56057>56057</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy warns bugprone-branch-clone if some symbols are undefined
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ishaangandhi
      </td>
    </tr>
</table>

<pre>
    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.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVk1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