diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 6f462de4be78b..069571fcf7864 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -6690,13 +6690,10 @@ validateSwiftFunctionName(Sema &S, const ParsedAttr &AL, SourceLocation Loc, // Check whether this will be mapped to a getter or setter of a property. bool IsGetter = false, IsSetter = false; - if (Name.starts_with("getter:")) { + if (Name.consume_front("getter:")) IsGetter = true; - Name = Name.substr(7); - } else if (Name.starts_with("setter:")) { + else if (Name.consume_front("setter:")) IsSetter = true; - Name = Name.substr(7); - } if (Name.back() != ')') { S.Diag(Loc, diag::warn_attr_swift_name_function) << AL;