Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
harlanhaskins committed Feb 15, 2017
1 parent 5922b30 commit 3871ada
Show file tree
Hide file tree
Showing 154 changed files with 28,262 additions and 4,186 deletions.
6 changes: 3 additions & 3 deletions Sources/Clang/Cursor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ public enum VisibilityKind {
/// See the definition of llvm::clang::TemplateArgument::ArgKind for full
/// element descriptions.
public enum TemplateArgumentKind {
case null
case type
case declaration
case nullPtr
Expand All @@ -319,11 +320,10 @@ public enum TemplateArgumentKind {
case templateExpansion
case expression
case pack
case invalid

init?(clang: CXTemplateArgumentKind) {
switch clang {
case CXTemplateArgumentKind_Null: return nil
case CXTemplateArgumentKind_Null: self = .null
case CXTemplateArgumentKind_Type: self = .type
case CXTemplateArgumentKind_Declaration: self = .declaration
case CXTemplateArgumentKind_NullPtr: self = .nullPtr
Expand All @@ -332,7 +332,7 @@ public enum TemplateArgumentKind {
case CXTemplateArgumentKind_TemplateExpansion: self = .templateExpansion
case CXTemplateArgumentKind_Expression: self = .expression
case CXTemplateArgumentKind_Pack: self = .pack
case CXTemplateArgumentKind_Invalid: self = .invalid
case CXTemplateArgumentKind_Invalid: return nil
default: fatalError("invalid CXTemplateArgumentKind \(clang)")
}
}
Expand Down
5 changes: 5 additions & 0 deletions Sources/Clang/Cursors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ public struct ObjCProtocolDecl: ClangCursorBacked {
/// An Objective-C @property declaration.
public struct ObjCPropertyDecl: ClangCursorBacked {
let clang: CXCursor

var attributes: ObjCPropertyAttributes {
return ObjCPropertyAttributes(rawValue:
clang_Cursor_getObjCPropertyAttributes(clang, 0))
}
}

/// An Objective-C instance variable.
Expand Down
65 changes: 65 additions & 0 deletions Sources/Clang/EvalResult.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#if !NO_SWIFTPM
import cclang
#endif

protocol EvalResultKind {
var clang: CXEvalResultKind { get }
}

public struct IntResult: EvalResultKind {
let clang: CXEvalResultKind
public var value: Int {
return Int(clang_EvalResult_getAsInt(clang))
}
}

public struct FloatResult: EvalResultKind {
let clang: CXEvalResultKind
public var value: Double {
return Int(clang_EvalResult_getAsDouble(clang))
}
}

public struct ObjCStrLiteralResult: EvalResultKind {
let clang: CXEvalResultKind
public var value: String {
return String(cString: clang_EvalResult_getAsString(clang))
}
}

public struct StrLiteralResult: EvalResultKind {
let clang: CXEvalResultKind
public var value: String {
return String(cString: clang_EvalResult_getAsString(clang))
}
}

public struct CFStrResult: EvalResultKind {
let clang: CXEvalResultKind
public var value: String {
return String(cString: clang_EvalResult_getAsString(clang))
}
}

public struct OtherResult: EvalResultKind {
let clang: CXEvalResultKind
}

public struct UnExposedResult: EvalResultKind {
let clang: CXEvalResultKind
}

/// Converts a CXEvalResultKind to a EvalResultKind, returning `nil` if it was unsuccessful
func convertEvalResultKind(_ clang: CXEvalResultKind) -> EvalResultKind? {
if <#clang thing is null?#> { return nil }
switch <#Get clang kind#> {
case CXEval_Int: return IntResult(clang: clang)
case CXEval_Float: return FloatResult(clang: clang)
case CXEval_ObjCStrLiteral: return ObjCStrLiteralResult(clang: clang)
case CXEval_StrLiteral: return StrLiteralResult(clang: clang)
case CXEval_CFStr: return CFStrResult(clang: clang)
case CXEval_Other: return OtherResult(clang: clang)
case CXEval_UnExposed: return UnExposedResult(clang: clang)
default: fatalError("invalid CXEvalResultKindKind \(clang)")
}
}
84 changes: 84 additions & 0 deletions Sources/Clang/FunctionDecl.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#if !NO_SWIFTPM
import cclang
#endif

/// Describes the calling convention of a function type
public enum CallingConvention {
case `default`
case c
case x86StdCall
case x86FastCall
case x86ThisCall
case x86Pascal
case aapcs
case aapcs_vfp
case intelOclBicc
case x86_64Win64
case x86_64SysV
case x86VectorCall
case swift
case preserveMost
case preserveAll
case unexposed

init?(clang: CXCallingConv) {
switch clang {
case CXCallingConv_Default: self = .default
case CXCallingConv_C: self = .c
case CXCallingConv_X86StdCall: self = .x86StdCall
case CXCallingConv_X86FastCall: self = .x86FastCall
case CXCallingConv_X86ThisCall: self = .x86ThisCall
case CXCallingConv_X86Pascal: self = .x86Pascal
case CXCallingConv_AAPCS: self = .aapcs
case CXCallingConv_AAPCS_VFP: self = .aapcs_vfp
case CXCallingConv_IntelOclBicc: self = .intelOclBicc
case CXCallingConv_X86_64Win64: self = .x86_64Win64
case CXCallingConv_X86_64SysV: self = .x86_64SysV
case CXCallingConv_X86VectorCall: self = .x86VectorCall
case CXCallingConv_Swift: self = .swift
case CXCallingConv_PreserveMost: self = .preserveMost
case CXCallingConv_PreserveAll: self = .preserveAll
case CXCallingConv_Invalid: return nil
case CXCallingConv_Unexposed: self = .unexposed
default: fatalError("invalid CXCallingConv \(clang)")
}
}
}

/// Property attributes for an Objective-C @property declaration.
public struct ObjCPropertyAttributes: OptionSet {
public typealias RawValue = CXObjCPropertyAttrKind.RawValue
public let rawValue: RawValue
/// Creates a new ObjCPropertyAttributes from a raw integer value.
public init(rawValue: RawValue) {
self.rawValue = rawValue
}
public static let noattr = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_noattr.rawValue)
public static let readonly = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_readonly.rawValue)
public static let getter = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_getter.rawValue)
public static let assign = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_assign.rawValue)
public static let readwrite = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_readwrite.rawValue)
public static let retain = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_retain.rawValue)
public static let copy = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_copy.rawValue)
public static let nonatomic = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_nonatomic.rawValue)
public static let setter = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_setter.rawValue)
public static let atomic = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_atomic.rawValue)
public static let weak = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_weak.rawValue)
public static let strong = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_strong.rawValue)
public static let unsafe_unretained = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_unsafe_unretained.rawValue)
public static let `class` = ObjCPropertyAttributes(rawValue:
CXObjCPropertyAttr_class.rawValue)
}
32 changes: 32 additions & 0 deletions Sources/Clang/NameRefOptions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#if !NO_SWIFTPM
import cclang
#endif

public struct NameRefOptions: OptionSet {
public typealias RawValue = CXNameRefFlags.RawValue
public let rawValue: RawValue

/// Creates a new NameRefOptions from a raw integer value.
public init(rawValue: RawValue) {
self.rawValue = rawValue
}

/// Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the range.
public static let wantQualifier = NameRefOptions(rawValue:
CXNameRange_WantQualifier.rawValue)

/// Include the explicit template arguments, e.g. <int> in x.f<int>, in the
/// range.
public static let wantTemplateArgs = NameRefOptions(rawValue:
CXNameRange_WantTemplateArgs.rawValue)

/// If the name is non-contiguous, return the full spanning range.
/// Non-contiguous names occur in Objective-C when a selector with two or more
/// parameters is used, or in C++ when using an operator:
/// ```
/// [object doSomething:here withValue:there]; // Objective-C
/// return some_vector[1]; // C++
/// ```
public static let wantSinglePiece = NameRefOptions(rawValue:
CXNameRange_WantSinglePiece.rawValue)
}
34 changes: 32 additions & 2 deletions docs/Classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a title="Classes Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (70% documented)</p>
<p><a href="index.html"> Docs</a> (65% documented)</p>
</div>
</header>
<div class="content-wrapper">
Expand Down Expand Up @@ -43,6 +43,9 @@
<li class="nav-group-task">
<a href="Enums/CXXAccessSpecifierKind.html">CXXAccessSpecifierKind</a>
</li>
<li class="nav-group-task">
<a href="Enums/CallingConvention.html">CallingConvention</a>
</li>
<li class="nav-group-task">
<a href="Enums/DiagnosticSeverity.html">DiagnosticSeverity</a>
</li>
Expand Down Expand Up @@ -168,6 +171,9 @@
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang9BreakStmt">BreakStmt</a>
</li>
<li class="nav-group-task">
<a href="Structs/CFStrResult.html">CFStrResult</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang14CStyleCastExpr">CStyleCastExpr</a>
</li>
Expand Down Expand Up @@ -366,6 +372,9 @@
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang12Float128Type">Float128Type</a>
</li>
<li class="nav-group-task">
<a href="Structs/FloatResult.html">FloatResult</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang9FloatType">FloatType</a>
</li>
Expand Down Expand Up @@ -450,6 +459,9 @@
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang10Int128Type">Int128Type</a>
</li>
<li class="nav-group-task">
<a href="Structs/IntResult.html">IntResult</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang7IntType">IntType</a>
</li>
Expand Down Expand Up @@ -522,6 +534,9 @@
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang16ModuleImportDecl">ModuleImportDecl</a>
</li>
<li class="nav-group-task">
<a href="Structs/NameRefOptions.html">NameRefOptions</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang9Namespace">Namespace</a>
</li>
Expand Down Expand Up @@ -738,6 +753,9 @@
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang21ObjCObjectPointerType">ObjCObjectPointerType</a>
</li>
<li class="nav-group-task">
<a href="Structs/ObjCPropertyAttributes.html">ObjCPropertyAttributes</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang16ObjCPropertyDecl">ObjCPropertyDecl</a>
</li>
Expand All @@ -759,6 +777,9 @@
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang12ObjCSelfExpr">ObjCSelfExpr</a>
</li>
<li class="nav-group-task">
<a href="Structs/ObjCStrLiteralResult.html">ObjCStrLiteralResult</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang17ObjCStringLiteral">ObjCStringLiteral</a>
</li>
Expand All @@ -768,6 +789,9 @@
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang18ObjCSynthesizeDecl">ObjCSynthesizeDecl</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang11OtherResult">OtherResult</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang17OverloadCandidate">OverloadCandidate</a>
</li>
Expand Down Expand Up @@ -852,6 +876,9 @@
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang8StmtExpr">StmtExpr</a>
</li>
<li class="nav-group-task">
<a href="Structs/StrLiteralResult.html">StrLiteralResult</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang13StringLiteral">StringLiteral</a>
</li>
Expand Down Expand Up @@ -915,6 +942,9 @@
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang10UShortType">UShortType</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang15UnExposedResult">UnExposedResult</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:V5Clang9UnaryExpr">UnaryExpr</a>
</li>
Expand Down Expand Up @@ -1047,7 +1077,7 @@ <h1>Classes</h1>
</section>
</section>
<section id="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2017-01-25)</p>
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2017-02-13)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
Loading

0 comments on commit 3871ada

Please sign in to comment.