Index: llvm/trunk/tools/llvm-objcopy/Object.h =================================================================== --- llvm/trunk/tools/llvm-objcopy/Object.h +++ llvm/trunk/tools/llvm-objcopy/Object.h @@ -26,6 +26,7 @@ #include namespace llvm { +namespace objcopy { class Buffer; class SectionBase; @@ -714,6 +715,7 @@ return *Segments.back(); } }; +} // end namespace objcopy } // end namespace llvm #endif // LLVM_TOOLS_OBJCOPY_OBJECT_H Index: llvm/trunk/tools/llvm-objcopy/Object.cpp =================================================================== --- llvm/trunk/tools/llvm-objcopy/Object.cpp +++ llvm/trunk/tools/llvm-objcopy/Object.cpp @@ -27,6 +27,7 @@ #include using namespace llvm; +using namespace llvm::objcopy; using namespace object; using namespace ELF; @@ -1387,6 +1388,7 @@ } namespace llvm { +namespace objcopy { template class ELFBuilder; template class ELFBuilder; @@ -1397,4 +1399,5 @@ template class ELFWriter; template class ELFWriter; template class ELFWriter; +} // end namespace objcopy } // end namespace llvm Index: llvm/trunk/tools/llvm-objcopy/llvm-objcopy.h =================================================================== --- llvm/trunk/tools/llvm-objcopy/llvm-objcopy.h +++ llvm/trunk/tools/llvm-objcopy/llvm-objcopy.h @@ -17,6 +17,7 @@ #include namespace llvm { +namespace objcopy { LLVM_ATTRIBUTE_NORETURN extern void error(Twine Message); LLVM_ATTRIBUTE_NORETURN extern void reportError(StringRef File, Error E); @@ -35,6 +36,7 @@ error(Buf); } +} // end namespace objcopy } // end namespace llvm #endif // LLVM_TOOLS_OBJCOPY_OBJCOPY_H Index: llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp =================================================================== --- llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp +++ llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp @@ -43,6 +43,7 @@ #include using namespace llvm; +using namespace llvm::objcopy; using namespace object; using namespace ELF; @@ -114,35 +115,6 @@ 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 @@ using SectionPred = std::function; +} // 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) {