[lld/mac] Use C++17 nested namespace syntax in most places

Some header files used

    namespace lld {
    namespace macho {
    // ...
    } // namespace macho
    std::string toString(const Type &t);
    } // namespace lld

In those files, I didn't use a nested namespace since it's not a big win there.

No behavior change.

Differential Revision: https://reviews.llvm.org/D131354
This commit is contained in:
Nico Weber 2022-08-07 10:37:49 -04:00
parent ab4fc87a9d
commit bf20d43f82
22 changed files with 46 additions and 94 deletions

View File

@ -16,8 +16,7 @@
#include "llvm/BinaryFormat/MachO.h"
namespace lld {
namespace macho {
namespace lld::macho {
struct ARM64Common : TargetInfo {
template <class LP> ARM64Common(LP lp) : TargetInfo(lp) {}
@ -148,7 +147,6 @@ inline void writeStubHelperEntry(uint8_t *buf8,
buf32[2] = sym.lazyBindOffset;
}
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -15,8 +15,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
namespace lld {
namespace macho {
namespace lld::macho {
class Defined;
@ -109,7 +108,6 @@ extern llvm::MapVector<NamePair, ConcatOutputSection *> concatOutputSections;
extern llvm::DenseMap<Symbol *, ThunkInfo> thunkMap;
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -20,8 +20,7 @@
#include <set>
#include <type_traits>
namespace lld {
namespace macho {
namespace lld::macho {
class DylibFile;
class InputFile;
@ -111,7 +110,6 @@ private:
extern std::unique_ptr<DependencyTracker> depTracker;
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -12,8 +12,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/DWARF/DWARFObject.h"
namespace lld {
namespace macho {
namespace lld::macho {
class ObjFile;
@ -57,7 +56,6 @@ private:
llvm::StringRef strSection;
};
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -50,8 +50,7 @@
* 5. (Optional) LSDA address (pointer-sized pcrel offset)
* 6. DWARF instructions (ignored by LLD)
*/
namespace lld {
namespace macho {
namespace lld::macho {
class EhReader {
public:
@ -112,7 +111,6 @@ private:
SmallVector<Reloc, 6> newRelocs;
};
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -14,8 +14,7 @@
#include <vector>
namespace lld {
namespace macho {
namespace lld::macho {
struct TrieNode;
class Symbol;
@ -44,7 +43,6 @@ using TrieEntryCallback =
void parseTrie(const uint8_t *buf, size_t size, const TrieEntryCallback &);
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -13,15 +13,13 @@
#include "lld/Common/LLVM.h"
#include <vector>
namespace lld {
namespace macho {
namespace lld::macho {
class Symbol;
void markAddrSigSymbols();
void markSymAsAddrSig(Symbol *s);
void foldIdenticalSections(bool onlyCfStrings);
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -14,14 +14,11 @@
#include <memory>
#include <vector>
namespace llvm {
namespace lto {
namespace llvm::lto {
class LTO;
} // namespace lto
} // namespace llvm
} // namespace llvm::lto
namespace lld {
namespace macho {
namespace lld::macho {
class BitcodeFile;
class ObjFile;
@ -39,7 +36,6 @@ private:
std::vector<std::unique_ptr<llvm::MemoryBuffer>> files;
};
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -17,9 +17,7 @@
#include "llvm/Support/Endian.h"
namespace lld {
namespace structs {
namespace lld::structs {
struct nlist_64 {
llvm::support::ulittle32_t n_strx;
@ -44,8 +42,6 @@ struct entry_point_command {
llvm::support::ulittle64_t stacksize;
};
} // namespace structs
} // namespace lld
} // namespace lld::structs
#endif

View File

@ -9,10 +9,8 @@
#ifndef LLD_MACHO_MAPFILE_H
#define LLD_MACHO_MAPFILE_H
namespace lld {
namespace macho {
namespace lld::macho {
void writeMapFile();
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -15,8 +15,7 @@
#include "mach-o/compact_unwind_encoding.h"
#include "llvm/Support/TimeProfiler.h"
namespace lld {
namespace macho {
namespace lld::macho {
using namespace llvm;
using namespace llvm::MachO;
@ -288,5 +287,4 @@ void markLive() {
marker->markTransitively();
}
} // namespace macho
} // namespace lld
} // namespace lld::macho

View File

@ -9,12 +9,10 @@
#ifndef LLD_MACHO_MARKLIVE_H
#define LLD_MACHO_MARKLIVE_H
namespace lld {
namespace macho {
namespace lld::macho {
void markLive();
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif // LLD_MACHO_MARKLIVE_H

View File

@ -11,8 +11,7 @@
#include "llvm/Support/MemoryBuffer.h"
namespace lld {
namespace macho {
namespace lld::macho {
namespace objc {
@ -25,7 +24,6 @@ constexpr const char ivar[] = "_OBJC_IVAR_$_";
bool hasObjCSection(llvm::MemoryBufferRef);
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -16,8 +16,7 @@
#include <limits>
namespace lld {
namespace macho {
namespace lld::macho {
class Defined;
class InputSection;
@ -98,7 +97,6 @@ private:
Kind sectionKind;
};
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -17,8 +17,7 @@
#include <limits>
#include <vector>
namespace lld {
namespace macho {
namespace lld::macho {
namespace segment_names {
@ -72,7 +71,6 @@ void resetOutputSegments();
OutputSegment *getOrCreateOutputSegment(StringRef name);
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -17,8 +17,7 @@
#include <cstddef>
#include <cstdint>
namespace lld {
namespace macho {
namespace lld::macho {
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
class Symbol;
@ -124,7 +123,6 @@ inline void writeAddress(uint8_t *loc, uint64_t addr, uint8_t length) {
extern const RelocAttrs invalidRelocAttrs;
} // namespace macho
} // namespace lld
} // namespace lld::Macho
#endif

View File

@ -12,8 +12,7 @@
#include "InputSection.h"
#include "llvm/ADT/DenseMap.h"
namespace lld {
namespace macho {
namespace lld::macho {
using SectionPair = std::pair<const InputSection *, const InputSection *>;
@ -76,7 +75,6 @@ private:
};
extern PriorityBuilder priorityBuilder;
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -16,8 +16,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/Object/Archive.h"
namespace lld {
namespace macho {
namespace lld::macho {
class ArchiveFile;
class DylibFile;
@ -80,7 +79,6 @@ void treatUndefinedSymbol(const Undefined &, const InputSection *,
extern std::unique_ptr<SymbolTable> symtab;
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -31,8 +31,7 @@ namespace llvm {
class DWARFUnit;
} // namespace llvm
namespace lld {
namespace macho {
namespace lld::macho {
class Defined;
class DylibSymbol;
@ -645,7 +644,6 @@ extern std::vector<SyntheticSection *> syntheticSections;
void createSyntheticSymbols();
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -20,8 +20,7 @@
#include <cstddef>
#include <cstdint>
namespace lld {
namespace macho {
namespace lld::macho {
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
class Symbol;
@ -164,7 +163,6 @@ struct ILP32 {
extern TargetInfo *target;
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -15,8 +15,7 @@
#include "mach-o/compact_unwind_encoding.h"
namespace lld {
namespace macho {
namespace lld::macho {
class UnwindInfoSection : public SyntheticSection {
public:
@ -37,7 +36,6 @@ protected:
UnwindInfoSection *makeUnwindInfoSection();
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif

View File

@ -11,8 +11,7 @@
#include <cstdint>
namespace lld {
namespace macho {
namespace lld::macho {
class OutputSection;
class InputSection;
@ -36,7 +35,6 @@ void addNonLazyBindingEntries(const Symbol *, const InputSection *,
extern OutputSection *firstTLVDataSection;
} // namespace macho
} // namespace lld
} // namespace lld::macho
#endif