<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57293>57293</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] Module interface unavailable when specified by name
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          aaronmondal
      </td>
    </tr>
</table>

<pre>
    I am not sure whether this is a bug or working as intended. I suspect the former.

Consider a module with separate interface and implementation:
```bash
echo "export module mymodule;" > mymodule.cppm
echo "module mymodule;" > mymodule.cpp
```

This compiles fine when using the following commands (First produces `mymodule.cppm`, second produces `mymodule.o`.)
```bash
clang++ -std=c++20 mymodule.cppm --precompile
clang++ -fmodule-file=mymodule.pcm -std=c++20 mymodule.cpp -c
```
Clang will always load module files specified via `-fmodule-file` when omitting the name. So it makes sense that this works.

However, trying to load the module conditionally by declaring the modulename fails:
```bash
clang++ -fmodule-file=mymodule=mymodule.pcm -std=c++20 mymodule.cpp -c
# error: definition of module 'mymodule' is not available; use -fmodule-file= to specify path to precompiled module interface
```
It seems like module name resolution does not work in this case.

Shouldn't clang autodetect the correct module interface just from its name in the `-fmodule-file` flag?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVU1v4zgM_TX2hYjhyOMkPviwbbeYHvY0-wdoi441lSVDkpvJv1_KatJNJzsYLCAk-iL5-Pgod1ae2xfACYwN4BdHcBopjOQgjMoDD4RuOYJ1cLLuVZkjIG-bQEaSLOCFjfxMfeD7BIN1E7kiK5-y8o_0-2iNV5L9IUxWLpoDqDCCpxkdBlpduQF7AjQS1DRrmsgEDMqarHp3ku3KNDr0Y9qifrSQCUE_ZuvCxfd0TpOseuAzyKo_r1tFP8_Tre3vGX2C8O_k_o4c9XaalSYPgzIrfQYWH4lKjGhtT3HF1yZO0XPgw7NyPsDsOEbPhuz1FiVH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