llvmext: Make the Object bindings actually work
This commit is contained in:
parent
316158df8e
commit
3bbd741c2e
@ -18,9 +18,8 @@
|
||||
using namespace llvm;
|
||||
using namespace object;
|
||||
|
||||
LLVMObjectFileRef LLVMCreateObjectFile(const char *ObjectPath) {
|
||||
StringRef SR(ObjectPath);
|
||||
return wrap(ObjectFile::createObjectFile(SR));
|
||||
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf) {
|
||||
return wrap(ObjectFile::createObjectFile(unwrap(MemBuf)));
|
||||
}
|
||||
|
||||
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile) {
|
||||
@ -36,9 +35,14 @@ void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI) {
|
||||
delete unwrap(SI);
|
||||
}
|
||||
|
||||
bool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile,
|
||||
LLVMSectionIteratorRef SI) {
|
||||
return *unwrap(SI) == unwrap(ObjectFile)->end_sections();
|
||||
}
|
||||
|
||||
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI) {
|
||||
ObjectFile::section_iterator UnwrappedSI = *unwrap(SI);
|
||||
++UnwrappedSI;
|
||||
// We can't use unwrap() here because the argument to ++ must be an lvalue.
|
||||
++*reinterpret_cast<ObjectFile::section_iterator*>(SI);
|
||||
}
|
||||
|
||||
const char *LLVMGetSectionName(LLVMSectionIteratorRef SI) {
|
||||
|
@ -33,11 +33,13 @@ typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef;
|
||||
|
||||
typedef struct LLVMOpaqueSectionIterator *LLVMSectionIteratorRef;
|
||||
|
||||
LLVMObjectFileRef LLVMCreateObjectFile(const char *ObjectPath);
|
||||
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf);
|
||||
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile);
|
||||
|
||||
LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile);
|
||||
void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI);
|
||||
bool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile,
|
||||
LLVMSectionIteratorRef SI);
|
||||
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI);
|
||||
const char *LLVMGetSectionName(LLVMSectionIteratorRef SI);
|
||||
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI);
|
||||
|
Loading…
x
Reference in New Issue
Block a user