Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Support for LLVM 11 #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 4 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ There are a couple annoying steps you need to accomplish before building
LLVMSwift:

- Install LLVM 8.0+ using your favorite package manager. For example:
- `brew install llvm`
- `brew install llvm@11`
- Ensure `llvm-config` is in your `PATH`
- That will reside in the `/bin` folder wherever your package manager
installed LLVM.
Expand All @@ -198,7 +198,7 @@ compiler projects!
### Installation with Swift Package Manager

```swift
.package(url: "https://github.com/llvm-swift/LLVMSwift.git", from: "0.4.0")
.package(url: "https://github.com/llvm-swift/LLVMSwift.git", from: "0.8.0")
```

### Installation without Swift Package Manager
Expand Down
23 changes: 19 additions & 4 deletions 23 Sources/LLVM/DIBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ extension DIBuilder {
/// by third-party tools.
/// - splitDWARFPath: The path to the split DWARF file.
/// - identity: The identity of the tool that is compiling this source file.
/// - sysRoot: The Clang system root (the value of the `-isysroot` that's passed to clang).
/// - sdkRoot: The SDK root -- on Darwin platforms, this is the last component of the sysroot.
/// - Returns: A value representing a compilation-unit level scope.
public func buildCompileUnit(
for language: DWARFSourceLanguage,
Expand All @@ -208,7 +210,9 @@ extension DIBuilder {
flags: [String] = [],
runtimeVersion: Int = 0,
splitDWARFPath: String = "",
identity: String = ""
identity: String = "",
sysRoot: String = "",
sdkRoot: String = ""
) -> CompileUnitMetadata {
let allFlags = flags.joined(separator: " ")
guard let cu = LLVMDIBuilderCreateCompileUnit(
Expand All @@ -220,7 +224,11 @@ extension DIBuilder {
kind.llvm,
/*DWOId*/0,
splitDebugInlining.llvm,
debugInfoForProfiling.llvm
debugInfoForProfiling.llvm,
sysRoot,
sysRoot.count,
sdkRoot,
sdkRoot.count
) else {
fatalError()
}
Expand Down Expand Up @@ -860,15 +868,22 @@ extension DIBuilder {
/// - Parameters:
/// - type: Original type.
/// - name: Typedef name.
/// - alignment: Alignment of the type
/// - scope: The surrounding context for the typedef.
/// - file: File where this type is defined.
/// - line: Line number.
public func buildTypedef(
of type: DIType, name: String, scope: DIScope, file: FileMetadata, line: Int
of type: DIType,
name: String,
alignment: Alignment = .one,
scope: DIScope,
file: FileMetadata,
line: Int
) -> DIType {
guard let ty = LLVMDIBuilderCreateTypedef(
self.llvm, type.asMetadata(), name, name.count,
file.asMetadata(), UInt32(line), scope.asMetadata())
file.asMetadata(), UInt32(line), scope.asMetadata(),
alignment.rawValue * 8)
else {
fatalError("Failed to allocate metadata")
}
Expand Down
3 changes: 0 additions & 3 deletions 3 Sources/LLVM/MetadataAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,6 @@ public struct DIFlags : OptionSet {
public static let forwardDeclaration = DIFlags(rawValue: LLVMDIFlagFwdDecl.rawValue)
/// Denotes a block object.
public static let appleBlock = DIFlags(rawValue: LLVMDIFlagAppleBlock.rawValue)
/// Denotes the structure containing a variable captured by reference in a
/// block object.
public static let blockByrefStruct = DIFlags(rawValue: LLVMDIFlagBlockByrefStruct.rawValue)
/// Denotes a virtual function or dynamic dispatch.
public static let virtual = DIFlags(rawValue: LLVMDIFlagVirtual.rawValue)
/// Denotes a compiler-generated declaration that may not appear in source.
Expand Down
2 changes: 1 addition & 1 deletion 2 Sources/LLVM/TargetMachine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public class TargetMachine {
}
var err: UnsafeMutablePointer<Int8>?
let status = path.withCString { cStr -> LLVMBool in
var mutable = strdup(cStr)
let mutable = strdup(cStr)
defer { free(mutable) }
return LLVMTargetMachineEmitToFile(llvm, module.llvm, mutable, type.asLLVM(), &err)
}
Expand Down
6 changes: 3 additions & 3 deletions 6 utils/make-pkgconfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func makeFile() throws {
}

/// Ensure we have llvm-config in the PATH
guard let llvmConfig = which("llvm-config-9") ?? which("llvm-config") ?? brewLLVMConfig() else {
guard let llvmConfig = which("llvm-config-11") ?? which("llvm-config") ?? brewLLVMConfig() else {
throw "Failed to find llvm-config. Ensure llvm-config is installed and " +
"in your PATH"
}
Expand All @@ -84,8 +84,8 @@ func makeFile() throws {

let version = (components[0], components[1], components[2])

guard version >= (9, 0, 0) else {
throw "LLVMSwift requires LLVM version >=9.0.0, but you have \(versionStr)"
guard version >= (11, 0, 0) else {
throw "LLVMSwift requires LLVM version >=11.0.0, but you have \(versionStr)"
}

print("LLVM version is \(versionStr)")
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.