[clang] 196a71e - [Sema] Use StringRef::consume_front (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 24 22:12:04 PST 2024


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;


        


More information about the cfe-commits mailing list