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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 22:08:10 PDT 2020


MaskRay created this revision.
MaskRay added a reviewer: lld-macho.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82432

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


Index: lld/MachO/SyntheticSections.cpp
===================================================================
--- lld/MachO/SyntheticSections.cpp
+++ lld/MachO/SyntheticSections.cpp
@@ -25,9 +25,11 @@
 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 @@
     off += str.size() + 1; // account for null terminator
   }
 }
-
-InStruct in;
-std::vector<SyntheticSection *> syntheticSections;
-
-} // namespace macho
-} // namespace lld
Index: lld/MachO/ExportTrie.cpp
===================================================================
--- lld/MachO/ExportTrie.cpp
+++ lld/MachO/ExportTrie.cpp
@@ -64,10 +64,7 @@
 
 } // 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 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82432.272909.patch
Type: text/x-patch
Size: 1601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200624/bdc383ba/attachment.bin>


More information about the llvm-commits mailing list