"In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for."

Patch by James Y Knight!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93079 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-01-09 22:27:07 +00:00
parent 95fa80af6f
commit d686c8e73f
11 changed files with 146 additions and 140 deletions

View File

@ -36,12 +36,12 @@ typedef enum {
/* Verifies that a module is valid, taking the specified action if not. /* Verifies that a module is valid, taking the specified action if not.
Optionally returns a human-readable description of any invalid constructs. Optionally returns a human-readable description of any invalid constructs.
OutMessage must be disposed with LLVMDisposeMessage. */ OutMessage must be disposed with LLVMDisposeMessage. */
int LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action, LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
char **OutMessage); char **OutMessage);
/* Verifies that a single function is valid, taking the specified action. Useful /* Verifies that a single function is valid, taking the specified action. Useful
for debugging. */ for debugging. */
int LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action); LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action);
/* Open up a ghostview window that displays the CFG of the current function. /* Open up a ghostview window that displays the CFG of the current function.
Useful for debugging. */ Useful for debugging. */

View File

@ -29,24 +29,24 @@ extern "C" {
/* Builds a module from the bitcode in the specified memory buffer, returning a /* Builds a module from the bitcode in the specified memory buffer, returning a
reference to the module via the OutModule parameter. Returns 0 on success. reference to the module via the OutModule parameter. Returns 0 on success.
Optionally returns a human-readable error message via OutMessage. */ Optionally returns a human-readable error message via OutMessage. */
int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutModule, char **OutMessage); LLVMModuleRef *OutModule, char **OutMessage);
int LLVMParseBitcodeInContext(LLVMContextRef ContextRef, LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
LLVMMemoryBufferRef MemBuf, LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutModule, char **OutMessage); LLVMModuleRef *OutModule, char **OutMessage);
/* Reads a module from the specified path, returning via the OutMP parameter /* Reads a module from the specified path, returning via the OutMP parameter
a module provider which performs lazy deserialization. Returns 0 on success. a module provider which performs lazy deserialization. Returns 0 on success.
Optionally returns a human-readable error message via OutMessage. */ Optionally returns a human-readable error message via OutMessage. */
int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf,
LLVMModuleProviderRef *OutMP, LLVMModuleProviderRef *OutMP,
char **OutMessage); char **OutMessage);
int LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef, LLVMBool LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef,
LLVMMemoryBufferRef MemBuf, LLVMMemoryBufferRef MemBuf,
LLVMModuleProviderRef *OutMP, LLVMModuleProviderRef *OutMP,
char **OutMessage); char **OutMessage);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -46,6 +46,8 @@ extern "C" {
#endif #endif
typedef int LLVMBool;
/* Opaque types. */ /* Opaque types. */
/** /**
@ -292,7 +294,7 @@ const char *LLVMGetTarget(LLVMModuleRef M);
void LLVMSetTarget(LLVMModuleRef M, const char *Triple); void LLVMSetTarget(LLVMModuleRef M, const char *Triple);
/** See Module::addTypeName. */ /** See Module::addTypeName. */
int LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty); LLVMBool LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty);
void LLVMDeleteTypeName(LLVMModuleRef M, const char *Name); void LLVMDeleteTypeName(LLVMModuleRef M, const char *Name);
LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name); LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name);
@ -355,20 +357,20 @@ LLVMTypeRef LLVMPPCFP128Type(void);
/* Operations on function types */ /* Operations on function types */
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMTypeRef *ParamTypes, unsigned ParamCount,
int IsVarArg); LLVMBool IsVarArg);
int LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy); LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy);
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy); LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy);
unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy); unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy);
void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest); void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest);
/* Operations on struct types */ /* Operations on struct types */
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
unsigned ElementCount, int Packed); unsigned ElementCount, LLVMBool Packed);
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
int Packed); LLVMBool Packed);
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy); unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest); void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
int LLVMIsPackedStruct(LLVMTypeRef StructTy); LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy);
/* Operations on array, pointer, and vector types (sequence types) */ /* Operations on array, pointer, and vector types (sequence types) */
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount); LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
@ -495,14 +497,14 @@ LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index);
LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */ LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty); /* only for int/vector */ LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty); /* only for int/vector */
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty); LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty);
int LLVMIsConstant(LLVMValueRef Val); LLVMBool LLVMIsConstant(LLVMValueRef Val);
int LLVMIsNull(LLVMValueRef Val); LLVMBool LLVMIsNull(LLVMValueRef Val);
int LLVMIsUndef(LLVMValueRef Val); LLVMBool LLVMIsUndef(LLVMValueRef Val);
LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty); LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty);
/* Operations on scalar constants */ /* Operations on scalar constants */
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
int SignExtend); LLVMBool SignExtend);
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char *Text, LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char *Text,
uint8_t Radix); uint8_t Radix);
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char *Text, LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char *Text,
@ -517,17 +519,17 @@ long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal);
/* Operations on composite constants */ /* Operations on composite constants */
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str,
unsigned Length, int DontNullTerminate); unsigned Length, LLVMBool DontNullTerminate);
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef LLVMConstStructInContext(LLVMContextRef C,
LLVMValueRef *ConstantVals, LLVMValueRef *ConstantVals,
unsigned Count, int Packed); unsigned Count, LLVMBool Packed);
LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
int DontNullTerminate); LLVMBool DontNullTerminate);
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
LLVMValueRef *ConstantVals, unsigned Length); LLVMValueRef *ConstantVals, unsigned Length);
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
int Packed); LLVMBool Packed);
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size); LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
/* Constant expressions */ /* Constant expressions */
@ -587,7 +589,7 @@ LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal,
LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal,
LLVMTypeRef ToType); LLVMTypeRef ToType);
LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType,
unsigned isSigned); LLVMBool isSigned);
LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType); LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition, LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition,
LLVMValueRef ConstantIfTrue, LLVMValueRef ConstantIfTrue,
@ -605,13 +607,13 @@ LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList,
LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant, LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
LLVMValueRef ElementValueConstant, LLVMValueRef ElementValueConstant,
unsigned *IdxList, unsigned NumIdx); unsigned *IdxList, unsigned NumIdx);
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty,
const char *AsmString, const char *Constraints, const char *AsmString, const char *Constraints,
int HasSideEffects); LLVMBool HasSideEffects, LLVMBool IsAlignStack);
/* Operations on global variables, functions, and aliases (globals) */ /* Operations on global variables, functions, and aliases (globals) */
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global); LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global);
int LLVMIsDeclaration(LLVMValueRef Global); LLVMBool LLVMIsDeclaration(LLVMValueRef Global);
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global); LLVMLinkage LLVMGetLinkage(LLVMValueRef Global);
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage); void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage);
const char *LLVMGetSection(LLVMValueRef Global); const char *LLVMGetSection(LLVMValueRef Global);
@ -631,10 +633,10 @@ LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar);
void LLVMDeleteGlobal(LLVMValueRef GlobalVar); void LLVMDeleteGlobal(LLVMValueRef GlobalVar);
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar); LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar);
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal); void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal);
int LLVMIsThreadLocal(LLVMValueRef GlobalVar); LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar);
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, int IsThreadLocal); void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal);
int LLVMIsGlobalConstant(LLVMValueRef GlobalVar); LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar);
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, int IsConstant); void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant);
/* Operations on aliases */ /* Operations on aliases */
LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee, LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
@ -674,7 +676,7 @@ void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align);
/* Operations on basic blocks */ /* Operations on basic blocks */
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB); LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB);
int LLVMValueIsBasicBlock(LLVMValueRef Val); LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val);
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val); LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val);
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB); LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB);
unsigned LLVMCountBasicBlocks(LLVMValueRef Fn); unsigned LLVMCountBasicBlocks(LLVMValueRef Fn);
@ -714,8 +716,8 @@ void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
unsigned align); unsigned align);
/* Operations on call instructions (only) */ /* Operations on call instructions (only) */
int LLVMIsTailCall(LLVMValueRef CallInst); LLVMBool LLVMIsTailCall(LLVMValueRef CallInst);
void LLVMSetTailCall(LLVMValueRef CallInst, int IsTailCall); void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall);
/* Operations on phi nodes */ /* Operations on phi nodes */
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
@ -928,11 +930,11 @@ void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP);
/*===-- Memory buffers ----------------------------------------------------===*/ /*===-- Memory buffers ----------------------------------------------------===*/
int LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path,
LLVMMemoryBufferRef *OutMemBuf, LLVMMemoryBufferRef *OutMemBuf,
char **OutMessage); char **OutMessage);
int LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf,
char **OutMessage); char **OutMessage);
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf); void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf);
@ -952,23 +954,23 @@ LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP);
/** Initializes, executes on the provided module, and finalizes all of the /** Initializes, executes on the provided module, and finalizes all of the
passes scheduled in the pass manager. Returns 1 if any of the passes passes scheduled in the pass manager. Returns 1 if any of the passes
modified the module, 0 otherwise. See llvm::PassManager::run(Module&). */ modified the module, 0 otherwise. See llvm::PassManager::run(Module&). */
int LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M); LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M);
/** Initializes all of the function passes scheduled in the function pass /** Initializes all of the function passes scheduled in the function pass
manager. Returns 1 if any of the passes modified the module, 0 otherwise. manager. Returns 1 if any of the passes modified the module, 0 otherwise.
See llvm::FunctionPassManager::doInitialization. */ See llvm::FunctionPassManager::doInitialization. */
int LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM); LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM);
/** Executes all of the function passes scheduled in the function pass manager /** Executes all of the function passes scheduled in the function pass manager
on the provided function. Returns 1 if any of the passes modified the on the provided function. Returns 1 if any of the passes modified the
function, false otherwise. function, false otherwise.
See llvm::FunctionPassManager::run(Function&). */ See llvm::FunctionPassManager::run(Function&). */
int LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F); LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F);
/** Finalizes all of the function passes scheduled in in the function pass /** Finalizes all of the function passes scheduled in in the function pass
manager. Returns 1 if any of the passes modified the module, 0 otherwise. manager. Returns 1 if any of the passes modified the module, 0 otherwise.
See llvm::FunctionPassManager::doFinalization. */ See llvm::FunctionPassManager::doFinalization. */
int LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM); LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM);
/** Frees the memory of a pass pipeline. For function pipelines, does not free /** Frees the memory of a pass pipeline. For function pipelines, does not free
the module provider. the module provider.

View File

@ -36,7 +36,7 @@ typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef;
LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty, LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty,
unsigned long long N, unsigned long long N,
int IsSigned); LLVMBool IsSigned);
LLVMGenericValueRef LLVMCreateGenericValueOfPointer(void *P); LLVMGenericValueRef LLVMCreateGenericValueOfPointer(void *P);
@ -45,7 +45,7 @@ LLVMGenericValueRef LLVMCreateGenericValueOfFloat(LLVMTypeRef Ty, double N);
unsigned LLVMGenericValueIntWidth(LLVMGenericValueRef GenValRef); unsigned LLVMGenericValueIntWidth(LLVMGenericValueRef GenValRef);
unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenVal, unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenVal,
int IsSigned); LLVMBool IsSigned);
void *LLVMGenericValueToPointer(LLVMGenericValueRef GenVal); void *LLVMGenericValueToPointer(LLVMGenericValueRef GenVal);
@ -55,18 +55,18 @@ void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal);
/*===-- Operations on execution engines -----------------------------------===*/ /*===-- Operations on execution engines -----------------------------------===*/
int LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE, LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE,
LLVMModuleProviderRef MP, LLVMModuleProviderRef MP,
char **OutError); char **OutError);
int LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp, LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
LLVMModuleProviderRef MP, LLVMModuleProviderRef MP,
char **OutError); char **OutError);
int LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT, LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
LLVMModuleProviderRef MP, LLVMModuleProviderRef MP,
unsigned OptLevel, unsigned OptLevel,
char **OutError); char **OutError);
void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE); void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE);
@ -86,12 +86,12 @@ void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F);
void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP); void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP);
int LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE, LLVMBool LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE,
LLVMModuleProviderRef MP, LLVMModuleProviderRef MP,
LLVMModuleRef *OutMod, char **OutError); LLVMModuleRef *OutMod, char **OutError);
int LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name, LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name,
LLVMValueRef *OutFn); LLVMValueRef *OutFn);
LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE); LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE);

View File

@ -26,8 +26,7 @@
extern "C" { extern "C" {
#endif #endif
enum { LLVMBigEndian, LLVMLittleEndian }; enum LLVMByteOrdering { LLVMBigEndian, LLVMLittleEndian };
typedef int LLVMByteOrdering;
typedef struct LLVMOpaqueTargetData *LLVMTargetDataRef; typedef struct LLVMOpaqueTargetData *LLVMTargetDataRef;
typedef struct LLVMStructLayout *LLVMStructLayoutRef; typedef struct LLVMStructLayout *LLVMStructLayoutRef;
@ -62,7 +61,7 @@ static inline void LLVMInitializeAllTargets() {
/** LLVMInitializeNativeTarget - The main program should call this function to /** LLVMInitializeNativeTarget - The main program should call this function to
initialize the native target corresponding to the host. This is useful initialize the native target corresponding to the host. This is useful
for JIT applications to ensure that the target gets linked in correctly. */ for JIT applications to ensure that the target gets linked in correctly. */
static inline int LLVMInitializeNativeTarget() { static inline LLVMBool LLVMInitializeNativeTarget() {
/* If we have a native target, initialize it to ensure it is linked in. */ /* If we have a native target, initialize it to ensure it is linked in. */
#ifdef LLVM_NATIVE_ARCH #ifdef LLVM_NATIVE_ARCH
#define DoInit2(TARG) \ #define DoInit2(TARG) \

View File

@ -13,11 +13,11 @@
using namespace llvm; using namespace llvm;
int LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action, LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
char **OutMessages) { char **OutMessages) {
std::string Messages; std::string Messages;
int Result = verifyModule(*unwrap(M), LLVMBool Result = verifyModule(*unwrap(M),
static_cast<VerifierFailureAction>(Action), static_cast<VerifierFailureAction>(Action),
OutMessages? &Messages : 0); OutMessages? &Messages : 0);
@ -27,7 +27,7 @@ int LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
return Result; return Result;
} }
int LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action) { LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action) {
return verifyFunction(*unwrap<Function>(Fn), return verifyFunction(*unwrap<Function>(Fn),
static_cast<VerifierFailureAction>(Action)); static_cast<VerifierFailureAction>(Action));
} }

View File

@ -18,9 +18,9 @@ using namespace llvm;
/* Builds a module from the bitcode in the specified memory buffer, returning a /* Builds a module from the bitcode in the specified memory buffer, returning a
reference to the module via the OutModule parameter. Returns 0 on success. reference to the module via the OutModule parameter. Returns 0 on success.
Optionally returns a human-readable error message via OutMessage. */ Optionally returns a human-readable error message via OutMessage. */
int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutModule, char **OutMessage) { LLVMModuleRef *OutModule, char **OutMessage) {
std::string Message; std::string Message;
*OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), getGlobalContext(), *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), getGlobalContext(),
@ -34,9 +34,10 @@ int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf,
return 0; return 0;
} }
int LLVMParseBitcodeInContext(LLVMContextRef ContextRef, LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
LLVMMemoryBufferRef MemBuf, LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutModule, char **OutMessage) { LLVMModuleRef *OutModule,
char **OutMessage) {
std::string Message; std::string Message;
*OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), *unwrap(ContextRef), *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), *unwrap(ContextRef),
@ -53,9 +54,9 @@ int LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
/* Reads a module from the specified path, returning via the OutModule parameter /* Reads a module from the specified path, returning via the OutModule parameter
a module provider which performs lazy deserialization. Returns 0 on success. a module provider which performs lazy deserialization. Returns 0 on success.
Optionally returns a human-readable error message via OutMessage. */ Optionally returns a human-readable error message via OutMessage. */
int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf,
LLVMModuleProviderRef *OutMP, LLVMModuleProviderRef *OutMP,
char **OutMessage) { char **OutMessage) {
std::string Message; std::string Message;
*OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), getGlobalContext(), *OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), getGlobalContext(),
@ -70,10 +71,10 @@ int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf,
return 0; return 0;
} }
int LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef, LLVMBool LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef,
LLVMMemoryBufferRef MemBuf, LLVMMemoryBufferRef MemBuf,
LLVMModuleProviderRef *OutMP, LLVMModuleProviderRef *OutMP,
char **OutMessage) { char **OutMessage) {
std::string Message; std::string Message;
*OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), *unwrap(ContextRef), *OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), *unwrap(ContextRef),

View File

@ -24,7 +24,7 @@ using namespace llvm;
LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty, LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty,
unsigned long long N, unsigned long long N,
int IsSigned) { LLVMBool IsSigned) {
GenericValue *GenVal = new GenericValue(); GenericValue *GenVal = new GenericValue();
GenVal->IntVal = APInt(unwrap<IntegerType>(Ty)->getBitWidth(), N, IsSigned); GenVal->IntVal = APInt(unwrap<IntegerType>(Ty)->getBitWidth(), N, IsSigned);
return wrap(GenVal); return wrap(GenVal);
@ -56,7 +56,7 @@ unsigned LLVMGenericValueIntWidth(LLVMGenericValueRef GenValRef) {
} }
unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenValRef, unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenValRef,
int IsSigned) { LLVMBool IsSigned) {
GenericValue *GenVal = unwrap(GenValRef); GenericValue *GenVal = unwrap(GenValRef);
if (IsSigned) if (IsSigned)
return GenVal->IntVal.getSExtValue(); return GenVal->IntVal.getSExtValue();
@ -87,9 +87,9 @@ void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal) {
/*===-- Operations on execution engines -----------------------------------===*/ /*===-- Operations on execution engines -----------------------------------===*/
int LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE, LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE,
LLVMModuleProviderRef MP, LLVMModuleProviderRef MP,
char **OutError) { char **OutError) {
std::string Error; std::string Error;
EngineBuilder builder(unwrap(MP)); EngineBuilder builder(unwrap(MP));
builder.setEngineKind(EngineKind::Either) builder.setEngineKind(EngineKind::Either)
@ -102,9 +102,9 @@ int LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE,
return 1; return 1;
} }
int LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp, LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
LLVMModuleProviderRef MP, LLVMModuleProviderRef MP,
char **OutError) { char **OutError) {
std::string Error; std::string Error;
EngineBuilder builder(unwrap(MP)); EngineBuilder builder(unwrap(MP));
builder.setEngineKind(EngineKind::Interpreter) builder.setEngineKind(EngineKind::Interpreter)
@ -117,10 +117,10 @@ int LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
return 1; return 1;
} }
int LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT, LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
LLVMModuleProviderRef MP, LLVMModuleProviderRef MP,
unsigned OptLevel, unsigned OptLevel,
char **OutError) { char **OutError) {
std::string Error; std::string Error;
EngineBuilder builder(unwrap(MP)); EngineBuilder builder(unwrap(MP));
builder.setEngineKind(EngineKind::JIT) builder.setEngineKind(EngineKind::JIT)
@ -177,9 +177,9 @@ void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP){
unwrap(EE)->addModuleProvider(unwrap(MP)); unwrap(EE)->addModuleProvider(unwrap(MP));
} }
int LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE, LLVMBool LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE,
LLVMModuleProviderRef MP, LLVMModuleProviderRef MP,
LLVMModuleRef *OutMod, char **OutError) { LLVMModuleRef *OutMod, char **OutError) {
std::string Error; std::string Error;
if (Module *Gone = unwrap(EE)->removeModuleProvider(unwrap(MP), &Error)) { if (Module *Gone = unwrap(EE)->removeModuleProvider(unwrap(MP), &Error)) {
*OutMod = wrap(Gone); *OutMod = wrap(Gone);
@ -190,8 +190,8 @@ int LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE,
return 1; return 1;
} }
int LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name, LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name,
LLVMValueRef *OutFn) { LLVMValueRef *OutFn) {
if (Function *F = unwrap(EE)->FindFunctionNamed(Name)) { if (Function *F = unwrap(EE)->FindFunctionNamed(Name)) {
*OutFn = wrap(F); *OutFn = wrap(F);
return 0; return 0;

View File

@ -34,7 +34,7 @@ char *LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD) {
} }
LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef TD) { LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef TD) {
return unwrap(TD)->isLittleEndian(); return unwrap(TD)->isLittleEndian() ? LLVMLittleEndian : LLVMBigEndian;
} }
unsigned LLVMPointerSize(LLVMTargetDataRef TD) { unsigned LLVMPointerSize(LLVMTargetDataRef TD) {

View File

@ -89,7 +89,7 @@ void LLVMSetTarget(LLVMModuleRef M, const char *Triple) {
} }
/*--.. Type names ..........................................................--*/ /*--.. Type names ..........................................................--*/
int LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty) { LLVMBool LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty) {
return unwrap(M)->addTypeName(Name, unwrap(Ty)); return unwrap(M)->addTypeName(Name, unwrap(Ty));
} }
@ -237,7 +237,7 @@ LLVMTypeRef LLVMPPCFP128Type(void) {
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMTypeRef *ParamTypes, unsigned ParamCount,
int IsVarArg) { LLVMBool IsVarArg) {
std::vector<const Type*> Tys; std::vector<const Type*> Tys;
for (LLVMTypeRef *I = ParamTypes, *E = ParamTypes + ParamCount; I != E; ++I) for (LLVMTypeRef *I = ParamTypes, *E = ParamTypes + ParamCount; I != E; ++I)
Tys.push_back(unwrap(*I)); Tys.push_back(unwrap(*I));
@ -245,7 +245,7 @@ LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
return wrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0)); return wrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0));
} }
int LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy) { LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy) {
return unwrap<FunctionType>(FunctionTy)->isVarArg(); return unwrap<FunctionType>(FunctionTy)->isVarArg();
} }
@ -267,7 +267,7 @@ void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest) {
/*--.. Operations on struct types ..........................................--*/ /*--.. Operations on struct types ..........................................--*/
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
unsigned ElementCount, int Packed) { unsigned ElementCount, LLVMBool Packed) {
std::vector<const Type*> Tys; std::vector<const Type*> Tys;
for (LLVMTypeRef *I = ElementTypes, for (LLVMTypeRef *I = ElementTypes,
*E = ElementTypes + ElementCount; I != E; ++I) *E = ElementTypes + ElementCount; I != E; ++I)
@ -277,7 +277,7 @@ LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
} }
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes,
unsigned ElementCount, int Packed) { unsigned ElementCount, LLVMBool Packed) {
return LLVMStructTypeInContext(LLVMGetGlobalContext(), ElementTypes, return LLVMStructTypeInContext(LLVMGetGlobalContext(), ElementTypes,
ElementCount, Packed); ElementCount, Packed);
} }
@ -294,7 +294,7 @@ void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest) {
*Dest++ = wrap(*I); *Dest++ = wrap(*I);
} }
int LLVMIsPackedStruct(LLVMTypeRef StructTy) { LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy) {
return unwrap<StructType>(StructTy)->isPacked(); return unwrap<StructType>(StructTy)->isPacked();
} }
@ -442,17 +442,17 @@ LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty) {
return wrap(UndefValue::get(unwrap(Ty))); return wrap(UndefValue::get(unwrap(Ty)));
} }
int LLVMIsConstant(LLVMValueRef Ty) { LLVMBool LLVMIsConstant(LLVMValueRef Ty) {
return isa<Constant>(unwrap(Ty)); return isa<Constant>(unwrap(Ty));
} }
int LLVMIsNull(LLVMValueRef Val) { LLVMBool LLVMIsNull(LLVMValueRef Val) {
if (Constant *C = dyn_cast<Constant>(unwrap(Val))) if (Constant *C = dyn_cast<Constant>(unwrap(Val)))
return C->isNullValue(); return C->isNullValue();
return false; return false;
} }
int LLVMIsUndef(LLVMValueRef Val) { LLVMBool LLVMIsUndef(LLVMValueRef Val) {
return isa<UndefValue>(unwrap(Val)); return isa<UndefValue>(unwrap(Val));
} }
@ -464,7 +464,7 @@ LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty) {
/*--.. Operations on scalar constants ......................................--*/ /*--.. Operations on scalar constants ......................................--*/
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
int SignExtend) { LLVMBool SignExtend) {
return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), N, SignExtend != 0)); return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), N, SignExtend != 0));
} }
@ -504,7 +504,8 @@ long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal) {
/*--.. Operations on composite constants ...................................--*/ /*--.. Operations on composite constants ...................................--*/
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str,
unsigned Length, int DontNullTerminate) { unsigned Length,
LLVMBool DontNullTerminate) {
/* Inverted the sense of AddNull because ', 0)' is a /* Inverted the sense of AddNull because ', 0)' is a
better mnemonic for null termination than ', 1)'. */ better mnemonic for null termination than ', 1)'. */
return wrap(ConstantArray::get(*unwrap(C), std::string(Str, Length), return wrap(ConstantArray::get(*unwrap(C), std::string(Str, Length),
@ -512,14 +513,14 @@ LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str,
} }
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef LLVMConstStructInContext(LLVMContextRef C,
LLVMValueRef *ConstantVals, LLVMValueRef *ConstantVals,
unsigned Count, int Packed) { unsigned Count, LLVMBool Packed) {
return wrap(ConstantStruct::get(*unwrap(C), return wrap(ConstantStruct::get(*unwrap(C),
unwrap<Constant>(ConstantVals, Count), unwrap<Constant>(ConstantVals, Count),
Count, Packed != 0)); Count, Packed != 0));
} }
LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
int DontNullTerminate) { LLVMBool DontNullTerminate) {
return LLVMConstStringInContext(LLVMGetGlobalContext(), Str, Length, return LLVMConstStringInContext(LLVMGetGlobalContext(), Str, Length,
DontNullTerminate); DontNullTerminate);
} }
@ -530,7 +531,7 @@ LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
Length)); Length));
} }
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
int Packed) { LLVMBool Packed) {
return LLVMConstStructInContext(LLVMGetGlobalContext(), ConstantVals, Count, return LLVMConstStructInContext(LLVMGetGlobalContext(), ConstantVals, Count,
Packed); Packed);
} }
@ -820,7 +821,7 @@ LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal,
} }
LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType,
unsigned isSigned) { LLVMBool isSigned) {
return wrap(ConstantExpr::getIntegerCast( return wrap(ConstantExpr::getIntegerCast(
unwrap<Constant>(ConstantVal), unwrap<Constant>(ConstantVal),
unwrap(ToType), unwrap(ToType),
@ -883,10 +884,11 @@ LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
IdxList, NumIdx)); IdxList, NumIdx));
} }
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString,
const char *Constraints, int HasSideEffects, const char *Constraints,
int IsAlignStack) { LLVMBool HasSideEffects,
return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString, LLVMBool IsAlignStack) {
return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
Constraints, HasSideEffects, IsAlignStack)); Constraints, HasSideEffects, IsAlignStack));
} }
@ -896,7 +898,7 @@ LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global) {
return wrap(unwrap<GlobalValue>(Global)->getParent()); return wrap(unwrap<GlobalValue>(Global)->getParent());
} }
int LLVMIsDeclaration(LLVMValueRef Global) { LLVMBool LLVMIsDeclaration(LLVMValueRef Global) {
return unwrap<GlobalValue>(Global)->isDeclaration(); return unwrap<GlobalValue>(Global)->isDeclaration();
} }
@ -1079,19 +1081,19 @@ void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal) {
->setInitializer(unwrap<Constant>(ConstantVal)); ->setInitializer(unwrap<Constant>(ConstantVal));
} }
int LLVMIsThreadLocal(LLVMValueRef GlobalVar) { LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar) {
return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal(); return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal();
} }
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, int IsThreadLocal) { void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal) {
unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0); unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0);
} }
int LLVMIsGlobalConstant(LLVMValueRef GlobalVar) { LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar) {
return unwrap<GlobalVariable>(GlobalVar)->isConstant(); return unwrap<GlobalVariable>(GlobalVar)->isConstant();
} }
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, int IsConstant) { void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant) {
unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0); unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
} }
@ -1285,7 +1287,7 @@ LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB) {
return wrap(static_cast<Value*>(unwrap(BB))); return wrap(static_cast<Value*>(unwrap(BB)));
} }
int LLVMValueIsBasicBlock(LLVMValueRef Val) { LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val) {
return isa<BasicBlock>(unwrap(Val)); return isa<BasicBlock>(unwrap(Val));
} }
@ -1452,11 +1454,11 @@ void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
/*--.. Operations on call instructions (only) ..............................--*/ /*--.. Operations on call instructions (only) ..............................--*/
int LLVMIsTailCall(LLVMValueRef Call) { LLVMBool LLVMIsTailCall(LLVMValueRef Call) {
return unwrap<CallInst>(Call)->isTailCall(); return unwrap<CallInst>(Call)->isTailCall();
} }
void LLVMSetTailCall(LLVMValueRef Call, int isTailCall) { void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall) {
unwrap<CallInst>(Call)->setTailCall(isTailCall); unwrap<CallInst>(Call)->setTailCall(isTailCall);
} }
@ -1973,9 +1975,11 @@ void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP) {
/*===-- Memory buffers ----------------------------------------------------===*/ /*===-- Memory buffers ----------------------------------------------------===*/
int LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(
LLVMMemoryBufferRef *OutMemBuf, const char *Path,
char **OutMessage) { LLVMMemoryBufferRef *OutMemBuf,
char **OutMessage) {
std::string Error; std::string Error;
if (MemoryBuffer *MB = MemoryBuffer::getFile(Path, &Error)) { if (MemoryBuffer *MB = MemoryBuffer::getFile(Path, &Error)) {
*OutMemBuf = wrap(MB); *OutMemBuf = wrap(MB);
@ -1986,8 +1990,8 @@ int LLVMCreateMemoryBufferWithContentsOfFile(const char *Path,
return 1; return 1;
} }
int LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf,
char **OutMessage) { char **OutMessage) {
MemoryBuffer *MB = MemoryBuffer::getSTDIN(); MemoryBuffer *MB = MemoryBuffer::getSTDIN();
if (!MB->getBufferSize()) { if (!MB->getBufferSize()) {
delete MB; delete MB;

View File

@ -1699,19 +1699,19 @@ LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P) {
return wrap(new FunctionPassManager(unwrap(P))); return wrap(new FunctionPassManager(unwrap(P)));
} }
int LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M) { LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M) {
return unwrap<PassManager>(PM)->run(*unwrap(M)); return unwrap<PassManager>(PM)->run(*unwrap(M));
} }
int LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM) { LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM) {
return unwrap<FunctionPassManager>(FPM)->doInitialization(); return unwrap<FunctionPassManager>(FPM)->doInitialization();
} }
int LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F) { LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F) {
return unwrap<FunctionPassManager>(FPM)->run(*unwrap<Function>(F)); return unwrap<FunctionPassManager>(FPM)->run(*unwrap<Function>(F));
} }
int LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM) { LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM) {
return unwrap<FunctionPassManager>(FPM)->doFinalization(); return unwrap<FunctionPassManager>(FPM)->doFinalization();
} }