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

    <tr>
        <th>Summary</th>
        <td>
            [clangd] the IWYU pragma seems not work on macOS
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          zhang-stephen
      </td>
    </tr>
</table>

<pre>
    as title said, reproduce it with following steps:


1. create `.clangd` configuration as following:
```yml
---
CompileFlags:
  Remove: [-m*, -W*, -std=gnu*]
  CompilationDatabase: build/

---
If:
  PathMatch: .*\.[ch]{1}

CompileFlags:
  Add: [-xc, -std=c11]
  Remove: [-xc++]
  Compiler: clang

Diagnostics:
  UnusedIncludes: Strict
  MissingIncludes: Strict
```
2. create `dummy.h`, its content:
```c
//dummy.h
#ifndef __DUMMY_H
#define __DUMMY_H

typedef enum {
    RED, GREEN, BLUE
} Colors;

#endif // __DUMMY_H
```

3. create `foo.h`, just include the `dummy.h`, nothing else to do
4. then clangd will raise a warning named as `unused-includes`, and this is expected
5. add IWYU directive in `foo.h`, it looks like:
```c
// foo.h
#include "dummy.h" // IWYU pragma: keep
```
6. on windows, the warning of `unused-includes` would be suppressed, but on macOS, it **CANNOT** be suppressed. there is a screenshot for similiar scenario:

![image](https://github.com/llvm/llvm-project/assets/17326718/ca2d1b9b-8695-442d-9749-59863320d170)


Environment:
LLVM: 17.0.6
Windows: Windows 11 x64 23H2
MacOS: MacOS 14.3 Apple Silicon


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