<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64248>64248</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Wrong header picked for forward-declared symbol in the presence of IWYU pragmas.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-include-cleaner
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
VitaNuo
</td>
</tr>
</table>
<pre>
unrelated_name.h
`struct Foo {};`
internal_header.h
```
// IWYU pragma: private, include "public.h"
struct Foo;
```
all.h
```
#include "internal_header.h"
#include "unrelated_name.h"
```
user.cc
```
#include "all.h"
Foo *f; // triggers an include for "public.h" and not "unrelated_header.h"
```
Note that renaming `unrelated_header.h` to `foo.h` would not have the problem, since `foo.h` and the symbol `Foo` have similar names.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMk09v3CwQxj8NvqC1CKz_HXzIvquV3ktubdRTNIaxTYvBApwo377CdpJNs5UqWViI4XkefqOBEPRgEVtSnEhxzmCJo_Ptdx3hYXFZ59Rru1iPBiKqJwsT5iNhZ8LuSclC9IuM9OIcJdWJVGciTqRk-_nVqm1Eb8E8jQgK_ZXE_m1bfiH8Qv9__PGNzh6GCYi4p7PXzxCR8P-ottIsCinhfF46o2U-Es63yx9ZUoib8usKxvzVXlwZfI385vS57guc97Jb7ktAn0v5D_5bzjexFTG_74k40R1T9HoY0AcK9h1M7_wfcChYRa2Ln6N-fdOtsA8uIo0jROrRwqTtQEnJbqiUjEaXznrntu2LW8zmO8JzEkE6e9cZnFIfg7YSP9WnlKkovE6dM-koNbJk2_WgJ23A00Q45JlqhWpEAxm2d2XDqkaUvM7GtlFKFbVsVFNhUYiOd50QhWIFZ3V_V6lMt5xxwSpxx-pCHOucsR5rdexY1bGyqiQ5MpxAm9yY5yl3fsh0CAu25ZEf68xAhyask8K5NGCHww7-IA2CRZ94FufMt-n-oVuGQI7M6BDDh2LU0WD76J0d6EaQzlr-QrV2r3f-Bbw6KJQGPKo3ItruEDFgguf66zkJebZ4044xzoGIfZAGHcely6WbCL8k-_13mL37iTISfllfFwi_rA_8HQAA__9jCzoc">