Author: Kazu Hirata Date: 2024-01-24T22:11:53-08:00 New Revision: 196a71ec4bc9176ae9ac2d0475a074336e1b736b
URL: https://github.com/llvm/llvm-project/commit/196a71ec4bc9176ae9ac2d0475a074336e1b736b DIFF: https://github.com/llvm/llvm-project/commit/196a71ec4bc9176ae9ac2d0475a074336e1b736b.diff LOG: [Sema] Use StringRef::consume_front (NFC) Added: Modified: clang/lib/Sema/SemaDeclAttr.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 6f462de4be78ba2..069571fcf786413 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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits