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

    <tr>
        <th>Summary</th>
        <td>
            [C++20] [Modules] The '#pragma comment(lib, ...)' and '#pragma detect_mismatch' directives in named modules shouldn't leak
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:modules
      </td>
    </tr>

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

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

<pre>
    Reproducer:

```
// mod.cppm
module;

export module mod;
```

and

```
// user.cpp
import mod;
```

now the IR for `user.cpp` will contain the metadata "!0 = !{!"msvcprt.lib"}" which is leaked from another translation unit `mod.cppm`. This is incorrect. The root cause of the problem is that `EagerlyDeserializedDecls` is designed for headers and it didn't take care for named modules. We need to redesign a new mechanism for named modules.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU01v5DYM_TXyhYghS-Px-OBDJ-4APfQSFGhvBS1xxmr04UpypumvX8gzSTaLxS5gUDD1-CiSj5iSuXiigbVH1o4VrnkOcXicV_T_mr_WvpqCfh2eaIlBr4oik78wPjL-Zvf8_t1-xYmJE7iga7Us7uZ0Qa-WmDx-HUj_LSFmuN2V4-P-G8rNotc_T7smiiXvzWncW4YfU_twhTwT_PYE5xCB7fk7z57D1VgLKviMxm8wRxk1ZgQmBBMNByZHYKJh3bFYIVx6UUvMtTVTgXQjEwKus1EzmASW8Jk0nGNwgD7kmSLkiD5ZzCZ4WL3J5Q3vLdzzGv6YTSrBxqsQI6lcXAQxhAwK10QQztvjlhgmS65g84wb0a94oWhfR0oUDVrzP-mRlE2lOJNA0yYAvdU-E2qKCdBrMBm00Z6JLkPGZwKFkTaUR0f6PrlUw58EnkhDDhDpRgcInq7gSM3oTXLfCav0IHUve6xoaPYHztu-b2U1D21PE2GDQvFONl0nunbSis4oJzrvOlmZQXAhuRQ9l03fyPpMh4kOzW6SZ93iXrIdJ4fG1ta-uDrES2VSWmnYN91BVhYnsmnTuxDKor8weZdoKvNqxyoOJfJhWi-J7bg1KacPrmyy3dblkYkjE0fBWTsCa4-_3znacRsOEx0Tcol4cQgqOEc-M3HYVPEIdV0z0TPRbb3-hNWUSeW_nUkOs5oLRpsydPNCRQKfGwlpDqu9z6mIq1qjHeacl1RWdVuMi8nzOtUqOCZOpZD78bDE8A-pzMRp61Bi4rQ16UsAAAD__1KQRWg">