[PATCH] D68323: [ELF] Wrap things in `namespace lld { namespace elf {`, NFC

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 21:59:57 PDT 2019


MaskRay added a comment.

In D68323#1694029 <https://reviews.llvm.org/D68323#1694029>, @ruiu wrote:

> Yeah, I'm fine with quoting the entire file with the namespaces, but I'm not entirely happy about adding `endian::` to read32. Looks like the problem is that we use the same name for two functions. Can you just rename one to avoid the name collision? Does that make the code look simpler?


Adding `endian::` is due to the rule of unqualified name lookup. Renaming either family of functions below will cause the change of hundreds of call sites changes.

  llvm::support::endian::write32 and its friends
  lld::elf::write32 and its friends

`llvm::support::endian::*` is used in very few files. And as this patch suggests, only Mips.cpp needs `endian::*`. I think this change clarifies things without making code more complex.


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68323/new/

https://reviews.llvm.org/D68323





More information about the llvm-commits mailing list