[PATCH] D122119: [C++20][Modules] Adjust handling of exports of namespaces and using-decls.

Iain Sandoe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 24 14:02:58 PDT 2022


iains added inline comments.


================
Comment at: clang/lib/Sema/SemaModule.cpp:814-815
+        diagExportedUnnamedDecl(S, UnnamedDeclKind::Namespace, D, BlockStart);
+      else
+        ; // We allow an empty named namespace decl.
+    } else if (DC->getRedeclContext()->isFileContext() && !isa<EnumDecl>(D))
----------------
ChuanqiXu wrote:
> I think we should remove it. So that the above `if` could be further merged.
we can remove the else ; but we cannot merge the !HasName into the if (that changes the logic of the expression such that empty & unnamed namespace decls get passed to checkExportedDeclContext()) - which emits a diagnostic not expected by the standard.

For me, the 'else ;' makes it clear what the alternative is doing (and there's a comment as well) - but if the general opinions is to remove it, that's also fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122119



More information about the cfe-commits mailing list