summaryrefslogtreecommitdiff
path: root/lib/Object/Object.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2011-10-27 17:15:47 +0000
committerOwen Anderson <resistor@mac.com>2011-10-27 17:15:47 +0000
commitd8b0b915c5a94806596c381660c548aabef447b2 (patch)
tree971799b33c52c21c0ef904f27c2422f60e3e3907 /lib/Object/Object.cpp
parentbc1430a0a0b3f97b86039950e57d832cb01f1cf6 (diff)
downloadllvm-d8b0b915c5a94806596c381660c548aabef447b2.tar.gz
llvm-d8b0b915c5a94806596c381660c548aabef447b2.tar.bz2
llvm-d8b0b915c5a94806596c381660c548aabef447b2.tar.xz
Add relocation iterators to the libObject C API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object/Object.cpp')
-rw-r--r--lib/Object/Object.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Object/Object.cpp b/lib/Object/Object.cpp
index dea1466f0b..a404cb3013 100644
--- a/lib/Object/Object.cpp
+++ b/lib/Object/Object.cpp
@@ -112,6 +112,29 @@ LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI,
return ret;
}
+// Section Relocation iterators
+LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section) {
+ relocation_iterator SI = (*unwrap(Section))->begin_relocations();
+ return wrap(new relocation_iterator(SI));
+}
+
+void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef SI) {
+ delete unwrap(SI);
+}
+
+LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section,
+ LLVMRelocationIteratorRef SI) {
+ return (*unwrap(SI) == (*unwrap(Section))->end_relocations()) ? 1 : 0;
+}
+
+void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef SI) {
+ error_code ec;
+ unwrap(SI)->increment(ec);
+ if (ec) report_fatal_error("LLVMMoveToNextRelocation failed: " +
+ ec.message());
+}
+
+
// SymbolRef accessors
const char *LLVMGetSymbolName(LLVMSymbolIteratorRef SI) {
StringRef ret;