Skip to content

Commit dacabc1

Browse files
authored
[lldb] Tweak check for CommandLineTools in ParseXcodeSDK (#154574)
Follow up to #128712
1 parent 86c9a7b commit dacabc1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "SymbolFileDWARF.h"
1010
#include "llvm/ADT/STLExtras.h"
11+
#include "llvm/ADT/StringRef.h"
1112
#include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
1213
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
1314
#include "llvm/Support/Casting.h"
@@ -998,12 +999,12 @@ XcodeSDK SymbolFileDWARF::ParseXcodeSDK(CompileUnit &comp_unit) {
998999
const char *sdk = cu_die.GetAttributeValueAsString(DW_AT_APPLE_sdk, nullptr);
9991000
if (!sdk)
10001001
return {};
1001-
std::string sysroot =
1002+
llvm::StringRef sysroot =
10021003
cu_die.GetAttributeValueAsString(DW_AT_LLVM_sysroot, "");
10031004

10041005
// RegisterXcodeSDK calls into xcrun which is not aware of CLT, which is
10051006
// expensive.
1006-
if (sysroot.find("/Library/Developer/CommandLineTools/SDKs") != 0) {
1007+
if (!sysroot.starts_with("/Library/Developer/CommandLineTools/SDKs")) {
10071008
// Register the sysroot path remapping with the module belonging to
10081009
// the CU as well as the one belonging to the symbol file. The two
10091010
// would be different if this is an OSO object and module is the
@@ -1017,7 +1018,7 @@ XcodeSDK SymbolFileDWARF::ParseXcodeSDK(CompileUnit &comp_unit) {
10171018
local_module_sp->RegisterXcodeSDK(sdk, sysroot);
10181019
}
10191020

1020-
return {sdk, FileSpec{std::move(sysroot)}};
1021+
return {sdk, FileSpec(sysroot)};
10211022
}
10221023

10231024
size_t SymbolFileDWARF::ParseFunctions(CompileUnit &comp_unit) {

0 commit comments

Comments
 (0)