[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
This commit is contained in:
Sam Clegg 2023-03-06 09:55:00 -08:00
parent 7c2a3573b6
commit d32f71a91a
17 changed files with 34 additions and 69 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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`.

View File

@ -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

View File

@ -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