Skip to content

Commit ce1bd5a

Browse files
committed
Updated access control and removed generation stuff from tests
1 parent b7302c3 commit ce1bd5a

File tree

4 files changed

+52
-315
lines changed

4 files changed

+52
-315
lines changed

Sources/Clang/Comment.swift

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public protocol Comment {
1010

1111
extension Comment {
1212
/// Retreives all children of this comment.
13-
var children: AnySequence<Comment> {
13+
public var children: AnySequence<Comment> {
1414
let count = clang_Comment_getNumChildren(clang)
1515
var index: UInt32 = 0
1616
return AnySequence<Comment> {
@@ -24,11 +24,11 @@ extension Comment {
2424

2525
/// - parameter index: The index of the child you're getting.
2626
/// - returns: The specified child of the AST node.
27-
func child(at index: Int) -> Comment? {
27+
public func child(at index: Int) -> Comment? {
2828
return convertComment(clang_Comment_getChild(clang, UInt32(index)))
2929
}
3030

31-
var firstChild: Comment? {
31+
public var firstChild: Comment? {
3232
let count = clang_Comment_getNumChildren(clang)
3333
if count == 0 { return nil }
3434
return convertComment(clang_Comment_getChild(clang, 0))
@@ -59,35 +59,35 @@ public struct FullComment: Comment {
5959
/// names inside template template parameters
6060
/// - `tparam-name-index-invalid` and `tparam-descr-index-invalid` are used if
6161
/// parameter position is invalid.
62-
var html: String {
62+
public var html: String {
6363
return clang_FullComment_getAsHTML(clang).asSwift()
6464
}
6565

6666
/// Convert a given full parsed comment to an XML document.
6767
/// A Relax NG schema for the XML can be found in comment-xml-schema.rng file
6868
/// inside the clang source tree.
69-
var xml: String {
69+
public var xml: String {
7070
return clang_FullComment_getAsXML(clang).asSwift()
7171
}
7272
}
7373

7474
/// A plain text comment.
75-
struct TextComment: Comment {
76-
let clang: CXComment
75+
public struct TextComment: Comment {
76+
public let clang: CXComment
7777

7878
/// Retrieves the text contained in the AST node.
79-
var text: String {
79+
public var text: String {
8080
return clang_TextComment_getText(clang).asSwift()
8181
}
8282
}
8383

8484
/// A command with word-like arguments that is considered inline content.
8585
/// For example: `\c command`
86-
struct InlineCommandComment: Comment {
87-
let clang: CXComment
86+
public struct InlineCommandComment: Comment {
87+
public let clang: CXComment
8888

8989
/// Retrieves all arguments of this inline command.
90-
var arguments: AnySequence<String> {
90+
public var arguments: AnySequence<String> {
9191
let count = clang_InlineCommandComment_getNumArgs(clang)
9292
var index = 0 as UInt32
9393
return AnySequence<String> {
@@ -106,12 +106,12 @@ struct InlineCommandComment: Comment {
106106
/// ```
107107
/// Would have 1 attribute, with a name `"href"`, and value
108108
/// `"https://example.org"`
109-
struct HTMLAttribute {
109+
public struct HTMLAttribute {
110110
/// The name of the attribute, which comes before the `=`.
111-
let name: String
111+
public let name: String
112112

113113
/// The value in the attribute, which comes after the `=`.
114-
let value: String
114+
public let value: String
115115
}
116116

117117
/// An HTML start tag with attributes (name-value pairs). Considered inline
@@ -120,11 +120,11 @@ struct HTMLAttribute {
120120
/// ```
121121
/// <a href="http://example.org/">
122122
/// ```
123-
struct HTMLStartTagComment: Comment {
124-
let clang: CXComment
123+
public struct HTMLStartTagComment: Comment {
124+
public let clang: CXComment
125125

126126
/// Retrieves all attributes of this HTML start tag.
127-
var attributes: AnySequence<HTMLAttribute> {
127+
public var attributes: AnySequence<HTMLAttribute> {
128128
let count = clang_HTMLStartTag_getNumAttrs(clang)
129129
var index = 0 as UInt32
130130
return AnySequence<HTMLAttribute> {
@@ -144,13 +144,13 @@ struct HTMLStartTagComment: Comment {
144144
/// ```
145145
/// </a>
146146
/// ```
147-
struct HTMLEndTagComment: Comment {
148-
let clang: CXComment
147+
public struct HTMLEndTagComment: Comment {
148+
public let clang: CXComment
149149
}
150150

151151
/// A paragraph, contains inline comment. The paragraph itself is block content.
152-
struct ParagraphComment: Comment {
153-
let clang: CXComment
152+
public struct ParagraphComment: Comment {
153+
public let clang: CXComment
154154
}
155155

156156
/// A command that has zero or more word-like arguments (number of word-like
@@ -160,16 +160,16 @@ struct ParagraphComment: Comment {
160160
/// For example: `\brief` has 0 word-like arguments and a paragraph argument.
161161
/// AST nodes of special kinds that parser knows about (e. g., the `\param`
162162
/// command) have their own node kinds.
163-
struct BlockCommandComment: Comment {
164-
let clang: CXComment
163+
public struct BlockCommandComment: Comment {
164+
public let clang: CXComment
165165

166166
/// Retrieves the name of this block command.
167-
var name: String {
167+
public var name: String {
168168
return clang_BlockCommandComment_getCommandName(clang).asSwift()
169169
}
170170

171171
/// Retrieves all attributes of this HTML start tag.
172-
var arguments: AnySequence<String> {
172+
public var arguments: AnySequence<String> {
173173
let count = clang_BlockCommandComment_getNumArgs(clang)
174174
var index = 0 as UInt32
175175
return AnySequence<String> {
@@ -182,7 +182,7 @@ struct BlockCommandComment: Comment {
182182
}
183183

184184
/// Retrieves the paragraph argument of the block command.
185-
var paragraph: ParagraphComment {
185+
public var paragraph: ParagraphComment {
186186
return ParagraphComment(clang: clang_BlockCommandComment_getParagraph(clang))
187187
}
188188
}
@@ -193,7 +193,7 @@ struct BlockCommandComment: Comment {
193193
/// caller. An `.out` argument is usually a pointer and is meant to be filled
194194
/// by the caller, usually to return multiple pieces of data from a function.
195195
/// An `.inout` argument is meant to be read and written out to by the caller.
196-
enum ParamPassDirection {
196+
public enum ParamPassDirection {
197197
/// The parameter is an input parameter.
198198
case `in`
199199

@@ -219,33 +219,33 @@ enum ParamPassDirection {
219219
/// ```
220220
/// \param [in] ParamName description.
221221
/// ```
222-
struct ParamCommandComment: Comment {
223-
let clang: CXComment
222+
public struct ParamCommandComment: Comment {
223+
public let clang: CXComment
224224

225225
/// Retrieves the zero-based parameter index in the function prototype.
226-
var index: Int {
226+
public var index: Int {
227227
return Int(clang_ParamCommandComment_getParamIndex(clang))
228228
}
229229

230230
/// The direction this parameter is passed by.
231-
var passDirection: ParamPassDirection {
231+
public var passDirection: ParamPassDirection {
232232
return ParamPassDirection(clang: clang_ParamCommandComment_getDirection(clang))
233233
}
234234

235235
/// Retrieves the name of the declared parameter.
236-
var name: String {
236+
public var name: String {
237237
return clang_ParamCommandComment_getParamName(clang).asSwift()
238238
}
239239

240240
/// Determine if this parameter is actually a valid parameter in the declared
241241
/// function
242-
var isValidIndex: Bool {
242+
public var isValidIndex: Bool {
243243
return clang_ParamCommandComment_isParamIndexValid(clang) != 0
244244
}
245245

246246
/// Determines if the parameter's direction was explicitly stated in the
247247
/// function prototype.
248-
var isExplicitDirection: Bool {
248+
public var isExplicitDirection: Bool {
249249
return clang_ParamCommandComment_isDirectionExplicit(clang) != 0
250250
}
251251
}
@@ -255,8 +255,8 @@ struct ParamCommandComment: Comment {
255255
/// ```
256256
/// \tparam T description.
257257
/// ```
258-
struct TParamCommandComment: Comment {
259-
let clang: CXComment
258+
public struct TParamCommandComment: Comment {
259+
public let clang: CXComment
260260

261261
/// Determines the zero-based nesting depth of this parameter in the template
262262
/// parameter list.
@@ -267,7 +267,7 @@ struct TParamCommandComment: Comment {
267267
/// ```
268268
/// for `C` and `TT` the nesting depth is 0, and for `T` the nesting
269269
/// depth is `1`.
270-
var depth: Int {
270+
public var depth: Int {
271271
return Int(clang_TParamCommandComment_getDepth(clang))
272272
}
273273
}
@@ -281,16 +281,16 @@ struct TParamCommandComment: Comment {
281281
/// aaa
282282
/// \endverbatim
283283
/// ```
284-
struct VerbatimBlockCommandComment: Comment {
285-
let clang: CXComment
284+
public struct VerbatimBlockCommandComment: Comment {
285+
public let clang: CXComment
286286

287287
/// Retrieves the name of this block command.
288-
var name: String {
288+
public var name: String {
289289
return clang_BlockCommandComment_getCommandName(clang).asSwift()
290290
}
291291

292292
/// Retrieves all attributes of this HTML start tag.
293-
var arguments: AnySequence<String> {
293+
public var arguments: AnySequence<String> {
294294
let count = clang_BlockCommandComment_getNumArgs(clang)
295295
var index = 0 as UInt32
296296
return AnySequence<String> {
@@ -303,30 +303,30 @@ struct VerbatimBlockCommandComment: Comment {
303303
}
304304

305305
/// Retrieves the paragraph argument of the block command.
306-
var paragraph: ParagraphComment {
306+
public var paragraph: ParagraphComment {
307307
return ParagraphComment(clang: clang_BlockCommandComment_getParagraph(clang))
308308
}
309309
}
310310

311311
/// A line of text that is contained within a `VerbatimBlockCommand`
312312
/// node.
313-
struct VerbatimBlockLineComment: Comment {
314-
let clang: CXComment
313+
public struct VerbatimBlockLineComment: Comment {
314+
public let clang: CXComment
315315

316316
/// The text of this comment.
317-
var text: String {
317+
public var text: String {
318318
return clang_VerbatimBlockLineComment_getText(clang).asSwift()
319319
}
320320
}
321321

322322
/// A verbatim line command. Verbatim line has an opening command, a single
323323
/// line of text (up to the newline after the opening command) and has no
324324
/// closing command.
325-
struct VerbatimLineComment: Comment {
326-
let clang: CXComment
325+
public struct VerbatimLineComment: Comment {
326+
public let clang: CXComment
327327

328328
/// The text of this comment.
329-
var text: String {
329+
public var text: String {
330330
return clang_VerbatimLineComment_getText(clang).asSwift()
331331
}
332332
}

Sources/Clang/Cursors.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,20 @@ public struct CXXAccessSpecifier: ClangCursorBacked {
141141
public struct EnumDecl: ClangCursorBacked {
142142
let clang: CXCursor
143143

144-
func constants() -> [EnumConstantDecl] {
144+
public func constants() -> [EnumConstantDecl] {
145145
return children() as! [EnumConstantDecl]
146146
}
147147

148148
/// Retrieve the integer type of an enum declaration.
149-
var integerType: CType {
149+
public var integerType: CType {
150150
return convertType(clang_getEnumDeclIntegerType(clang))!
151151
}
152152
}
153153

154154
protocol TypeAliasCursor: ClangCursorBacked {}
155155
extension TypeAliasCursor {
156156
/// Retrieve the underlying type of a typedef declaration.
157-
var underlying: CType? {
157+
public var underlying: CType? {
158158
return convertType(clang_getTypedefDeclUnderlyingType(clang))
159159
}
160160
}

Sources/Clang/TranslationUnit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public class TranslationUnit {
196196
/// - parameter tokens: The set of tokens to annotate
197197
/// - returns: The cursors corresponding to each token provided
198198
public func annotate(tokens: [Token]) -> [Cursor] {
199-
var toks = tokens.map { $0.asClang() }
199+
var toks = tokens.map { $0.clang }
200200
let cursors =
201201
UnsafeMutablePointer<CXCursor>.allocate(capacity: toks.count)
202202
toks.withUnsafeMutableBufferPointer { buf in

0 commit comments

Comments
 (0)