summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-04-22 22:47:22 +0000
committerEric Christopher <echristo@gmail.com>2013-04-22 22:47:22 +0000
commit04d4e9312c69ef1fa4896e9289beeb3e763e7415 (patch)
treec198830379abfddf31ebde3cecadd3a343a8d4a5 /llvm/lib/Object
parentebeabab9a9b61b34439fbc243f4e1aab640440b6 (diff)
downloadbcm5719-llvm-04d4e9312c69ef1fa4896e9289beeb3e763e7415.tar.gz
bcm5719-llvm-04d4e9312c69ef1fa4896e9289beeb3e763e7415.zip
Move C++ code out of the C headers and into either C++ headers
or the C++ files themselves. This enables people to use just a C compiler to interoperate with LLVM. llvm-svn: 180063
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/Object.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/lib/Object/Object.cpp b/llvm/lib/Object/Object.cpp
index f061ea7cebe..ea641a4831c 100644
--- a/llvm/lib/Object/Object.cpp
+++ b/llvm/lib/Object/Object.cpp
@@ -14,10 +14,49 @@
#include "llvm/Object/ObjectFile.h"
#include "llvm-c/Object.h"
+#include "llvm/Wrap.h"
using namespace llvm;
using namespace object;
+inline ObjectFile *unwrap(LLVMObjectFileRef OF) {
+ return reinterpret_cast<ObjectFile*>(OF);
+}
+
+inline LLVMObjectFileRef wrap(const ObjectFile *OF) {
+ return reinterpret_cast<LLVMObjectFileRef>(const_cast<ObjectFile*>(OF));
+}
+
+inline section_iterator *unwrap(LLVMSectionIteratorRef SI) {
+ return reinterpret_cast<section_iterator*>(SI);
+}
+
+inline LLVMSectionIteratorRef
+wrap(const section_iterator *SI) {
+ return reinterpret_cast<LLVMSectionIteratorRef>
+ (const_cast<section_iterator*>(SI));
+}
+
+inline symbol_iterator *unwrap(LLVMSymbolIteratorRef SI) {
+ return reinterpret_cast<symbol_iterator*>(SI);
+}
+
+inline LLVMSymbolIteratorRef
+wrap(const symbol_iterator *SI) {
+ return reinterpret_cast<LLVMSymbolIteratorRef>
+ (const_cast<symbol_iterator*>(SI));
+}
+
+inline relocation_iterator *unwrap(LLVMRelocationIteratorRef SI) {
+ return reinterpret_cast<relocation_iterator*>(SI);
+}
+
+inline LLVMRelocationIteratorRef
+wrap(const relocation_iterator *SI) {
+ return reinterpret_cast<LLVMRelocationIteratorRef>
+ (const_cast<relocation_iterator*>(SI));
+}
+
// ObjectFile creation
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf) {
return wrap(ObjectFile::createObjectFile(unwrap(MemBuf)));
OpenPOWER on IntegriCloud