mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 21:00:29 +00:00
[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
This commit is contained in:
parent
fb87d54a09
commit
e6a54bf29b
@ -27,6 +27,7 @@
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::objcopy;
|
||||
using namespace object;
|
||||
using namespace ELF;
|
||||
|
||||
@ -1387,6 +1388,7 @@ void BinaryWriter::finalize() {
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
namespace objcopy {
|
||||
|
||||
template class ELFBuilder<ELF64LE>;
|
||||
template class ELFBuilder<ELF64BE>;
|
||||
@ -1397,4 +1399,5 @@ template class ELFWriter<ELF64LE>;
|
||||
template class ELFWriter<ELF64BE>;
|
||||
template class ELFWriter<ELF32LE>;
|
||||
template class ELFWriter<ELF32BE>;
|
||||
} // end namespace objcopy
|
||||
} // end namespace llvm
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace objcopy {
|
||||
|
||||
class Buffer;
|
||||
class SectionBase;
|
||||
@ -714,6 +715,7 @@ public:
|
||||
return *Segments.back();
|
||||
}
|
||||
};
|
||||
} // end namespace objcopy
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_TOOLS_OBJCOPY_OBJECT_H
|
||||
|
@ -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) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <string>
|
||||
|
||||
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 @@ template <class T> T unwrapOrError(Expected<T> EO) {
|
||||
error(Buf);
|
||||
}
|
||||
|
||||
} // end namespace objcopy
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_TOOLS_OBJCOPY_OBJCOPY_H
|
||||
|
Loading…
Reference in New Issue
Block a user