Skip to content

Commit

Permalink
Runtime: Remove unused swift_stdlib_demangleName stub.
Browse files Browse the repository at this point in the history
  • Loading branch information
jckarter committed Nov 13, 2015
1 parent 4074f06 commit d8b6859
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 44 deletions.
22 changes: 0 additions & 22 deletions stdlib/public/core/Misc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,6 @@ func _typeName(type: Any.Type, qualified: Bool = true) -> String {
return result
}

@warn_unused_result
@asmname("swift_stdlib_demangleName")
func _stdlib_demangleNameImpl(
mangledName: UnsafePointer<UInt8>,
_ mangledNameLength: UInt,
_ demangledName: UnsafeMutablePointer<String>)

@warn_unused_result
public // @testable
func _stdlib_demangleName(mangledName: String) -> String {
let mangledNameUTF8 = Array(mangledName.utf8)
return mangledNameUTF8.withUnsafeBufferPointer {
(mangledNameUTF8) in
let (_, demangledName) = _withUninitializedString {
_stdlib_demangleNameImpl(
mangledNameUTF8.baseAddress, UInt(mangledNameUTF8.endIndex),
$0)
}
return demangledName
}
}

/// Returns `floor(log(x))`. This equals to the position of the most
/// significant non-zero bit, or 63 - number-of-zeros before it.
///
Expand Down
12 changes: 0 additions & 12 deletions stdlib/public/runtime/Reflection.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1271,15 +1271,3 @@ static Mirror ObjC_getMirrorForSuperclass(Class sup,
swift_stringFromUTF8InRawMemory(outString, name.data(), name.length());
}

extern "C" void swift_stdlib_demangleName(const char *mangledName,
size_t mangledNameLength,
String *demangledName) {
auto options = Demangle::DemangleOptions();
options.DisplayDebuggerGeneratedModule = false;
auto result =
Demangle::demangleSymbolAsString(mangledName,
mangledNameLength,
options);
new (demangledName) String(result.data(), result.size());
}

10 changes: 0 additions & 10 deletions test/1_stdlib/Runtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -665,16 +665,6 @@ Runtime.test("typeName") {
expectEqual("protocol<>.Protocol", _typeName(a.dynamicType))
}

Runtime.test("demangleName") {
expectEqual("", _stdlib_demangleName(""))
expectEqual("abc", _stdlib_demangleName("abc"))
expectEqual("\0", _stdlib_demangleName("\0"))
expectEqual("Swift.Double", _stdlib_demangleName("_TtSd"))
expectEqual("x.a : x.Foo<x.Foo<x.Foo<Swift.Int, Swift.Int>, x.Foo<Swift.Int, Swift.Int>>, x.Foo<x.Foo<Swift.Int, Swift.Int>, x.Foo<Swift.Int, Swift.Int>>>",
_stdlib_demangleName("_Tv1x1aGCS_3FooGS0_GS0_SiSi_GS0_SiSi__GS0_GS0_SiSi_GS0_SiSi___"))
expectEqual("Foobar", _stdlib_demangleName("_TtC13__lldb_expr_46Foobar"))
}

Runtime.test("_stdlib_atomicCompareExchangeStrongPtr") {
typealias IntPtr = UnsafeMutablePointer<Int>
var origP1 = IntPtr(bitPattern: 0x10101010)
Expand Down

0 comments on commit d8b6859

Please sign in to comment.