summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/File.h
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2016-01-14 22:55:38 +0000
committerPete Cooper <peter_cooper@apple.com>2016-01-14 22:55:38 +0000
commitf0c0f3c4777399f990c9495c8779ce9b20d84ab2 (patch)
tree5d6c8904f187f4bbff22c5e92ba61462066f45f1 /lld/lib/ReaderWriter/MachO/File.h
parentaa1f270151d6c4f4089960ead052830aa3572e2d (diff)
downloadbcm5719-llvm-f0c0f3c4777399f990c9495c8779ce9b20d84ab2.tar.gz
bcm5719-llvm-f0c0f3c4777399f990c9495c8779ce9b20d84ab2.zip
Add File::kind's for all subclasses of File.
This is to enable isa<> support for any files which need it. It will be used in an upcoming patch to differentiate MachOFile from other implicitly generated files. Reviewed by Lang Hames. Differential Revision: http://reviews.llvm.org/D16103 llvm-svn: 257830
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/File.h')
-rw-r--r--lld/lib/ReaderWriter/MachO/File.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/MachO/File.h b/lld/lib/ReaderWriter/MachO/File.h
index c97dfa142b8..f283a8f4533 100644
--- a/lld/lib/ReaderWriter/MachO/File.h
+++ b/lld/lib/ReaderWriter/MachO/File.h
@@ -25,9 +25,10 @@ using lld::mach_o::normalized::Section;
class MachOFile : public SimpleFile {
public:
MachOFile(std::unique_ptr<MemoryBuffer> mb, MachOLinkingContext *ctx)
- : SimpleFile(mb->getBufferIdentifier()), _mb(std::move(mb)), _ctx(ctx) {}
+ : SimpleFile(mb->getBufferIdentifier(), File::kindMachObject),
+ _mb(std::move(mb)), _ctx(ctx) {}
- MachOFile(StringRef path) : SimpleFile(path) {}
+ MachOFile(StringRef path) : SimpleFile(path, File::kindMachObject) {}
void addDefinedAtom(StringRef name, Atom::Scope scope,
DefinedAtom::ContentType type, DefinedAtom::Merge merge,
@@ -187,6 +188,11 @@ public:
visitor(offAndAtom.atom, offAndAtom.offset);
}
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const File *F) {
+ return F->kind() == File::kindMachObject;
+ }
+
protected:
std::error_code doParse() override {
// Convert binary file to normalized mach-o.
OpenPOWER on IntegriCloud