Bind libObject API for obtaining the section containing a Symbol.
authorOwen Anderson <resistor@mac.com>
Fri, 21 Oct 2011 18:21:22 +0000 (18:21 +0000)
committerOwen Anderson <resistor@mac.com>
Fri, 21 Oct 2011 18:21:22 +0000 (18:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142667 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm-c/Object.h
lib/Object/Object.cpp

index 3e6e1e3ffce003067f76b5ff7a6f2fc53c2b3e41..6acad85c55a14b0bbd7b8ddf5407c5208ebe8814 100644 (file)
@@ -43,6 +43,8 @@ void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI);
 LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile,
                                 LLVMSectionIteratorRef SI);
 void LLVMMoveToNextSection(LLVMSectionIteratorRef SI);
+void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect,
+                                 LLVMSymbolIteratorRef Sym);
 
 // ObjectFile Symbol iterators
 LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef ObjectFile);
index 2ce98d7f9ca9c60b20bf24cd5e30094aef82b86e..638105b56b374effc3271bb76758e2c364a45968 100644 (file)
@@ -48,6 +48,12 @@ void LLVMMoveToNextSection(LLVMSectionIteratorRef SI) {
   if (ec) report_fatal_error("LLVMMoveToNextSection failed: " + ec.message());
 }
 
+void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect,
+                                 LLVMSymbolIteratorRef Sym) {
+  if (error_code ec = (*unwrap(Sym))->getSection(*unwrap(Sect)))
+    report_fatal_error(ec.message());
+}
+
 // ObjectFile Symbol iterators
 LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef ObjectFile) {
   symbol_iterator SI = unwrap(ObjectFile)->begin_symbols();