[PATCH] D140261: [C++20][Modules] Do not allow non-inline external definitions in header units.
Chuanqi Xu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 18 19:08:47 PST 2022
ChuanqiXu accepted this revision.
ChuanqiXu added a comment.
This revision is now accepted and ready to land.
LGTM generally.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:12957-12958
+ // units.
+ if (getLangOpts().CPlusPlus20 && getLangOpts().CPlusPlusModules &&
+ !ModuleScopes.empty() && ModuleScopes.back().Module->isHeaderUnit()) {
+ if (VDecl->getFormalLinkage() == Linkage::ExternalLinkage &&
----------------
`getLangOpts().CPlusPlus20` is redundant. It is also good to define a helper interface `withinHeaderUnit` in Sema (not required).
================
Comment at: clang/lib/Sema/SemaDecl.cpp:15116-15117
+ // units.
+ if (getLangOpts().CPlusPlus20 && getLangOpts().CPlusPlusModules &&
+ !ModuleScopes.empty() && ModuleScopes.back().Module->isHeaderUnit()) {
+ if (FD->getFormalLinkage() == Linkage::ExternalLinkage &&
----------------
ditto
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140261/new/
https://reviews.llvm.org/D140261
More information about the cfe-commits
mailing list