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

    <tr>
        <th>Summary</th>
        <td>
            Include cleaner not properly respecting "-nostdinc"
        </td>
    </tr>

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

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

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

<pre>
    My environment is my own kernel development and naturally would includes `-nostdinc -isystem <src dir>` in C flags. I have `Diagnostics.MissingInclude = Strict` and also use `-isystem` due my preference to use `<header>` in kernel developments.

I typedef'ed equivalent C's fixed types (like `uint32_t`, `uint64_t`, etc) in different header file name as those C's fixed types doesn't exist in `-nostdinc` mode.

When I opened this `main.c`. Clangd's include cleaner was suggesting to "fix" by including `<stdint.h>` when obviously I already included my own `types.h` and `stdint.h` doesn't exist.

The expectation: Include cleaner to not suggest any fix
The reality: Include cleaner suggest wrong fix when clearly `types.h` provides it and `stdint.h` doesn't exist

Reproducible sample:

types.h
```c
#pragma once

typedef unsigned int uint32_t;
```

main.c
```c
#include <types.h>

// No header providing "uint32_t" is directly included (fix available)
// (clangd missing-includes)
static uint32_t userOfUint32;
```

Clangd Version: 17.0.6

Additional note I found during writing of the sample:
1. When I used `"types.h"` instead `<types.h>`, include cleaner wrongly mark it as unused
2. Also happen if I used identifier from C standard (like `uint32_t`, `fopen`, `fflush`, `errno`, etc) with same "fix" suggestion but from respective header (like `errno` suggests `errno.h` header)
3. It doesn't happen if I use non C standard's identifiers (I have tried use "ffi_call" from libffi's "ffi.h" but no fix was suggested)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVk1v4zYQ_TX0ZRBBphzZPviQddaAD9sCbbc9LihxKE2XIlWSsqN_X5CyHCXZLgoECfgxM-8N3zxFeE-NQTywx0_s8XklhtBadzjpQanxZF--Xr-uKivHw5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