[clang] [clang-format[NFC] Replace a function with StringRef::contains (PR #146245)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 28 15:54:52 PDT 2025
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/146245
None
>From 60a0768fef885cb87e564f6dba7e101befd6ab0d Mon Sep 17 00:00:00 2001
From: Owen Pan <owenpiano at gmail.com>
Date: Sat, 28 Jun 2025 15:52:58 -0700
Subject: [PATCH] [clang-format[NFC] Replace a function with
StringRef::contains
---
clang/lib/Format/BreakableToken.cpp | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
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