summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
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
commite245af65fa28cb88cb533f49d3755d034b252e88 (patch)
tree68b2f3a69d8a10727f33b51df676dfb97e682e7b /llvm/lib/Object
parent2aed4393b86314f31488609d803a5525d1e0cf88 (diff)
downloadbcm5719-llvm-e245af65fa28cb88cb533f49d3755d034b252e88.tar.gz
bcm5719-llvm-e245af65fa28cb88cb533f49d3755d034b252e88.zip
Add relocation iterators to the libObject C API.
llvm-svn: 143107
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/Object.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Object/Object.cpp b/llvm/lib/Object/Object.cpp
index dea1466f0ba..a404cb30133 100644
--- a/llvm/lib/Object/Object.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud