[clang] [RFC][C++20][Modules] Relax ODR check in unnamed modules (PR #111160)
Dmitry Polukhin via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 8 05:34:35 PDT 2024
================
@@ -2527,7 +2527,7 @@ class BitsUnpacker {
inline bool shouldSkipCheckingODR(const Decl *D) {
return D->getASTContext().getLangOpts().SkipODRCheckInGMF &&
- D->isFromGlobalModule();
+ (D->isFromGlobalModule() || !D->isInNamedModule());
----------------
dmpolukhin wrote:
Added `isFromHeaderUnits()` and use it now.
But in general from my reading of C++ standard header units should treated as GMF see [10.3p5 note 2](https://eel.is/c++draft/module#import-note-2):
> [Note 2: A header unit is a separate translation unit with an independent set of defined macros. All declarations within a header unit are implicitly exported ([module.interface]), and are attached to the global module ([module.unit]). — end note]
So perhaps `isFromGlobalModule` should also include header units, it is used only in very few places. WDYT?
https://github.com/llvm/llvm-project/pull/111160
More information about the cfe-commits
mailing list