[Driver] Use StringRef::consume_back (NFC) (#139478)

This commit is contained in:
Kazu Hirata 2025-05-11 17:03:50 -07:00 committed by GitHub
parent e584af5861
commit 20984d841d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1411,8 +1411,8 @@ StringRef Darwin::getSDKName(StringRef isysroot) {
auto EndSDK = llvm::sys::path::rend(isysroot);
for (auto IT = BeginSDK; IT != EndSDK; ++IT) {
StringRef SDK = *IT;
if (SDK.ends_with(".sdk"))
return SDK.slice(0, SDK.size() - 4);
if (SDK.consume_back(".sdk"))
return SDK;
}
return "";
}