Skip to content

Commit 6c5bba1

Browse files
charles-zablitaugusto2112
authored andcommitted
use std::string instead of llvm::StringRef
1 parent 461119b commit 6c5bba1

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,7 @@ SwiftLanguage::GetDemangledFunctionNameWithoutArguments(Mangled mangled) const {
19111911
return mangled_name;
19121912
}
19131913

1914-
static llvm::Expected<std::pair<llvm::StringRef, DemangledNameInfo>>
1914+
static llvm::Expected<std::pair<std::string, DemangledNameInfo>>
19151915
GetAndValidateInfo(const SymbolContext &sc) {
19161916
Mangled mangled = sc.GetPossiblyInlinedFunctionName();
19171917
if (!mangled)
@@ -1941,19 +1941,19 @@ GetAndValidateInfo(const SymbolContext &sc) {
19411941
return std::make_pair(demangled_name, info);
19421942
}
19431943

1944-
static llvm::Expected<llvm::StringRef>
1944+
static llvm::Expected<std::string>
19451945
GetDemangledBasename(const SymbolContext &sc) {
19461946
auto info_or_err = GetAndValidateInfo(sc);
19471947
if (!info_or_err)
19481948
return info_or_err.takeError();
19491949

19501950
auto [demangled_name, info] = *info_or_err;
19511951

1952-
return demangled_name.slice(info.BasenameRange.first,
1953-
info.BasenameRange.second);
1952+
return demangled_name.substr(info.BasenameRange.first,
1953+
info.BasenameRange.second);
19541954
}
19551955

1956-
static llvm::Expected<llvm::StringRef>
1956+
static llvm::Expected<std::string>
19571957
GetDemangledFunctionPrefix(const SymbolContext &sc) {
19581958
auto info_or_err = GetAndValidateInfo(sc);
19591959
if (!info_or_err)
@@ -1966,10 +1966,10 @@ GetDemangledFunctionPrefix(const SymbolContext &sc) {
19661966
"DemangledInfo for '%s does not have suffix range.",
19671967
demangled_name.data());
19681968

1969-
return demangled_name.slice(info.PrefixRange.first, info.PrefixRange.second);
1969+
return demangled_name.substr(info.PrefixRange.first, info.PrefixRange.second);
19701970
}
19711971

1972-
static llvm::Expected<llvm::StringRef>
1972+
static llvm::Expected<std::string>
19731973
GetDemangledFunctionSuffix(const SymbolContext &sc) {
19741974
auto info_or_err = GetAndValidateInfo(sc);
19751975
if (!info_or_err)
@@ -1982,7 +1982,7 @@ GetDemangledFunctionSuffix(const SymbolContext &sc) {
19821982
"DemangledInfo for '%s does not have suffix range.",
19831983
demangled_name.data());
19841984

1985-
return demangled_name.slice(info.SuffixRange.first, info.SuffixRange.second);
1985+
return demangled_name.substr(info.SuffixRange.first, info.SuffixRange.second);
19861986
}
19871987

19881988
static bool PrintDemangledArgumentList(Stream &s, const SymbolContext &sc) {
@@ -2000,8 +2000,8 @@ static bool PrintDemangledArgumentList(Stream &s, const SymbolContext &sc) {
20002000
if (!info.hasArguments())
20012001
return false;
20022002

2003-
s << demangled_name.slice(info.ArgumentsRange.first,
2004-
info.ArgumentsRange.second);
2003+
s << demangled_name.substr(info.ArgumentsRange.first,
2004+
info.ArgumentsRange.second);
20052005

20062006
return true;
20072007
}

lldb/test/API/lang/swift/async/tasks/TestSwiftTaskBacktrace.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from lldbsuite.test.lldbtest import TestBase
44
import lldbsuite.test.lldbutil as lldbutil
55

6-
76
class TestCase(TestBase):
87

98
@swiftTest
@@ -32,6 +31,6 @@ def do_backtrace(self, arg):
3231
".sleep(",
3332
"`second() at main.swift:6",
3433
"`first() at main.swift:2",
35-
"`closure #1 in static Main.main() at main.swift:12",
34+
"`closure #1() at main.swift:12:19",
3635
],
3736
)

lldb/test/API/lang/swift/async/tasks/TestSwiftTaskSelect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def do_backtrace_selected_task(self, arg):
3333
".sleep(",
3434
"`second() at main.swift:6:",
3535
"`first() at main.swift:2:",
36-
"`closure #1 in static Main.main() at main.swift:12:",
36+
"`closure #1() at main.swift:12:",
3737
],
3838
)
3939

0 commit comments

Comments
 (0)