[clang] ea68ce2 - [AST] Remove isWhitespace in favor of clang::isWhitespace (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 11 22:52:09 PST 2021


Author: Kazu Hirata
Date: 2021-12-11T22:52:00-08:00
New Revision: ea68ce2a9be0f7c4b41fbf3f8dc86b683ba7727e

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

LOG: [AST] Remove isWhitespace in favor of clang::isWhitespace (NFC)

Added: 
    

Modified: 
    clang/lib/AST/CommentBriefParser.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/CommentBriefParser.cpp b/clang/lib/AST/CommentBriefParser.cpp
index 2a5f7452b776b..f9fb5a05fd768 100644
--- a/clang/lib/AST/CommentBriefParser.cpp
+++ b/clang/lib/AST/CommentBriefParser.cpp
@@ -8,15 +8,12 @@
 
 #include "clang/AST/CommentBriefParser.h"
 #include "clang/AST/CommentCommandTraits.h"
+#include "clang/Basic/CharInfo.h"
 
 namespace clang {
 namespace comments {
 
 namespace {
-inline bool isWhitespace(char C) {
-  return C == ' ' || C == '\n' || C == '\r' ||
-         C == '\t' || C == '\f' || C == '\v';
-}
 
 /// Convert all whitespace into spaces, remove leading and trailing spaces,
 /// compress multiple spaces into one.
@@ -26,7 +23,7 @@ void cleanupBrief(std::string &S) {
   for (std::string::iterator I = S.begin(), E = S.end();
        I != E; ++I) {
     const char C = *I;
-    if (isWhitespace(C)) {
+    if (clang::isWhitespace(C)) {
       if (!PrevWasSpace) {
         *O++ = ' ';
         PrevWasSpace = true;
@@ -44,12 +41,7 @@ void cleanupBrief(std::string &S) {
 }
 
 bool isWhitespace(StringRef Text) {
-  for (StringRef::const_iterator I = Text.begin(), E = Text.end();
-       I != E; ++I) {
-    if (!isWhitespace(*I))
-      return false;
-  }
-  return true;
+  return llvm::all_of(Text, clang::isWhitespace);
 }
 } // unnamed namespace
 


        


More information about the cfe-commits mailing list