[clang] 7704f81 - [clang-format][NFC] Replace a function with StringRef::contains (#146245)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 10 18:07:21 PDT 2025


Author: Owen Pan
Date: 2025-07-10T18:07:17-07:00
New Revision: 7704f817d0a60596c4c8883c8a8ece67f0a8255a

URL: https://github.com/llvm/llvm-project/commit/7704f817d0a60596c4c8883c8a8ece67f0a8255a
DIFF: https://github.com/llvm/llvm-project/commit/7704f817d0a60596c4c8883c8a8ece67f0a8255a.diff

LOG: [clang-format][NFC] Replace a function with StringRef::contains (#146245)

Added: 
    

Modified: 
    clang/lib/Format/BreakableToken.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp
index def0d73e77539..24912c25ef8c6 100644
--- a/clang/lib/Format/BreakableToken.cpp
+++ b/clang/lib/Format/BreakableToken.cpp
@@ -26,18 +26,6 @@ namespace clang {
 namespace format {
 
 static constexpr StringRef Blanks = " \t\v\f\r";
-static bool IsBlank(char C) {
-  switch (C) {
-  case ' ':
-  case '\t':
-  case '\v':
-  case '\f':
-  case '\r':
-    return true;
-  default:
-    return false;
-  }
-}
 
 static StringRef getLineCommentIndentPrefix(StringRef Comment,
                                             const FormatStyle &Style) {
@@ -193,7 +181,7 @@ getStringSplit(StringRef Text, unsigned UsedColumns, unsigned ColumnLimit,
     if (Chars > MaxSplit || Text.size() <= Advance)
       break;
 
-    if (IsBlank(Text[0]))
+    if (Blanks.contains(Text[0]))
       SpaceOffset = SplitPoint;
     if (Text[0] == '/')
       SlashOffset = SplitPoint;


        


More information about the cfe-commits mailing list