Skip to content

[C++20] [Modules] Different behavior between compile .cppm file directly or compile it to .pcm file first #53838

@ChuanqiXu9

Description

@ChuanqiXu9

Some semantics of C++20 modules are implemented in ASTReader/ASTWriter. It results that the behavior would be different if the user compile *.cppm directly or compile *.cppm to *.pcm file first and then compile *.pcm file to .ll/.bc file. It would be surprising.

I think there are 2 solutions:

  1. Ban the compilation of .cppm files to .o/.ll/.bc directly. The drawback would be now the behavior depend on the file suffix. But in fact, I remember vaguely that the current behavior has depended on file suffix already.
  2. Implement the semantics again on other places. We might need to handle it in AST/Sema/CodeGen. I believe it would be a relative big change.

Personally, I prefer the first solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++20clang:modulesC++20 modules and Clang Header Modules

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions