Revert "[C++20] [Modules] Don't load declaration eagerly for named modules"
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Wed, 29 Mar 2023 03:05:37 +0000 (11:05 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Wed, 29 Mar 2023 03:15:38 +0000 (11:15 +0800)
commit279c7a2f17937836ed13e359c3fb381bef7defaf
tree20a2288abddb907fc8614d3a1849aaf083708934
parent766d048d819a78443da73f67afa04e0a108412b6
Revert "[C++20] [Modules] Don't load declaration eagerly for named modules"

This reverts commit af86957cbbffd3dfff3c6750ebddf118aebd0069.

Close https://github.com/llvm/llvm-project/issues/61733.

Previously I banned the eagerly loading for declarations from named
modules to speedup the process of reading modules. But I didn't think
about special decls like PragmaCommentDecl and PragmaDetectMismatchDecl.
So here is the issue https://github.com/llvm/llvm-project/issues/61733.

Note that the current behavior is still incorrect. Given:

```
// mod.cppm
module;

export module mod;
```

and

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

Now the IR of `user.cpp` will contain the metadata '!0 =
!{!"msvcprt.lib"}' incorrectly. 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.
clang/lib/Serialization/ASTWriterDecl.cpp
clang/test/Modules/no-eager-load.cppm [deleted file]