[lld] 18db086 - [lld-macho] Use namespace qualifiers (macho::) instead of `namespace lld { namespace macho {`

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 24 12:34:16 PDT 2020


Author: Fangrui Song
Date: 2020-06-24T12:34:06-07:00
New Revision: 18db086dca8d3bc2a7f380e6164b44c40890712d

URL: https://github.com/llvm/llvm-project/commit/18db086dca8d3bc2a7f380e6164b44c40890712d
DIFF: https://github.com/llvm/llvm-project/commit/18db086dca8d3bc2a7f380e6164b44c40890712d.diff

LOG: [lld-macho] Use namespace qualifiers (macho::) instead of `namespace lld { namespace macho {`

See https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions
Similar to D79982.

Reviewed By: #lld-macho, int3

Differential Revision: https://reviews.llvm.org/D82432

Added: 
    

Modified: 
    lld/MachO/ExportTrie.cpp
    lld/MachO/SyntheticSections.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/ExportTrie.cpp b/lld/MachO/ExportTrie.cpp
index de8b42d73281..7cc81bcfd5f1 100644
--- a/lld/MachO/ExportTrie.cpp
+++ b/lld/MachO/ExportTrie.cpp
@@ -64,10 +64,7 @@ struct ExportInfo {
 
 } // namespace
 
-namespace lld {
-namespace macho {
-
-struct TrieNode {
+struct macho::TrieNode {
   std::vector<Edge> edges;
   Optional<ExportInfo> info;
   // Estimated offset from the start of the serialized trie to the current node.
@@ -277,13 +274,10 @@ void TrieParser::parse(const uint8_t *buf, const Twine &cumulativeString) {
   }
 }
 
-void parseTrie(const uint8_t *buf, size_t size,
-               const TrieEntryCallback &callback) {
+void macho::parseTrie(const uint8_t *buf, size_t size,
+                      const TrieEntryCallback &callback) {
   if (size == 0)
     return;
 
   TrieParser(buf, size, callback).parse();
 }
-
-} // namespace macho
-} // namespace lld

diff  --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 1747cda5a57d..21471ec9ea27 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -25,9 +25,11 @@ using namespace llvm;
 using namespace llvm::MachO;
 using namespace llvm::support;
 using namespace llvm::support::endian;
+using namespace lld;
+using namespace lld::macho;
 
-namespace lld {
-namespace macho {
+InStruct macho::in;
+std::vector<SyntheticSection *> macho::syntheticSections;
 
 SyntheticSection::SyntheticSection(const char *segname, const char *name)
     : OutputSection(SyntheticKind, name), segname(segname) {
@@ -345,9 +347,3 @@ void StringTableSection::writeTo(uint8_t *buf) const {
     off += str.size() + 1; // account for null terminator
   }
 }
-
-InStruct in;
-std::vector<SyntheticSection *> syntheticSections;
-
-} // namespace macho
-} // namespace lld


        


More information about the llvm-commits mailing list