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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy crashes when it encounters #embed in C code
        </td>
    </tr>

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

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

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

<pre>
    I ran into the following crash trying to run clang-tidy on some code using C23 `#embed` to include a JSON schema file into a `const char []`. The shortened output from clang-tidy (the [full-output](https://github.com/user-attachments/files/16920084/clang-tidy19-embed-crash.txt) is attached just in case):
```
LLVM ERROR: Support for EmbedExpr is not implemented.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /usr/local/llvm19/bin/clang-tidy main.c -- -I/usr/local/include -fblocks
1.      <eof> parser at end of file
2.      While analyzing stack:
        #0 Calling get_schema at line 99
        #1 Calling main
3.      /home/crest/friendly-s6/main.c:1074:3: Error evaluating statement
4.      /home/crest/friendly-s6/main.c:1074:3: Error evaluating statement
```



Here's the trimmed down code to the function that triggers the error (with line numbers to match up against the crash report).
```
  1070 static inline ucl_object_t *_Nonnull
  1071 get_schema(void)
  1072 {
  1073         const unsigned char schema_json[] = {
  1074                 #embed "schema.json"
  1075 };
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU9v47YT_TT0ZWCDIm3ZOujgJDZ--0O6u0iK9hhQ5EhiQpEG_ySbfvqCYpy42aKHAhUMCwRn3ryZeTMSIejBIrZkc0U2NwuR4uh8e-0xxEXn1Gv7BbywoG10EEeE3hnjXrQdQHoRRoj-NR-iA58sSCPssIxavYKzENyEIJ1CSCEbXTMOpKaEcZw6VKSm2U9baZJCEPD_-29fIcgRJwG9NliiiuwjnQ0R5Cg8FKakpiv4dUQIo_MRLSpwKZ5Sh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