Skip to content

Commit a1c96ac

Browse files
committed
Standardize naming
1 parent 0236104 commit a1c96ac

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

sources/LLVMSharp.Interop/llvmsharp/llvmsharp.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static unsafe partial class llvmsharp
99
{
1010
[DllImport("libLLVMSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "llvmsharp_ConstantDataArray_getData", ExactSpelling = true)]
1111
[return: NativeTypeName("const char *")]
12-
public static extern sbyte* ConstantDataArray_getData([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* ConstantDataArrayRef, [NativeTypeName("int32_t *")] int* out_size);
12+
public static extern sbyte* ConstantDataArray_getData([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* array, [NativeTypeName("int32_t *")] int* out_size);
1313

1414
[DllImport("libLLVMSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "llvmsharp_DIBasicType_getEncoding", ExactSpelling = true)]
1515
[return: NativeTypeName("uint32_t")]
@@ -154,11 +154,11 @@ public static unsafe partial class llvmsharp
154154

155155
[DllImport("libLLVMSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "llvmsharp_Function_getFunctionType", ExactSpelling = true)]
156156
[return: NativeTypeName("LLVMTypeRef")]
157-
public static extern LLVMOpaqueType* Function_getFunctionType([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* FnRef);
157+
public static extern LLVMOpaqueType* Function_getFunctionType([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* function);
158158

159159
[DllImport("libLLVMSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "llvmsharp_Function_getReturnType", ExactSpelling = true)]
160160
[return: NativeTypeName("LLVMTypeRef")]
161-
public static extern LLVMOpaqueType* Function_getReturnType([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* FnRef);
161+
public static extern LLVMOpaqueType* Function_getReturnType([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* function);
162162

163163
[DllImport("libLLVMSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "llvmsharp_GlobalVariable_getGlobalVariableExpression", ExactSpelling = true)]
164164
[return: NativeTypeName("LLVMMetadataRef")]
@@ -170,11 +170,11 @@ public static unsafe partial class llvmsharp
170170

171171
[DllImport("libLLVMSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "llvmsharp_Instruction_hasNoSignedWrap", ExactSpelling = true)]
172172
[return: NativeTypeName("uint8_t")]
173-
public static extern byte Instruction_hasNoSignedWrap([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* InstructionRef);
173+
public static extern byte Instruction_hasNoSignedWrap([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* instruction);
174174

175175
[DllImport("libLLVMSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "llvmsharp_Instruction_hasNoUnsignedWrap", ExactSpelling = true)]
176176
[return: NativeTypeName("uint8_t")]
177-
public static extern byte Instruction_hasNoUnsignedWrap([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* InstructionRef);
177+
public static extern byte Instruction_hasNoUnsignedWrap([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* instruction);
178178

179179
[DllImport("libLLVMSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "llvmsharp_Module_GetIdentifiedStructTypes", ExactSpelling = true)]
180180
public static extern void Module_GetIdentifiedStructTypes([NativeTypeName("LLVMModuleRef")] LLVMOpaqueModule* module, [NativeTypeName("LLVMTypeRef **")] LLVMOpaqueType*** out_buffer, [NativeTypeName("int32_t *")] int* out_size);
@@ -184,7 +184,7 @@ public static unsafe partial class llvmsharp
184184

185185
[DllImport("libLLVMSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "llvmsharp_Value_getDemangledName", ExactSpelling = true)]
186186
[return: NativeTypeName("int32_t")]
187-
public static extern int Value_getDemangledName([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* ValueRef, [NativeTypeName("char *")] sbyte* buffer, [NativeTypeName("int32_t")] int buffer_size);
187+
public static extern int Value_getDemangledName([NativeTypeName("LLVMValueRef")] LLVMOpaqueValue* value, [NativeTypeName("char *")] sbyte* buffer, [NativeTypeName("int32_t")] int buffer_size);
188188

189189
[DllImport("libLLVMSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "llvmsharp_createDeadCodeEliminationPass", ExactSpelling = true)]
190190
[return: NativeTypeName("LLVMPassRef")]

sources/libLLVMSharp/LLVMSharp.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ DEFINE_ISA_CONVERSION_FUNCTIONS(Pass, LLVMPassRef)
3838

3939
// Implementation code
4040

41-
const char* llvmsharp_ConstantDataArray_getData(LLVMValueRef ConstantDataArrayRef, int32_t* out_size)
41+
const char* llvmsharp_ConstantDataArray_getData(LLVMValueRef array, int32_t* out_size)
4242
{
43-
ConstantDataArray* unwrapped = unwrap<ConstantDataArray>(ConstantDataArrayRef);
43+
ConstantDataArray* unwrapped = unwrap<ConstantDataArray>(array);
4444
StringRef stringRef = unwrapped->getRawDataValues();
4545
*out_size = (int32_t)stringRef.size();
4646
return stringRef.data();
@@ -339,26 +339,26 @@ LLVMMetadataRef llvmsharp_DIVariable_getType(LLVMMetadataRef variable)
339339
return wrap(unwrapped->getType());
340340
}
341341

342-
LLVMTypeRef llvmsharp_Function_getFunctionType(LLVMValueRef FnRef)
342+
LLVMTypeRef llvmsharp_Function_getFunctionType(LLVMValueRef function)
343343
{
344-
Function* Fn = unwrap<Function>(FnRef);
345-
Type* type = Fn->getFunctionType();
344+
Function* unwrapped = unwrap<Function>(function);
345+
Type* type = unwrapped->getFunctionType();
346346
return wrap(type);
347347
}
348348

349-
LLVMTypeRef llvmsharp_Function_getReturnType(LLVMValueRef FnRef)
349+
LLVMTypeRef llvmsharp_Function_getReturnType(LLVMValueRef function)
350350
{
351-
Function* Fn = unwrap<Function>(FnRef);
352-
Type* type = Fn->getReturnType();
351+
Function* unwrapped = unwrap<Function>(function);
352+
Type* type = unwrapped->getReturnType();
353353
return wrap(type);
354354
}
355355

356356
LLVMMetadataRef llvmsharp_GlobalVariable_getGlobalVariableExpression(LLVMValueRef global_variable)
357357
{
358-
LLVMMetadataRef metadataRef = llvmsharp_GlobalVariable_getMetadata(global_variable, LLVMContext::MD_dbg);
359-
if (isa<Metadata, DIGlobalVariableExpression>(unwrap<Metadata>(metadataRef)))
358+
LLVMMetadataRef unwrapped = llvmsharp_GlobalVariable_getMetadata(global_variable, LLVMContext::MD_dbg);
359+
if (isa<Metadata, DIGlobalVariableExpression>(unwrap<Metadata>(unwrapped)))
360360
{
361-
return metadataRef;
361+
return unwrapped;
362362
}
363363
else
364364
{
@@ -372,22 +372,22 @@ LLVMMetadataRef llvmsharp_GlobalVariable_getMetadata(LLVMValueRef global_variabl
372372
return wrap(unwrapped->getMetadata(KindID));
373373
}
374374

375-
uint8_t llvmsharp_Instruction_hasNoSignedWrap(LLVMValueRef InstructionRef)
375+
uint8_t llvmsharp_Instruction_hasNoSignedWrap(LLVMValueRef instruction)
376376
{
377-
Instruction* instruction = unwrap<Instruction>(InstructionRef);
378-
return instruction->hasNoSignedWrap() ? 1 : 0;
377+
Instruction* unwrapped = unwrap<Instruction>(instruction);
378+
return unwrapped->hasNoSignedWrap() ? 1 : 0;
379379
}
380380

381-
uint8_t llvmsharp_Instruction_hasNoUnsignedWrap(LLVMValueRef InstructionRef)
381+
uint8_t llvmsharp_Instruction_hasNoUnsignedWrap(LLVMValueRef instruction)
382382
{
383-
Instruction* instruction = unwrap<Instruction>(InstructionRef);
384-
return instruction->hasNoUnsignedWrap() ? 1 : 0;
383+
Instruction* unwrapped = unwrap<Instruction>(instruction);
384+
return unwrapped->hasNoUnsignedWrap() ? 1 : 0;
385385
}
386386

387387
void llvmsharp_Module_GetIdentifiedStructTypes(LLVMModuleRef module, LLVMTypeRef** out_buffer, int32_t* out_size)
388388
{
389-
Module* M = unwrap(module);
390-
std::vector<StructType*> types = M->getIdentifiedStructTypes();
389+
Module* unwrapped = unwrap(module);
390+
std::vector<StructType*> types = unwrapped->getIdentifiedStructTypes();
391391

392392
LLVMTypeRef* buffer = (LLVMTypeRef*)malloc(types.size() * sizeof(LLVMTypeRef));
393393
if (buffer == nullptr)
@@ -411,9 +411,9 @@ void llvmsharp_PassManager_add(LLVMPassManagerRef pass_manager, LLVMPassRef pass
411411
unwrap(pass_manager)->add(unwrap(pass));
412412
}
413413

414-
int32_t llvmsharp_Value_getDemangledName(LLVMValueRef ValueRef, char* buffer, int32_t buffer_size)
414+
int32_t llvmsharp_Value_getDemangledName(LLVMValueRef value, char* buffer, int32_t buffer_size)
415415
{
416-
const char* mangled = LLVMGetValueName(ValueRef);
416+
const char* mangled = LLVMGetValueName(value);
417417
std::string result = llvm::demangle(std::string_view(mangled));
418418
int32_t length = (int32_t)result.length();
419419
int32_t size = length < buffer_size ? length : buffer_size;

sources/libLLVMSharp/LLVMSharp.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ LLVM_CLANG_C_EXTERN_C_BEGIN
3333

3434
// Function declarations
3535

36-
LLVMSHARP_LINKAGE const char* llvmsharp_ConstantDataArray_getData(LLVMValueRef ConstantDataArrayRef, int32_t* out_size);
36+
LLVMSHARP_LINKAGE const char* llvmsharp_ConstantDataArray_getData(LLVMValueRef array, int32_t* out_size);
3737

3838
LLVMSHARP_LINKAGE uint32_t llvmsharp_DIBasicType_getEncoding(LLVMMetadataRef type);
3939

@@ -107,23 +107,23 @@ LLVMSHARP_LINKAGE const char* llvmsharp_DIVariable_getName(LLVMMetadataRef varia
107107

108108
LLVMSHARP_LINKAGE LLVMMetadataRef llvmsharp_DIVariable_getType(LLVMMetadataRef variable);
109109

110-
LLVMSHARP_LINKAGE LLVMTypeRef llvmsharp_Function_getFunctionType(LLVMValueRef FnRef);
110+
LLVMSHARP_LINKAGE LLVMTypeRef llvmsharp_Function_getFunctionType(LLVMValueRef function);
111111

112-
LLVMSHARP_LINKAGE LLVMTypeRef llvmsharp_Function_getReturnType(LLVMValueRef FnRef);
112+
LLVMSHARP_LINKAGE LLVMTypeRef llvmsharp_Function_getReturnType(LLVMValueRef function);
113113

114114
LLVMSHARP_LINKAGE LLVMMetadataRef llvmsharp_GlobalVariable_getGlobalVariableExpression(LLVMValueRef global_variable);
115115

116116
LLVMSHARP_LINKAGE LLVMMetadataRef llvmsharp_GlobalVariable_getMetadata(LLVMValueRef global_variable, uint32_t KindID);
117117

118-
LLVMSHARP_LINKAGE uint8_t llvmsharp_Instruction_hasNoSignedWrap(LLVMValueRef InstructionRef);
118+
LLVMSHARP_LINKAGE uint8_t llvmsharp_Instruction_hasNoSignedWrap(LLVMValueRef instruction);
119119

120-
LLVMSHARP_LINKAGE uint8_t llvmsharp_Instruction_hasNoUnsignedWrap(LLVMValueRef InstructionRef);
120+
LLVMSHARP_LINKAGE uint8_t llvmsharp_Instruction_hasNoUnsignedWrap(LLVMValueRef instruction);
121121

122122
LLVMSHARP_LINKAGE void llvmsharp_Module_GetIdentifiedStructTypes(LLVMModuleRef module, LLVMTypeRef** out_buffer, int32_t* out_size);
123123

124124
LLVMSHARP_LINKAGE void llvmsharp_PassManager_add(LLVMPassManagerRef pass_manager, LLVMPassRef pass);
125125

126-
LLVMSHARP_LINKAGE int32_t llvmsharp_Value_getDemangledName(LLVMValueRef ValueRef, char* buffer, int32_t buffer_size);
126+
LLVMSHARP_LINKAGE int32_t llvmsharp_Value_getDemangledName(LLVMValueRef value, char* buffer, int32_t buffer_size);
127127

128128
LLVMSHARP_LINKAGE LLVMPassRef llvmsharp_createDeadCodeEliminationPass();
129129

0 commit comments

Comments
 (0)