Skip to content

clang-tidy crashes when it encounters #embed in C code #107724

Closed
@Crest

Description

@Crest

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 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         };

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions