Skip to content

Commit 680142b

Browse files
authored
Merge pull request #28 from apple/egorzhdan/build-fixes-20230725
🍒[build] Various fixes
2 parents 46c67a9 + 4ed6293 commit 680142b

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
66
option(BUILD_SHARED_LIBS "Build shared libraries by default" YES)
77
endif()
88

9-
set(min_supported_swift_version 5.8)
9+
set(min_supported_swift_version 5.9)
1010
if(CMAKE_Swift_COMPILER_VERSION VERSION_LESS "${min_supported_swift_version}")
1111
message(FATAL_ERROR "Outdated Swift compiler: "
1212
"Swift ${min_supported_swift_version} or newer is required.")

Sources/LLVM/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ add_library(LLVM_Utils
22
LLVM_Utils.swift)
33
target_compile_options(LLVM_Utils PUBLIC
44
"-emit-module"
5-
"-Xfrontend" "-enable-experimental-cxx-interop")
5+
"SHELL:-Xcc -std=c++17"
6+
"-cxx-interoperability-mode=default")
67
target_include_directories(LLVM_Utils PUBLIC
78
"${LLVM_MAIN_INCLUDE_DIR}"
89
"${LLVM_INCLUDE_DIR}")

Sources/LLVM/LLVM_Utils.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
extension String {
1616
public init(_ stringRef: llvm.StringRef) {
17-
self.init(cxxString: stringRef.str())
17+
self.init(stringRef.str())
1818
}
1919

2020
public func withStringRef<Result>(_ body: (llvm.StringRef) -> Result) -> Result {
@@ -34,9 +34,15 @@ extension StaticString {
3434
}
3535

3636
public func ==(lhs: llvm.StringRef, rhs: StaticString) -> Bool {
37+
#if $NewCxxMethodSafetyHeuristics
38+
let lhsBuffer = UnsafeBufferPointer<UInt8>(
39+
start: lhs.bytes_begin(),
40+
count: Int(lhs.bytes_end() - lhs.bytes_begin()))
41+
#else
3742
let lhsBuffer = UnsafeBufferPointer<UInt8>(
3843
start: lhs.__bytes_beginUnsafe(),
3944
count: Int(lhs.__bytes_endUnsafe() - lhs.__bytes_beginUnsafe()))
45+
#endif
4046
return rhs.withUTF8Buffer { (rhsBuffer: UnsafeBufferPointer<UInt8>) in
4147
if lhsBuffer.count != rhsBuffer.count { return false }
4248
return lhsBuffer.elementsEqual(rhsBuffer, by: ==)

0 commit comments

Comments
 (0)