mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Rename startswith to starts_with
LLVM is presumably moving towards `std::string_view` - `StringRef::startswith` is deprecated on tip. `SmallString::startswith` was just renamed there (maybe with some small deprecation inbetween, but if so, we've missed it). The `SmallString::startswith` references were moved to `.str().starts_with()`, rather than adding the `starts_with` on `stable/20230725` as we only had a few of them. Open to switching that over if anyone feels strongly though.
This commit is contained in:
@@ -369,7 +369,7 @@ static void PrintArg(raw_ostream &OS, const char *Arg, StringRef TempDir) {
|
||||
llvm::sys::fs::make_absolute(TempPath);
|
||||
llvm::sys::path::native(TempPath);
|
||||
|
||||
if (StringRef(ArgPath).startswith(TempPath)) {
|
||||
if (StringRef(ArgPath).starts_with(TempPath)) {
|
||||
// Don't write temporary file names in the debug info. This would prevent
|
||||
// incremental llvm compilation because we would generate different IR on
|
||||
// every compiler invocation.
|
||||
@@ -852,7 +852,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
// Allow StrictConcurrency to have a value that corresponds to the
|
||||
// -strict-concurrency=<blah> settings.
|
||||
StringRef value = A->getValue();
|
||||
if (value.startswith("StrictConcurrency")) {
|
||||
if (value.starts_with("StrictConcurrency")) {
|
||||
auto decomposed = value.split("=");
|
||||
if (decomposed.first == "StrictConcurrency") {
|
||||
if (decomposed.second == "") {
|
||||
@@ -886,7 +886,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
// this form of feature, so specially handle it here until features can
|
||||
// maybe have extra arguments in the future.
|
||||
auto strRef = StringRef(A->getValue());
|
||||
if (strRef.startswith("AvailabilityMacro=")) {
|
||||
if (strRef.starts_with("AvailabilityMacro=")) {
|
||||
auto availability = strRef.split("=").second;
|
||||
|
||||
Opts.AvailabilityMacros.push_back(availability.str());
|
||||
@@ -2003,7 +2003,7 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
|
||||
|
||||
for (const Arg *arg: Args.filtered(OPT_emit_macro_expansion_files)) {
|
||||
StringRef contents = arg->getValue();
|
||||
bool negated = contents.startswith("no-");
|
||||
bool negated = contents.starts_with("no-");
|
||||
if (negated)
|
||||
contents = contents.drop_front(3);
|
||||
if (contents == "diagnostics")
|
||||
@@ -2670,7 +2670,7 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
||||
|
||||
for (const Arg *A : Args.filtered(OPT_Xcc)) {
|
||||
StringRef Opt = A->getValue();
|
||||
if (Opt.startswith("-D") || Opt.startswith("-U"))
|
||||
if (Opt.starts_with("-D") || Opt.starts_with("-U"))
|
||||
Opts.ClangDefines.push_back(Opt.str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user