[llvm-commits] [llvm] r142314 - in /llvm/trunk: include/llvm/Object/COFF.h include/llvm/Object/MachO.h lib/Object/ELFObjectFile.cpp
Michael J. Spencer
bigcheesegs at gmail.com
Mon Oct 17 16:53:37 PDT 2011
Author: mspencer
Date: Mon Oct 17 18:53:37 2011
New Revision: 142314
URL: http://llvm.org/viewvc/llvm-project?rev=142314&view=rev
Log:
Object: Implement casting for concrete classes.
Modified:
llvm/trunk/include/llvm/Object/COFF.h
llvm/trunk/include/llvm/Object/MachO.h
llvm/trunk/lib/Object/ELFObjectFile.cpp
Modified: llvm/trunk/include/llvm/Object/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=142314&r1=142313&r2=142314&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFF.h (original)
+++ llvm/trunk/include/llvm/Object/COFF.h Mon Oct 17 18:53:37 2011
@@ -141,6 +141,12 @@
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; }
};
}
Modified: llvm/trunk/include/llvm/Object/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=142314&r1=142313&r2=142314&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachO.h (original)
+++ llvm/trunk/include/llvm/Object/MachO.h Mon Oct 17 18:53:37 2011
@@ -40,6 +40,11 @@
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;
Modified: llvm/trunk/lib/Object/ELFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ELFObjectFile.cpp?rev=142314&r1=142313&r2=142314&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ELFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/ELFObjectFile.cpp Mon Oct 17 18:53:37 2011
@@ -377,6 +377,11 @@
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
More information about the llvm-commits
mailing list