Skip to content

Commit 5d59072

Browse files
committed
Extend context api with all templated funcs
1 parent 0eb5fab commit 5d59072

File tree

1 file changed

+73
-82
lines changed

1 file changed

+73
-82
lines changed

llvm-codegen/LLVM/Context.swift

Lines changed: 73 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -86,34 +86,37 @@ public class Context: ContextRef {
8686
}
8787
}
8888

89-
//=========
89+
//===============================
90+
//###############################
91+
//===============================
92+
9093
/// Get the diagnostic context of this context.
91-
public func getDiagnosticContext(){
92-
// void *LLVMContextGetDiagnosticContext(LLVMContextRef C);
94+
public func getDiagnosticContext() {
95+
// void *LLVMContextGetDiagnosticContext(LLVMContextRef C);
9396
}
9497

9598
/// Set the yield callback function for this context.
9699
public func setYieldCallback() {
97-
// void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback,
100+
// void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback,
98101
}
99102

100103
/// Return a string representation of the DiagnosticInfo. Use
101104
/// LLVMDisposeMessage to free the string.
102-
public func getDiagInfoDescription(){
105+
public func getDiagInfoDescription() {
103106
// char *LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI);
104107
}
105108

106109
/// Return an enum LLVMDiagnosticSeverity.
107110
public func getDiagInfoSeverity() {
108-
// LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI);
111+
// LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI);
109112
}
110113

111-
public func getMDKindIDInContext(){
112-
// unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name,
114+
public func getMDKindIDInContext() {
115+
// unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name,
113116
}
114117

115-
public func getMDKindID(){
116-
// unsigned LLVMGetMDKindID(const char *Name, unsigned SLen);
118+
public func getMDKindID() {
119+
// unsigned LLVMGetMDKindID(const char *Name, unsigned SLen);
117120
}
118121

119122
/// Return an unique id given the name of a enum attribute,
@@ -125,85 +128,73 @@ public class Context: ContextRef {
125128
///
126129
/// NB: Attribute names and/or id are subject to change without
127130
/// going through the C API deprecation cycle.
128-
public func getEnumAttributeKindForName(){
131+
public func getEnumAttributeKindForName() {
129132
// unsigned LLVMGetEnumAttributeKindForName(const char *Name, size_t SLen);
130-
131133
}
132134

133-
public func getLastEnumAttributeKind (){
135+
public func getLastEnumAttributeKind() {
134136
// unsigned LLVMGetLastEnumAttributeKind(void);
135137
}
136138

137-
public func
138-
public func
139-
public func
140-
public func
141-
public func
142-
public func
143-
public func
144-
public func
145-
public func
146-
public func
147-
public func
148-
149-
//========================================
150-
/**
151-
* Create an enum attribute.
152-
*/
153-
LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, unsigned KindID,
154-
uint64_t Val);
155-
156-
/**
157-
* Get the unique id corresponding to the enum attribute
158-
* passed as argument.
159-
*/
160-
unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A);
161-
162-
/**
163-
* Get the enum attribute's value. 0 is returned if none exists.
164-
*/
165-
uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A);
166-
167-
/**
168-
* Create a type attribute
169-
*/
170-
LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID,
171-
LLVMTypeRef type_ref);
172-
173-
/**
174-
* Get the type attribute's value.
175-
*/
176-
LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A);
177-
178-
/**
179-
* Create a string attribute.
180-
*/
181-
LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C,
182-
const char *K, unsigned KLength,
183-
const char *V, unsigned VLength);
184-
185-
/**
186-
* Get the string attribute's kind.
187-
*/
188-
const char *LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length);
189-
190-
/**
191-
* Get the string attribute's value.
192-
*/
193-
const char *LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length);
194-
195-
/**
196-
* Check for the different types of attributes.
197-
*/
198-
LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A);
199-
LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A);
200-
LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A);
201-
202-
/**
203-
* Obtain a Type from a context by its registered name.
204-
*/
205-
LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name);
139+
/// Create an enum attribute.
140+
public func attributeRef() {
141+
// LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, unsigned KindID, uint64_t Val);
142+
}
143+
144+
/// Get the unique id corresponding to the enum attribute passed as argument.
145+
public func getEnumAttributeKind() {
146+
// unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A);
147+
}
148+
149+
/// Get the enum attribute's value. 0 is returned if none exists.
150+
public func getEnumAttributeValue() {
151+
// uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A);
152+
}
153+
154+
/// Create a type attribute
155+
public func createTypeAttribute() {
156+
// LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID, LLVMTypeRef type_ref);
157+
}
158+
159+
/// Get the type attribute's value.
160+
public func getTypeAttributeValue() {
161+
// LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A);
162+
}
163+
164+
/// Create a string attribute.
165+
public func createStringAttribute() {
166+
// TODO: LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C,
167+
}
168+
169+
/// Get the string attribute's kind.
170+
public func getStringAttributeKind() {
171+
// const char *LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length);
172+
}
173+
174+
/// Get the string attribute's value.
175+
public func getStringAttributeValue() {
176+
// const char *LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length);
177+
}
178+
179+
/// Check for the types of attributes.
180+
public func isEnumAttribute() {
181+
// LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A);
182+
}
183+
184+
/// Check for the types of attributes.
185+
public func isStringAttribute() {
186+
// LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A);
187+
}
206188

189+
/// Check for the types of attributes.
190+
public func isTypeAttribute() {
191+
// LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A);
192+
}
193+
194+
/// Obtain a Type from a context by its registered name.
195+
public func getTypeByName2() {
196+
// LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name);
197+
}
207198

208199
/// Deinitialize this value and dispose of its resources.
209200
///

0 commit comments

Comments
 (0)