Object: Implement casting for concrete classes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142314 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael J. Spencer 2011-10-17 23:53:37 +00:00
parent 7c81013c45
commit ab6bcf35ae
3 changed files with 16 additions and 0 deletions

View File

@ -141,6 +141,12 @@ public:
virtual uint8_t getBytesInAddress() const;
virtual StringRef getFileFormatName() const;
virtual unsigned getArch() const;
static inline bool classof(const Binary *v) {
return v->getType() == isCOFF;
}
static inline bool classof(const COFFObjectFile *v) { return true; }
};
}

View File

@ -40,6 +40,11 @@ public:
MachOObject *getObject() { return MachOObj; }
static inline bool classof(const Binary *v) {
return v->getType() == isMachO;
}
static inline bool classof(const MachOObjectFile *v) { return true; }
protected:
virtual error_code getSymbolNext(DataRefImpl Symb, SymbolRef &Res) const;
virtual error_code getSymbolName(DataRefImpl Symb, StringRef &Res) const;

View File

@ -377,6 +377,11 @@ public:
uint64_t getStringTableIndex() const;
ELF::Elf64_Word getSymbolTableIndex(const Elf_Sym *symb) const;
const Elf_Shdr *getSection(const Elf_Sym *symb) const;
static inline bool classof(const Binary *v) {
return v->getType() == isELF;
}
static inline bool classof(const ELFObjectFile *v) { return true; }
};
} // end namespace