Skip to content

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

@atetubou

Description

@atetubou

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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:modulesC++20 modules and Clang Header Modules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions