[all-commits] [llvm/llvm-project] 5d4e07: [C++20] [Modules] [Reduced BMI] Don't eagerly writ...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Thu Apr 18 00:38:59 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5d4e072a253afac018e312d75290314bd2d03b30
      https://github.com/llvm/llvm-project/commit/5d4e072a253afac018e312d75290314bd2d03b30
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2024-04-18 (Thu, 18 Apr 2024)

  Changed paths:
    M clang/lib/Serialization/ASTWriter.cpp
    A clang/test/Modules/unreached-static-entities.cppm

  Log Message:
  -----------
  [C++20] [Modules] [Reduced BMI] Don't eagerly write static entities in
module purview

For,

```
export module A;
static int impl() { ... }
export int func() { return impl(); }
```

Previously, even with reduced BMI, the function `impl` will be emitted
into the BMI. After the patch, the static entities in module purview
won't get emitted eagerly. Now the static entities may only be emitted
if required.

Note that, this restriction is actually more relaxed than the language
standard required. The language spec said, the program is ill-formed if
any TU-local entities get exposed. However, we can't do this since there
are many static entities in the headers of existing libraries.
Forbidding that will cause many existing program fail immediately.

Another note here is, we can't do this for non-static non-exported
entities, they can be used for other module units within the same
module.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list