llvm-project/clang/test/Preprocessor/embed_dependencies.c
Mariya Podchishchaeva 485e69bc52
[clang] Fix dependency output for #embed (#178001)
When requesting FileEntryRef for embedded file, make sure to not use an
absolute path. Instead, create a proper relative path if we're looking
for a file from current file.

Fixes https://github.com/llvm/llvm-project/issues/161950
2026-02-02 11:00:46 +01:00

22 lines
649 B
C

// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c23 -MT %s.o --embed-dir=%S/Inputs -dependency-file - | FileCheck %s
// Yes this looks very strange indeed, but the goal is to test that we add
// files referenced by both __has_embed and #embed when we generate
// dependencies, so we're trying to see that both of these files are in the
// output.
#if __has_embed(<jk.txt>)
const char data =
#embed "Inputs/single_byte.txt"
;
_Static_assert('b' == data);
#else
#error "oops"
#endif
// expected-no-diagnostics
// CHECK: embed_dependencies.c.o
// CHECK-NEXT: embed_dependencies.c
// CHECK-NEXT: jk.txt
// CHECK-NEXT: Inputs{{[/\\]}}single_byte.txt