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

    <tr>
        <th>Summary</th>
        <td>
            clangd gets confused by `-U...` in command line
        </td>
    </tr>

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

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

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

<pre>
    For input file `test.c`:
```c
#include <stdio.h>

#ifndef MSG
#define MSG "hello world"
#endif

void hello() {
  printf(MSG);
}
```
and `compile_commands.json`:
```json
[
  {      
    "directory": "/tmp",      
    "command": "clang -UMSG -c -o test.o test.c'", 
    "file": "test.c",            
    "output": "test.o"            
  }      
]
```
clangd reports false positive:
```console
$ clangd --check=test.c
...
I[21:05:56.452] Indexing headers...
I[21:05:56.472] Building AST...
E[21:05:56.491] [undeclared_var_use] Line 8: use of undeclared identifier 'MSG'
I[21:05:56.491] Indexing AST...
I[21:05:56.492] Building inlay hints
I[21:05:56.492] Building semantic highlighting
I[21:05:56.492] Testing features at each token (may be slow in large files)
I[21:05:56.493] Found definition heuristically using nearby identifier MSG
I[21:05:56.493] Found definition heuristically using nearby identifier MSG
I[21:05:56.501] All checks completed, 1 errors
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VEuP2zYQ_jXUZWCBpixLOuhgx3ERoD0lOS8ociRxQ5ECH7v1vy8oa-3N1gl6qmFA5Mz3zYPz4N6rwSC2pDyS8pTxGEbr2ueZ6-izzspLe7YOlJljgF5pBLKnAX3IBdlTUhwIPRF6SOflL9Y7K5QROkoEUnzyQSqbj6T4vGpvmN5I7OGvr3_cRBJ7ZTCJgDA2otYWXq3TkjB2A6GRqn9v68UqCQuYsJqwBkh1vGoAZqdM6AmrkxvWkGLVkOr0IfjrlRuZkhR2mpXGJ2GniRvp82dvzcOcF8VVVN68kuoIy-9NACk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