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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits