[PATCH] D152946: [C++20][Modules] Implement P2615R1 revised export diagnostics.
Chuanqi Xu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 19 00:31:59 PDT 2023
ChuanqiXu accepted this revision.
ChuanqiXu added a comment.
This revision is now accepted and ready to land.
LGTM with comments.
================
Comment at: clang/lib/Sema/SemaModule.cpp:824-827
+ bool AllUnnamed = true;
+ for (auto *D : DC->decls())
+ AllUnnamed &= checkExportedDecl(S, D, BlockStart);
+ return AllUnnamed;
----------------
================
Comment at: clang/lib/Sema/SemaModule.cpp:865
if (auto *DC = dyn_cast<DeclContext>(D)) {
- if (isa<NamespaceDecl>(D) && DC->decls().empty()) {
- if (!HasName)
- // We don't allow an empty anonymous namespace (we don't allow decls
- // in them either, but that's handled in the recursion).
- diagExportedUnnamedDecl(S, UnnamedDeclKind::Namespace, D, BlockStart);
- // We allow an empty named namespace decl.
- } else if (DC->getRedeclContext()->isFileContext() && !isa<EnumDecl>(D))
- return checkExportedDeclContext(S, DC, BlockStart);
+ if (isa<NamespaceDecl>(D)) {
+ if (auto *ND = dyn_cast<NamedDecl>(D)) {
----------------
nit: we prefer shorter indentation.
================
Comment at: clang/lib/Sema/SemaModule.cpp:872
+ } else if (!DC->decls().empty() &&
+ DC->getRedeclContext()->isFileContext() && !isa<EnumDecl>(D))
+ return checkExportedDeclContext(S, DC, BlockStart);
----------------
A namespace decl may not be a enum decl.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152946/new/
https://reviews.llvm.org/D152946
More information about the cfe-commits
mailing list