llvm / llvm/llvm-project

[Modules] Clang modules require header files to be present even when using precompiled modules

Open
#169,768 1 comment 0 reactions 0 assignees View on GitHub
clang:modules
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

This is derived from https://issues.chromium.org/423815877

We see include not found error in clang modules build when we don't send header files to remote workers even if the header is given as Clang modules and with `-fmodules-embed-all-files`.
So I'm wondering why clang still requires header files to be there even if those files are included in given module file?

This reproduces with the following script.

```sh
cat > module.modulemap <<<"""
module A {
header \"A.h\"
}
"""

touch A.h

cat > A.c <<<"""
#include \"A.h\"
"""

clang -cc1 -emit-module -o A.pcm -fmodules module.modulemap -fmodules-embed-all-files -fmodule-name=A
clang -cc1 -emit-obj A.c -fmodules -fmodule-map-file=module.modulemap -fmodule-file=A.pcm

rm A.h

# This compile failed with: 'A.h' file not found
clang -cc1 -emit-obj A.c -fmodules -fmodule-map-file=module.modulemap -fmodule-file=A.pcm
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.