Skip to content

Commit ad30a2c

Browse files
committed
---
yaml --- r: 1654 b: refs/heads/master c: 3bbd741 h: refs/heads/master v: v3
1 parent 815f29a commit ad30a2c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 316158df8e423f6c123cf2d3349e27c2794b147b
2+
refs/heads/master: 3bbd741c2e0e9c17bb1a6406be37e6991b6d14cd

trunk/src/llvmext/Object.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
using namespace llvm;
1919
using namespace object;
2020

21-
LLVMObjectFileRef LLVMCreateObjectFile(const char *ObjectPath) {
22-
StringRef SR(ObjectPath);
23-
return wrap(ObjectFile::createObjectFile(SR));
21+
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf) {
22+
return wrap(ObjectFile::createObjectFile(unwrap(MemBuf)));
2423
}
2524

2625
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile) {
@@ -36,9 +35,14 @@ void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI) {
3635
delete unwrap(SI);
3736
}
3837

38+
bool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile,
39+
LLVMSectionIteratorRef SI) {
40+
return *unwrap(SI) == unwrap(ObjectFile)->end_sections();
41+
}
42+
3943
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI) {
40-
ObjectFile::section_iterator UnwrappedSI = *unwrap(SI);
41-
++UnwrappedSI;
44+
// We can't use unwrap() here because the argument to ++ must be an lvalue.
45+
++*reinterpret_cast<ObjectFile::section_iterator*>(SI);
4246
}
4347

4448
const char *LLVMGetSectionName(LLVMSectionIteratorRef SI) {

trunk/src/llvmext/include/llvm-c/Object.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef;
3333

3434
typedef struct LLVMOpaqueSectionIterator *LLVMSectionIteratorRef;
3535

36-
LLVMObjectFileRef LLVMCreateObjectFile(const char *ObjectPath);
36+
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf);
3737
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile);
3838

3939
LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile);
4040
void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI);
41+
bool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile,
42+
LLVMSectionIteratorRef SI);
4143
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI);
4244
const char *LLVMGetSectionName(LLVMSectionIteratorRef SI);
4345
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI);

0 commit comments

Comments
 (0)