diff options
author | Sam Clegg <sbc@chromium.org> | 2023-03-06 09:55:00 -0800 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2023-03-09 18:37:32 -0800 |
commit | d32f71a91a432db2d9ea32694a8308534b6697ec (patch) | |
tree | d11e4bc97971cc135ce64e740ab887486c2759a4 /lld | |
parent | 7c2a3573b696afecc91ca63454570dd9b09c4d41 (diff) | |
download | llvm-d32f71a91a432db2d9ea32694a8308534b6697ec.tar.gz |
[lld][WebAssembly] Use C++17 nested namespace syntax in most places. NFC
Like D131405, but for wasm-ld.
Differential Revision: https://reviews.llvm.org/D145399
Diffstat (limited to 'lld')
-rw-r--r-- | lld/wasm/Config.h | 6 | ||||
-rw-r--r-- | lld/wasm/Driver.cpp | 6 | ||||
-rw-r--r-- | lld/wasm/LTO.cpp | 6 | ||||
-rw-r--r-- | lld/wasm/LTO.h | 6 | ||||
-rw-r--r-- | lld/wasm/MapFile.h | 6 | ||||
-rw-r--r-- | lld/wasm/MarkLive.cpp | 6 | ||||
-rw-r--r-- | lld/wasm/MarkLive.h | 6 | ||||
-rw-r--r-- | lld/wasm/OutputSegment.cpp | 7 | ||||
-rw-r--r-- | lld/wasm/OutputSegment.h | 6 | ||||
-rw-r--r-- | lld/wasm/Relocations.cpp | 6 | ||||
-rw-r--r-- | lld/wasm/Relocations.h | 6 | ||||
-rw-r--r-- | lld/wasm/SymbolTable.cpp | 6 | ||||
-rw-r--r-- | lld/wasm/SymbolTable.h | 6 | ||||
-rw-r--r-- | lld/wasm/SyntheticSections.cpp | 6 | ||||
-rw-r--r-- | lld/wasm/SyntheticSections.h | 6 | ||||
-rw-r--r-- | lld/wasm/Writer.cpp | 6 | ||||
-rw-r--r-- | lld/wasm/Writer.h | 6 |
17 files changed, 34 insertions, 69 deletions
diff --git a/lld/wasm/Config.h b/lld/wasm/Config.h index 016148956252..62cc14dc6986 100644 --- a/lld/wasm/Config.h +++ b/lld/wasm/Config.h @@ -20,8 +20,7 @@ namespace llvm::CodeGenOpt { enum Level : int; } // namespace llvm::CodeGenOpt -namespace lld { -namespace wasm { +namespace lld::wasm { class InputFile; class Symbol; @@ -125,7 +124,6 @@ struct Configuration { // The only instance of Configuration struct. extern Configuration *config; -} // namespace wasm -} // namespace lld +} // namespace lld::wasm #endif diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp index e94a4bac7269..e697f4b55ae6 100644 --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -42,8 +42,7 @@ using namespace llvm::object; using namespace llvm::sys; using namespace llvm::wasm; -namespace lld { -namespace wasm { +namespace lld::wasm { Configuration *config; namespace { @@ -1218,5 +1217,4 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) { writeResult(); } -} // namespace wasm -} // namespace lld +} // namespace wasm::lld diff --git a/lld/wasm/LTO.cpp b/lld/wasm/LTO.cpp index d5ec3f70a1df..4b22e4ccc1dc 100644 --- a/lld/wasm/LTO.cpp +++ b/lld/wasm/LTO.cpp @@ -37,8 +37,7 @@ using namespace llvm; -namespace lld { -namespace wasm { +namespace lld::wasm { static std::unique_ptr<lto::LTO> createLTO() { lto::Config c; c.Options = initTargetOptionsFromCodeGenFlags(); @@ -165,5 +164,4 @@ std::vector<StringRef> BitcodeCompiler::compile() { return ret; } -} // namespace wasm -} // namespace lld +} // namespace lld::wasm diff --git a/lld/wasm/LTO.h b/lld/wasm/LTO.h index 9c1e1788ed38..bb57c6651394 100644 --- a/lld/wasm/LTO.h +++ b/lld/wasm/LTO.h @@ -32,8 +32,7 @@ class LTO; } } // namespace llvm -namespace lld { -namespace wasm { +namespace lld::wasm { class BitcodeFile; class InputFile; @@ -51,7 +50,6 @@ private: std::vector<SmallString<0>> buf; std::vector<std::unique_ptr<MemoryBuffer>> files; }; -} // namespace wasm -} // namespace lld +} // namespace lld::wasm #endif diff --git a/lld/wasm/MapFile.h b/lld/wasm/MapFile.h index ef2cc783a6c2..c590d23238e4 100644 --- a/lld/wasm/MapFile.h +++ b/lld/wasm/MapFile.h @@ -11,11 +11,9 @@ #include "llvm/ADT/ArrayRef.h" -namespace lld { -namespace wasm { +namespace lld::wasm { class OutputSection; void writeMapFile(llvm::ArrayRef<OutputSection *> outputSections); -} // namespace wasm -} // namespace lld +} // namespace lld::wasm #endif diff --git a/lld/wasm/MarkLive.cpp b/lld/wasm/MarkLive.cpp index 2b8c8e17787b..a59a80ad2cc3 100644 --- a/lld/wasm/MarkLive.cpp +++ b/lld/wasm/MarkLive.cpp @@ -30,8 +30,7 @@ using namespace llvm; using namespace llvm::wasm; -namespace lld { -namespace wasm { +namespace lld::wasm { namespace { @@ -205,5 +204,4 @@ bool MarkLive::isCallCtorsLive() { return false; } -} // namespace wasm -} // namespace lld +} // namespace lld::wasm diff --git a/lld/wasm/MarkLive.h b/lld/wasm/MarkLive.h index 7b88cb4859f8..e788cc5fc132 100644 --- a/lld/wasm/MarkLive.h +++ b/lld/wasm/MarkLive.h @@ -9,12 +9,10 @@ #ifndef LLD_WASM_MARKLIVE_H #define LLD_WASM_MARKLIVE_H -namespace lld { -namespace wasm { +namespace lld::wasm { void markLive(); -} // namespace wasm -} // namespace lld +} // namespace lld::wasm #endif // LLD_WASM_MARKLIVE_H diff --git a/lld/wasm/OutputSegment.cpp b/lld/wasm/OutputSegment.cpp index 86b538403391..ea052e89dbb5 100644 --- a/lld/wasm/OutputSegment.cpp +++ b/lld/wasm/OutputSegment.cpp @@ -15,9 +15,7 @@ using namespace llvm; using namespace llvm::wasm; -namespace lld { - -namespace wasm { +namespace lld::wasm { void OutputSegment::addInputSegment(InputChunk *inSeg) { alignment = std::max(alignment, inSeg->alignment); @@ -82,5 +80,4 @@ void OutputSegment::finalizeInputSegments() { } } -} // namespace wasm -} // namespace lld +} // namespace lld::wasm diff --git a/lld/wasm/OutputSegment.h b/lld/wasm/OutputSegment.h index 3b7a0f50be94..e1e43c1f9a36 100644 --- a/lld/wasm/OutputSegment.h +++ b/lld/wasm/OutputSegment.h @@ -13,8 +13,7 @@ #include "lld/Common/ErrorHandler.h" #include "llvm/Object/Wasm.h" -namespace lld { -namespace wasm { +namespace lld::wasm { class InputSegment; @@ -49,7 +48,6 @@ public: std::string header; }; -} // namespace wasm -} // namespace lld +} // namespace lld::wasm #endif // LLD_WASM_OUTPUT_SEGMENT_H diff --git a/lld/wasm/Relocations.cpp b/lld/wasm/Relocations.cpp index c7710a9baf32..2f6dd6af2d03 100644 --- a/lld/wasm/Relocations.cpp +++ b/lld/wasm/Relocations.cpp @@ -16,8 +16,7 @@ using namespace llvm; using namespace llvm::wasm; -namespace lld { -namespace wasm { +namespace lld::wasm { static bool requiresGOTAccess(const Symbol *sym) { if (!config->isPic && @@ -176,5 +175,4 @@ void scanRelocations(InputChunk *chunk) { } } -} // namespace wasm -} // namespace lld +} // namespace lld::wasm diff --git a/lld/wasm/Relocations.h b/lld/wasm/Relocations.h index 02787f551d80..e493f363dab7 100644 --- a/lld/wasm/Relocations.h +++ b/lld/wasm/Relocations.h @@ -9,14 +9,12 @@ #ifndef LLD_WASM_RELOCATIONS_H #define LLD_WASM_RELOCATIONS_H -namespace lld { -namespace wasm { +namespace lld::wasm { class InputChunk; void scanRelocations(InputChunk *chunk); -} // namespace wasm -} // namespace lld +} // namespace lld::wasm #endif diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp index 75fa94887561..881b1231ffdf 100644 --- a/lld/wasm/SymbolTable.cpp +++ b/lld/wasm/SymbolTable.cpp @@ -20,8 +20,7 @@ using namespace llvm; using namespace llvm::wasm; using namespace llvm::object; -namespace lld { -namespace wasm { +namespace lld::wasm { SymbolTable *symtab; void SymbolTable::addFile(InputFile *file) { @@ -966,5 +965,4 @@ void SymbolTable::handleSymbolVariants() { } } -} // namespace wasm -} // namespace lld +} // namespace wasm::lld diff --git a/lld/wasm/SymbolTable.h b/lld/wasm/SymbolTable.h index f624b8bdfd86..5009e6039602 100644 --- a/lld/wasm/SymbolTable.h +++ b/lld/wasm/SymbolTable.h @@ -18,8 +18,7 @@ #include "llvm/BinaryFormat/WasmTraits.h" #include <optional> -namespace lld { -namespace wasm { +namespace lld::wasm { class InputSegment; @@ -144,7 +143,6 @@ private: extern SymbolTable *symtab; -} // namespace wasm -} // namespace lld +} // namespace lld::wasm #endif diff --git a/lld/wasm/SyntheticSections.cpp b/lld/wasm/SyntheticSections.cpp index 85d1a99e88b5..0dc0e1d86a75 100644 --- a/lld/wasm/SyntheticSections.cpp +++ b/lld/wasm/SyntheticSections.cpp @@ -22,8 +22,7 @@ using namespace llvm; using namespace llvm::wasm; -namespace lld { -namespace wasm { +namespace lld::wasm { OutStruct out; @@ -922,5 +921,4 @@ void BuildIdSection::writeBuildId(llvm::ArrayRef<uint8_t> buf) { memcpy(hashPlaceholderPtr, buf.data(), hashSize); } -} // namespace wasm -} // namespace lld +} // namespace wasm::lld diff --git a/lld/wasm/SyntheticSections.h b/lld/wasm/SyntheticSections.h index f4e990429bb9..dd63931b974b 100644 --- a/lld/wasm/SyntheticSections.h +++ b/lld/wasm/SyntheticSections.h @@ -24,8 +24,7 @@ #define DEBUG_TYPE "lld" -namespace lld { -namespace wasm { +namespace lld::wasm { // An init entry to be written to either the synthetic init func or the // linking metadata. @@ -127,8 +126,7 @@ inline bool operator==(const ImportKey<T> &lhs, const ImportKey<T> &rhs) { lhs.importName == rhs.importName && lhs.type == rhs.type; } -} // namespace wasm -} // namespace lld +} // namespace wasm::lld // `ImportKey<T>` can be used as a key in a `DenseMap` if `T` can be used as a // key in a `DenseMap`. diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index e82d70c9678d..44f90f34faff 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -45,8 +45,7 @@ using namespace llvm; using namespace llvm::wasm; -namespace lld { -namespace wasm { +namespace lld::wasm { static constexpr int stackAlignment = 16; static constexpr int heapAlignment = 16; @@ -1865,5 +1864,4 @@ void Writer::createHeader() { void writeResult() { Writer().run(); } -} // namespace wasm -} // namespace lld +} // namespace wasm::lld diff --git a/lld/wasm/Writer.h b/lld/wasm/Writer.h index d83e4cbda628..cd32ecffb37d 100644 --- a/lld/wasm/Writer.h +++ b/lld/wasm/Writer.h @@ -9,12 +9,10 @@ #ifndef LLD_WASM_WRITER_H #define LLD_WASM_WRITER_H -namespace lld { -namespace wasm { +namespace lld::wasm { void writeResult(); -} // namespace wasm -} // namespace lld +} // namespace lld::wasm #endif |