//===-- Core.cpp ----------------------------------------------------------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file implements the C bindings for libLLVMCore.a, which implements// the LLVM intermediate representation.////===----------------------------------------------------------------------===//#include"llvm-c/Core.h"#include"llvm/Bitcode/ReaderWriter.h"#include"llvm/Constants.h"#include"llvm/DerivedTypes.h"#include"llvm/GlobalVariable.h"#include"llvm/TypeSymbolTable.h"#include"llvm/ModuleProvider.h"#include"llvm/Support/MemoryBuffer.h"#include"llvm/Support/CallSite.h"#include<cassert>#include<cstdlib>#include<cstring>usingnamespacellvm;/*===-- Error handling ----------------------------------------------------===*/voidLLVMDisposeMessage(char*Message){free(Message);}/*===-- Operations on modules ---------------------------------------------===*/LLVMModuleRefLLVMModuleCreateWithName(constchar*ModuleID){returnwrap(newModule(ModuleID));}voidLLVMDisposeModule(LLVMModuleRefM){deleteunwrap(M);}/*--.. Data layout .........................................................--*/constchar*LLVMGetDataLayout(LLVMModuleRefM){returnunwrap(M)->getDataLayout().c_str();}voidLLVMSetDataLayout(LLVMModuleRefM,constchar*Triple){unwrap(M)->setDataLayout(Triple);}/*--.. Target triple .......................................................--*/constchar*LLVMGetTarget(LLVMModuleRefM){returnunwrap(M)->getTargetTriple().c_str();}voidLLVMSetTarget(LLVMModuleRefM,constchar*Triple){unwrap(M)->setTarget