[lld] 87248ba - [lld/elf] Use C++17 nested namespace syntax in most places
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 10 13:47:38 PDT 2022
Author: Nico Weber
Date: 2022-08-10T16:47:30-04:00
New Revision: 87248ba5b1ddf779bbe4c17b719c4e5580ea58dd
URL: https://github.com/llvm/llvm-project/commit/87248ba5b1ddf779bbe4c17b719c4e5580ea58dd
DIFF: https://github.com/llvm/llvm-project/commit/87248ba5b1ddf779bbe4c17b719c4e5580ea58dd.diff
LOG: [lld/elf] Use C++17 nested namespace syntax in most places
Like D131405, but for ELF.
No behavior change.
Differential Revision: https://reviews.llvm.org/D131612
Added:
Modified:
lld/ELF/AArch64ErrataFix.h
lld/ELF/ARMErrataFix.h
lld/ELF/CallGraphSort.h
lld/ELF/Config.h
lld/ELF/DWARF.h
lld/ELF/Driver.h
lld/ELF/EhFrame.h
lld/ELF/ICF.h
lld/ELF/LTO.h
lld/ELF/LinkerScript.h
lld/ELF/MapFile.h
lld/ELF/MarkLive.h
lld/ELF/OutputSections.h
lld/ELF/Relocations.h
lld/ELF/ScriptLexer.h
lld/ELF/ScriptParser.h
lld/ELF/SymbolTable.h
lld/ELF/SyntheticSections.h
lld/ELF/Thunks.h
lld/ELF/Writer.h
Removed:
################################################################################
diff --git a/lld/ELF/AArch64ErrataFix.h b/lld/ELF/AArch64ErrataFix.h
index 1ca4ea752031f..fa34beb5d7a84 100644
--- a/lld/ELF/AArch64ErrataFix.h
+++ b/lld/ELF/AArch64ErrataFix.h
@@ -13,8 +13,7 @@
#include "llvm/ADT/DenseMap.h"
#include <vector>
-namespace lld {
-namespace elf {
+namespace lld::elf {
class Defined;
class InputSection;
@@ -43,7 +42,6 @@ class AArch64Err843419Patcher {
bool initialized = false;
};
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/ARMErrataFix.h b/lld/ELF/ARMErrataFix.h
index dd0927fb3c039..2a7e6aaeff1c9 100644
--- a/lld/ELF/ARMErrataFix.h
+++ b/lld/ELF/ARMErrataFix.h
@@ -13,8 +13,7 @@
#include "llvm/ADT/DenseMap.h"
#include <vector>
-namespace lld {
-namespace elf {
+namespace lld::elf {
class Defined;
class InputSection;
@@ -43,7 +42,6 @@ class ARMErr657417Patcher {
bool initialized = false;
};
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/CallGraphSort.h b/lld/ELF/CallGraphSort.h
index 5a092278a4164..4997cb102c326 100644
--- a/lld/ELF/CallGraphSort.h
+++ b/lld/ELF/CallGraphSort.h
@@ -11,12 +11,10 @@
#include "llvm/ADT/DenseMap.h"
-namespace lld {
-namespace elf {
+namespace lld::elf {
class InputSectionBase;
llvm::DenseMap<const InputSectionBase *, int> computeCallGraphProfileOrder();
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index fd9d3b63b2a38..accf1fd41713b 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -26,8 +26,7 @@
#include <memory>
#include <vector>
-namespace lld {
-namespace elf {
+namespace lld::elf {
class InputFile;
class BinaryFile;
@@ -419,7 +418,6 @@ static inline void internalLinkerError(StringRef loc, const Twine &msg) {
llvm::getBugReportMsg());
}
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/DWARF.h b/lld/ELF/DWARF.h
index 900c63de26ff3..1b6bb49c57c64 100644
--- a/lld/ELF/DWARF.h
+++ b/lld/ELF/DWARF.h
@@ -14,8 +14,7 @@
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/Object/ELF.h"
-namespace lld {
-namespace elf {
+namespace lld::elf {
class InputSection;
@@ -100,7 +99,6 @@ template <class ELFT> class LLDDwarfObj final : public llvm::DWARFObject {
StringRef lineStrSection;
};
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/Driver.h b/lld/ELF/Driver.h
index 474cf3c3adf06..f864daa72abe0 100644
--- a/lld/ELF/Driver.h
+++ b/lld/ELF/Driver.h
@@ -15,8 +15,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Option/ArgList.h"
-namespace lld {
-namespace elf {
+namespace lld::elf {
class InputFile;
extern std::unique_ptr<class LinkerDriver> driver;
@@ -71,7 +70,6 @@ llvm::Optional<std::string> searchScript(StringRef path);
llvm::Optional<std::string> searchLibraryBaseName(StringRef path);
llvm::Optional<std::string> searchLibrary(StringRef path);
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/EhFrame.h b/lld/ELF/EhFrame.h
index 0741e91b6ccce..95264166e36cb 100644
--- a/lld/ELF/EhFrame.h
+++ b/lld/ELF/EhFrame.h
@@ -11,13 +11,11 @@
#include "lld/Common/LLVM.h"
-namespace lld {
-namespace elf {
+namespace lld::elf {
struct EhSectionPiece;
uint8_t getFdeEncoding(EhSectionPiece *p);
bool hasLSDA(const EhSectionPiece &p);
-} // namespace elf
-} // namespace lld
+}
#endif
diff --git a/lld/ELF/ICF.h b/lld/ELF/ICF.h
index ed828fc4a9499..3246cc33f43c9 100644
--- a/lld/ELF/ICF.h
+++ b/lld/ELF/ICF.h
@@ -9,12 +9,10 @@
#ifndef LLD_ELF_ICF_H
#define LLD_ELF_ICF_H
-namespace lld {
-namespace elf {
+namespace lld::elf {
template <class ELFT> void doIcf();
-} // namespace elf
-} // namespace lld
+}
#endif
diff --git a/lld/ELF/LTO.h b/lld/ELF/LTO.h
index 19388f37a1464..7ab654101f248 100644
--- a/lld/ELF/LTO.h
+++ b/lld/ELF/LTO.h
@@ -27,14 +27,11 @@
#include <memory>
#include <vector>
-namespace llvm {
-namespace lto {
+namespace llvm::lto {
class LTO;
}
-} // namespace llvm
-namespace lld {
-namespace elf {
+namespace lld::elf {
class BitcodeFile;
class InputFile;
@@ -55,7 +52,6 @@ class BitcodeCompiler {
std::unique_ptr<llvm::raw_fd_ostream> indexFile;
llvm::DenseSet<StringRef> thinIndices;
};
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h
index 315b64371b28a..dc3d32e50ce04 100644
--- a/lld/ELF/LinkerScript.h
+++ b/lld/ELF/LinkerScript.h
@@ -22,8 +22,7 @@
#include <functional>
#include <memory>
-namespace lld {
-namespace elf {
+namespace lld::elf {
class Defined;
class InputFile;
@@ -365,7 +364,6 @@ class LinkerScript final {
extern std::unique_ptr<LinkerScript> script;
-} // end namespace elf
-} // end namespace lld
+} // end namespace lld::elf
#endif // LLD_ELF_LINKER_SCRIPT_H
diff --git a/lld/ELF/MapFile.h b/lld/ELF/MapFile.h
index 36bd1d2d1703d..b271f627df570 100644
--- a/lld/ELF/MapFile.h
+++ b/lld/ELF/MapFile.h
@@ -9,10 +9,8 @@
#ifndef LLD_ELF_MAPFILE_H
#define LLD_ELF_MAPFILE_H
-namespace lld {
-namespace elf {
+namespace lld::elf {
void writeMapAndCref();
-} // namespace elf
-} // namespace lld
+}
#endif
diff --git a/lld/ELF/MarkLive.h b/lld/ELF/MarkLive.h
index 63b5b26691468..ef62fdf964e4b 100644
--- a/lld/ELF/MarkLive.h
+++ b/lld/ELF/MarkLive.h
@@ -9,12 +9,10 @@
#ifndef LLD_ELF_MARKLIVE_H
#define LLD_ELF_MARKLIVE_H
-namespace lld {
-namespace elf {
+namespace lld::elf {
template <class ELFT> void markLive();
-} // namespace elf
-} // namespace lld
+}
#endif // LLD_ELF_MARKLIVE_H
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h
index 6bdbcfce7b12a..328daaddeb697 100644
--- a/lld/ELF/OutputSections.h
+++ b/lld/ELF/OutputSections.h
@@ -15,8 +15,7 @@
#include <array>
-namespace lld {
-namespace elf {
+namespace lld::elf {
struct PhdrEntry;
@@ -154,7 +153,6 @@ struct Out {
uint64_t getHeaderSize();
extern llvm::SmallVector<OutputSection *, 0> outputSections;
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h
index f70d255ba229a..6e427b355f7d8 100644
--- a/lld/ELF/Relocations.h
+++ b/lld/ELF/Relocations.h
@@ -14,8 +14,7 @@
#include "llvm/ADT/STLExtras.h"
#include <vector>
-namespace lld {
-namespace elf {
+namespace lld::elf {
class Symbol;
class InputSection;
class InputSectionBase;
@@ -212,7 +211,6 @@ ArrayRef<RelTy> sortRels(ArrayRef<RelTy> rels, SmallVector<RelTy, 0> &storage) {
}
return rels;
}
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/ScriptLexer.h b/lld/ELF/ScriptLexer.h
index 6c8ba60eaaa83..17c0b529fa176 100644
--- a/lld/ELF/ScriptLexer.h
+++ b/lld/ELF/ScriptLexer.h
@@ -14,8 +14,7 @@
#include "llvm/Support/MemoryBufferRef.h"
#include <vector>
-namespace lld {
-namespace elf {
+namespace lld::elf {
class ScriptLexer {
public:
@@ -52,7 +51,6 @@ class ScriptLexer {
size_t getColumnNumber();
};
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/ScriptParser.h b/lld/ELF/ScriptParser.h
index cd3971f1c0c56..34b27d2b4787c 100644
--- a/lld/ELF/ScriptParser.h
+++ b/lld/ELF/ScriptParser.h
@@ -12,8 +12,7 @@
#include "lld/Common/LLVM.h"
#include "llvm/Support/MemoryBufferRef.h"
-namespace lld {
-namespace elf {
+namespace lld::elf {
// Parses a linker script. Calling this function updates
// lld::elf::config and lld::elf::script.
@@ -29,7 +28,6 @@ void readDefsym(StringRef name, MemoryBufferRef mb);
bool hasWildcard(StringRef s);
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h
index 5cc0eae87bb9a..142ec7186a53f 100644
--- a/lld/ELF/SymbolTable.h
+++ b/lld/ELF/SymbolTable.h
@@ -13,8 +13,7 @@
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/DenseMap.h"
-namespace lld {
-namespace elf {
+namespace lld::elf {
class InputFile;
class SharedFile;
@@ -86,7 +85,6 @@ class SymbolTable {
extern std::unique_ptr<SymbolTable> symtab;
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index 215d1ae644cb3..8b29cbb9c3855 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -28,8 +28,7 @@
#include "llvm/Support/Endian.h"
#include "llvm/Support/Threading.h"
-namespace lld {
-namespace elf {
+namespace lld::elf {
class Defined;
struct PhdrEntry;
class SymbolTableBaseSection;
@@ -1267,7 +1266,6 @@ struct InStruct {
extern InStruct in;
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/Thunks.h b/lld/ELF/Thunks.h
index 5558da1a2c797..86aaee15f93bb 100644
--- a/lld/ELF/Thunks.h
+++ b/lld/ELF/Thunks.h
@@ -12,8 +12,7 @@
#include "llvm/ADT/SmallVector.h"
#include "Relocations.h"
-namespace lld {
-namespace elf {
+namespace lld::elf {
class Defined;
class InputFile;
class Symbol;
@@ -78,7 +77,6 @@ static inline uint16_t computeHiBits(uint32_t toCompute) {
return (toCompute + 0x8000) >> 16;
}
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
diff --git a/lld/ELF/Writer.h b/lld/ELF/Writer.h
index c79be8b0db249..a302caad339f6 100644
--- a/lld/ELF/Writer.h
+++ b/lld/ELF/Writer.h
@@ -13,8 +13,7 @@
#include "llvm/ADT/StringRef.h"
#include <cstdint>
-namespace lld {
-namespace elf {
+namespace lld::elf {
class InputFile;
class OutputSection;
void copySectionsIntoPartitions();
@@ -56,7 +55,6 @@ uint8_t getMipsFpAbiFlag(uint8_t oldFlag, uint8_t newFlag,
bool isMipsN32Abi(const InputFile *f);
bool isMicroMips();
bool isMipsR6();
-} // namespace elf
-} // namespace lld
+} // namespace lld::elf
#endif
More information about the llvm-commits
mailing list