aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/AST/CommentBriefParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/AST/CommentBriefParser.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/AST/CommentBriefParser.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/contrib/llvm-project/clang/lib/AST/CommentBriefParser.cpp b/contrib/llvm-project/clang/lib/AST/CommentBriefParser.cpp
index 2b648cbb1d4b..bf9e17993497 100644
--- a/contrib/llvm-project/clang/lib/AST/CommentBriefParser.cpp
+++ b/contrib/llvm-project/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,12 +23,11 @@ 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;
}
- continue;
} else {
*O++ = C;
PrevWasSpace = false;
@@ -44,12 +40,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
@@ -123,7 +114,7 @@ std::string BriefParser::Parse() {
// We found a paragraph end. This ends the brief description if
// \command or its equivalent was explicitly used.
// Stop scanning text because an explicit \paragraph is the
- // preffered one.
+ // preferred one.
if (InBrief)
break;
// End first paragraph if we found some non-whitespace text.