diff options
author | Puyan Lotfi <puyan@puyan.org> | 2018-07-18 00:10:51 +0000 |
---|---|---|
committer | Puyan Lotfi <puyan@puyan.org> | 2018-07-18 00:10:51 +0000 |
commit | 0f5d5fae93404357c84d7d1b96fddb022c093d49 (patch) | |
tree | ccab0aeb854eba51deb6b8b228b067f2a8bf26ae /llvm/tools/llvm-objcopy/llvm-objcopy.cpp | |
parent | 35c6996b689fd6858bdf9e5a6240c32ad4eccec1 (diff) | |
download | bcm5719-llvm-0f5d5fae93404357c84d7d1b96fddb022c093d49.tar.gz bcm5719-llvm-0f5d5fae93404357c84d7d1b96fddb022c093d49.zip |
[NFC][llvm-objcopy] Cleanup namespace usage in llvm-objcopy.
Nest any classes not used outside of a file into anon. Nest any classes used
across files in llvm-objcopy into namespace llvm::objcopy.
Differential Revision: https://reviews.llvm.org/D49449
llvm-svn: 337337
Diffstat (limited to 'llvm/tools/llvm-objcopy/llvm-objcopy.cpp')
-rw-r--r-- | llvm/tools/llvm-objcopy/llvm-objcopy.cpp | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp index b4c579c20d9..12e9ca17e19 100644 --- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp @@ -43,6 +43,7 @@ #include <utility> using namespace llvm; +using namespace llvm::objcopy; using namespace object; using namespace ELF; @@ -114,35 +115,6 @@ public: StripOptTable() : OptTable(StripInfoTable, true) {} }; -} // namespace - -// The name this program was invoked as. -static StringRef ToolName; - -namespace llvm { - -LLVM_ATTRIBUTE_NORETURN void error(Twine Message) { - errs() << ToolName << ": " << Message << ".\n"; - errs().flush(); - exit(1); -} - -LLVM_ATTRIBUTE_NORETURN void reportError(StringRef File, std::error_code EC) { - assert(EC); - errs() << ToolName << ": '" << File << "': " << EC.message() << ".\n"; - exit(1); -} - -LLVM_ATTRIBUTE_NORETURN void reportError(StringRef File, Error E) { - assert(E); - std::string Buf; - raw_string_ostream OS(Buf); - logAllUnhandledErrors(std::move(E), OS, ""); - OS.flush(); - errs() << ToolName << ": '" << File << "': " << Buf; - exit(1); -} - struct CopyConfig { StringRef OutputFilename; StringRef InputFilename; @@ -179,6 +151,37 @@ struct CopyConfig { using SectionPred = std::function<bool(const SectionBase &Sec)>; +} // namespace + +namespace llvm { +namespace objcopy { + +// The name this program was invoked as. +StringRef ToolName; + +LLVM_ATTRIBUTE_NORETURN void error(Twine Message) { + errs() << ToolName << ": " << Message << ".\n"; + errs().flush(); + exit(1); +} + +LLVM_ATTRIBUTE_NORETURN void reportError(StringRef File, std::error_code EC) { + assert(EC); + errs() << ToolName << ": '" << File << "': " << EC.message() << ".\n"; + exit(1); +} + +LLVM_ATTRIBUTE_NORETURN void reportError(StringRef File, Error E) { + assert(E); + std::string Buf; + raw_string_ostream OS(Buf); + logAllUnhandledErrors(std::move(E), OS, ""); + OS.flush(); + errs() << ToolName << ": '" << File << "': " << Buf; + exit(1); +} + +} // end namespace objcopy } // end namespace llvm static bool IsDWOSection(const SectionBase &Sec) { |