mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180063 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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)));
|
||||
|
Reference in New Issue
Block a user