[PATCH] D119409: [C++20] [Modules] Remain dynamic initializing internal-linkage variables in module interface unit

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 24 19:44:34 PDT 2022


ChuanqiXu added a comment.

In D119409#3405733 <https://reviews.llvm.org/D119409#3405733>, @dblaikie wrote:

> is this an issue for Clang Header Modules codegen too? (maybe the solution should be the same for both, then)

For my limited knowledge to clang header modules, `.modulemap` is a necessary condition to use clang header modules. And there is one `.modulemap` in libcxx so that user could use `import <iostream>` for libcxx. Then libcxx implements `<iostream>` in another fashion which wouldn't meet the problem. And according to my understanding to the clang/llvm ecosystem, libstdc++ is not included as a target user of clang header modules, is it? If we are talking about if it would be a problem that we use clang header modules for libstdc++'s <iostream>, (I don
't do a experiment!) I think we would meet the same problem and the solution should be the same as one.

> & maybe we should do this regardless of the presence/absence/type of initializer, just for consistency?

Yeah, they should have internal linkage so it wouldn't be bad to emit them all. But if we choose consistency here, we would pay for the redundancy. My personal opinion would be that simplicity is more important here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119409/new/

https://reviews.llvm.org/D119409



More information about the cfe-commits mailing list