diff --git a/lld/COFF/COFFLinkerContext.h b/lld/COFF/COFFLinkerContext.h --- a/lld/COFF/COFFLinkerContext.h +++ b/lld/COFF/COFFLinkerContext.h @@ -18,8 +18,7 @@ #include "lld/Common/CommonLinkerContext.h" #include "lld/Common/Timer.h" -namespace lld { -namespace coff { +namespace lld::coff { class COFFLinkerContext : public CommonLinkerContext { public: @@ -80,7 +79,6 @@ Timer diskCommitTimer; }; -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif diff --git a/lld/COFF/COFFLinkerContext.cpp b/lld/COFF/COFFLinkerContext.cpp --- a/lld/COFF/COFFLinkerContext.cpp +++ b/lld/COFF/COFFLinkerContext.cpp @@ -13,8 +13,7 @@ #include "lld/Common/Memory.h" #include "llvm/DebugInfo/CodeView/TypeHashing.h" -namespace lld { -namespace coff { +namespace lld::coff { COFFLinkerContext::COFFLinkerContext() : symtab(*this), rootTimer("Total Linking Time"), @@ -36,5 +35,4 @@ tpiStreamLayoutTimer("TPI Stream Layout", totalPdbLinkTimer), diskCommitTimer("Commit to Disk", totalPdbLinkTimer) {} -} // namespace coff -} // namespace lld +} // namespace lld::coff diff --git a/lld/COFF/CallGraphSort.h b/lld/COFF/CallGraphSort.h --- a/lld/COFF/CallGraphSort.h +++ b/lld/COFF/CallGraphSort.h @@ -11,14 +11,12 @@ #include "llvm/ADT/DenseMap.h" -namespace lld { -namespace coff { +namespace lld::coff { class SectionChunk; class COFFLinkerContext; llvm::DenseMap computeCallGraphProfileOrder(const COFFLinkerContext &ctx); -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif diff --git a/lld/COFF/Chunks.h b/lld/COFF/Chunks.h --- a/lld/COFF/Chunks.h +++ b/lld/COFF/Chunks.h @@ -21,8 +21,7 @@ #include #include -namespace lld { -namespace coff { +namespace lld::coff { using llvm::COFF::ImportDirectoryTableEntry; using llvm::object::COFFSymbolRef; @@ -698,8 +697,7 @@ void applyArm64Imm(uint8_t *off, uint64_t imm, uint32_t rangeLimit); void applyArm64Branch26(uint8_t *off, int64_t v); -} // namespace coff -} // namespace lld +} // namespace lld::coff namespace llvm { template <> diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -27,8 +27,7 @@ using namespace llvm::COFF; using llvm::support::ulittle32_t; -namespace lld { -namespace coff { +namespace lld::coff { SectionChunk::SectionChunk(ObjFile *f, const coff_section *h) : Chunk(SectionKind), file(f), header(h), repl(this) { @@ -996,5 +995,4 @@ } } -} // namespace coff -} // namespace lld +} // namespace lld::coff diff --git a/lld/COFF/Config.h b/lld/COFF/Config.h --- a/lld/COFF/Config.h +++ b/lld/COFF/Config.h @@ -21,8 +21,7 @@ #include #include -namespace lld { -namespace coff { +namespace lld::coff { using llvm::COFF::IMAGE_FILE_MACHINE_UNKNOWN; using llvm::COFF::WindowsSubsystem; @@ -289,7 +288,6 @@ extern std::unique_ptr config; -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif diff --git a/lld/COFF/DLL.h b/lld/COFF/DLL.h --- a/lld/COFF/DLL.h +++ b/lld/COFF/DLL.h @@ -12,8 +12,7 @@ #include "Chunks.h" #include "Symbols.h" -namespace lld { -namespace coff { +namespace lld::coff { // Windows-specific. // IdataContents creates all chunks for the DLL import table. @@ -76,7 +75,6 @@ } }; -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif diff --git a/lld/COFF/DLL.cpp b/lld/COFF/DLL.cpp --- a/lld/COFF/DLL.cpp +++ b/lld/COFF/DLL.cpp @@ -31,8 +31,7 @@ using namespace llvm::support::endian; using namespace llvm::COFF; -namespace lld { -namespace coff { +namespace lld::coff { namespace { // Import table @@ -752,5 +751,4 @@ chunks.insert(chunks.end(), forwards.begin(), forwards.end()); } -} // namespace coff -} // namespace lld +} // namespace lld::coff diff --git a/lld/COFF/DebugTypes.h b/lld/COFF/DebugTypes.h --- a/lld/COFF/DebugTypes.h +++ b/lld/COFF/DebugTypes.h @@ -17,18 +17,15 @@ #include "llvm/Support/Error.h" #include "llvm/Support/MemoryBuffer.h" -namespace llvm { -namespace codeview { +namespace llvm::codeview { struct GloballyHashedType; -} // namespace codeview -namespace pdb { +} +namespace llvm::pdb { class NativeSession; class TpiStream; } -} // namespace llvm -namespace lld { -namespace coff { +namespace lld::coff { using llvm::codeview::GloballyHashedType; using llvm::codeview::TypeIndex; @@ -175,7 +172,6 @@ TpiSource *makeUsePrecompSource(COFFLinkerContext &ctx, ObjFile *file, llvm::codeview::PrecompRecord ts); -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif diff --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp --- a/lld/COFF/DebugTypes.cpp +++ b/lld/COFF/DebugTypes.cpp @@ -953,15 +953,13 @@ }; } // namespace -namespace lld { -namespace coff { +namespace lld::coff { /// This type is just a wrapper around GHashTable with external linkage so it /// can be used from a header. struct GHashState { GHashTable table; }; -} // namespace coff -} // namespace lld +} // namespace lld::coff GHashTable::~GHashTable() { delete[] table; } diff --git a/lld/COFF/Driver.h b/lld/COFF/Driver.h --- a/lld/COFF/Driver.h +++ b/lld/COFF/Driver.h @@ -28,8 +28,7 @@ #include #include -namespace lld { -namespace coff { +namespace lld::coff { extern std::unique_ptr driver; @@ -234,7 +233,6 @@ #undef OPTION }; -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -58,8 +58,7 @@ using namespace llvm::COFF; using namespace llvm::sys; -namespace lld { -namespace coff { +namespace lld::coff { std::unique_ptr config; std::unique_ptr driver; @@ -2418,5 +2417,4 @@ ctx.rootTimer.print(); } -} // namespace coff -} // namespace lld +} // namespace lld::coff diff --git a/lld/COFF/ICF.h b/lld/COFF/ICF.h --- a/lld/COFF/ICF.h +++ b/lld/COFF/ICF.h @@ -13,15 +13,13 @@ #include "lld/Common/LLVM.h" #include "llvm/ADT/ArrayRef.h" -namespace lld { -namespace coff { +namespace lld::coff { class Chunk; class COFFLinkerContext; void doICF(COFFLinkerContext &ctx, ICFLevel); -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif diff --git a/lld/COFF/ICF.cpp b/lld/COFF/ICF.cpp --- a/lld/COFF/ICF.cpp +++ b/lld/COFF/ICF.cpp @@ -34,8 +34,7 @@ using namespace llvm; -namespace lld { -namespace coff { +namespace lld::coff { class ICF { public: @@ -322,5 +321,4 @@ ICF(ctx, icfLevel).run(); } -} // namespace coff -} // namespace lld +} // namespace lld::coff diff --git a/lld/COFF/LLDMapFile.h b/lld/COFF/LLDMapFile.h --- a/lld/COFF/LLDMapFile.h +++ b/lld/COFF/LLDMapFile.h @@ -9,11 +9,9 @@ #ifndef LLD_COFF_LLDMAPFILE_H #define LLD_COFF_LLDMAPFILE_H -namespace lld { -namespace coff { +namespace lld::coff { class COFFLinkerContext; void writeLLDMapFile(const COFFLinkerContext &ctx); } -} #endif diff --git a/lld/COFF/LTO.h b/lld/COFF/LTO.h --- a/lld/COFF/LTO.h +++ b/lld/COFF/LTO.h @@ -27,14 +27,11 @@ #include #include -namespace llvm { -namespace lto { +namespace llvm::lto { class LTO; } -} -namespace lld { -namespace coff { +namespace lld::coff { class BitcodeFile; class InputFile; @@ -56,6 +53,5 @@ llvm::DenseSet thinIndices; }; } -} #endif diff --git a/lld/COFF/MapFile.h b/lld/COFF/MapFile.h --- a/lld/COFF/MapFile.h +++ b/lld/COFF/MapFile.h @@ -9,11 +9,9 @@ #ifndef LLD_COFF_MAPFILE_H #define LLD_COFF_MAPFILE_H -namespace lld { -namespace coff { +namespace lld::coff { class COFFLinkerContext; void writeMapFile(COFFLinkerContext &ctx); } -} #endif diff --git a/lld/COFF/MarkLive.h b/lld/COFF/MarkLive.h --- a/lld/COFF/MarkLive.h +++ b/lld/COFF/MarkLive.h @@ -11,14 +11,12 @@ #include "lld/Common/LLVM.h" -namespace lld { -namespace coff { +namespace lld::coff { class COFFLinkerContext; void markLive(COFFLinkerContext &ctx); -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif // LLD_COFF_MARKLIVE_H diff --git a/lld/COFF/MarkLive.cpp b/lld/COFF/MarkLive.cpp --- a/lld/COFF/MarkLive.cpp +++ b/lld/COFF/MarkLive.cpp @@ -13,8 +13,7 @@ #include "llvm/ADT/STLExtras.h" #include -namespace lld { -namespace coff { +namespace lld::coff { // Set live bit on for each reachable chunk. Unmarked (unreachable) // COMDAT chunks will be ignored by Writer, so they will be excluded @@ -70,4 +69,3 @@ } } } -} diff --git a/lld/COFF/MinGW.h b/lld/COFF/MinGW.h --- a/lld/COFF/MinGW.h +++ b/lld/COFF/MinGW.h @@ -17,8 +17,7 @@ #include "llvm/Option/ArgList.h" #include -namespace lld { -namespace coff { +namespace lld::coff { class COFFLinkerContext; // Logic for deciding what symbols to export, when exporting all @@ -59,7 +58,6 @@ void wrapSymbols(COFFLinkerContext &ctx, ArrayRef wrapped); -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif diff --git a/lld/COFF/PDB.h b/lld/COFF/PDB.h --- a/lld/COFF/PDB.h +++ b/lld/COFF/PDB.h @@ -13,11 +13,9 @@ #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringRef.h" -namespace llvm { -namespace codeview { +namespace llvm::codeview { union DebugInfo; } -} namespace lld { class Timer; diff --git a/lld/COFF/SymbolTable.h b/lld/COFF/SymbolTable.h --- a/lld/COFF/SymbolTable.h +++ b/lld/COFF/SymbolTable.h @@ -20,8 +20,7 @@ struct LTOCodeGenerator; } -namespace lld { -namespace coff { +namespace lld::coff { class Chunk; class CommonChunk; @@ -142,7 +141,6 @@ StringRef ltrim1(StringRef s, const char *chars); -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp --- a/lld/COFF/SymbolTable.cpp +++ b/lld/COFF/SymbolTable.cpp @@ -26,8 +26,7 @@ using namespace llvm; -namespace lld { -namespace coff { +namespace lld::coff { StringRef ltrim1(StringRef s, const char *chars) { if (!s.empty() && strchr(chars, s[0])) @@ -891,5 +890,4 @@ } } -} // namespace coff -} // namespace lld +} // namespace lld::coff diff --git a/lld/COFF/TypeMerger.h b/lld/COFF/TypeMerger.h --- a/lld/COFF/TypeMerger.h +++ b/lld/COFF/TypeMerger.h @@ -17,8 +17,7 @@ #include "llvm/Support/Allocator.h" #include -namespace lld { -namespace coff { +namespace lld::coff { using llvm::codeview::GloballyHashedType; using llvm::codeview::TypeIndex; @@ -79,7 +78,6 @@ COFFLinkerContext &ctx; }; -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif diff --git a/lld/COFF/Writer.h b/lld/COFF/Writer.h --- a/lld/COFF/Writer.h +++ b/lld/COFF/Writer.h @@ -16,8 +16,7 @@ #include #include -namespace lld { -namespace coff { +namespace lld::coff { static const int pageSize = 4096; class COFFLinkerContext; @@ -80,7 +79,6 @@ uint32_t stringTableOff = 0; }; -} // namespace coff -} // namespace lld +} // namespace lld::coff #endif