12 #include "llvm/ADT/StringSwitch.h"
19 return C ==
' ' || C ==
'\n' || C ==
'\r' ||
20 C ==
'\t' || C ==
'\f' || C ==
'\v';
25 void cleanupBrief(std::string &
S) {
26 bool PrevWasSpace =
true;
27 std::string::iterator O = S.begin();
28 for (std::string::iterator I = S.begin(), E = S.end();
42 if (O != S.begin() && *(O - 1) ==
' ')
45 S.resize(O - S.begin());
49 for (StringRef::const_iterator I = Text.begin(), E = Text.end();
59 L(L), Traits(Traits) {
65 std::string FirstParagraphOrBrief;
66 std::string ReturnsParagraph;
67 bool InFirstParagraph =
true;
69 bool InReturns =
false;
73 if (InFirstParagraph || InBrief)
74 FirstParagraphOrBrief += Tok.
getText();
76 ReturnsParagraph += Tok.
getText();
84 FirstParagraphOrBrief.clear();
92 InFirstParagraph =
false;
93 ReturnsParagraph +=
"Returns ";
100 InFirstParagraph =
false;
107 if (InFirstParagraph || InBrief)
108 FirstParagraphOrBrief +=
' ';
110 ReturnsParagraph +=
' ';
132 if (InFirstParagraph && !
isWhitespace(FirstParagraphOrBrief))
133 InFirstParagraph =
false;
144 cleanupBrief(FirstParagraphOrBrief);
145 if (!FirstParagraphOrBrief.empty())
146 return FirstParagraphOrBrief;
148 cleanupBrief(ReturnsParagraph);
149 return ReturnsParagraph;
static LLVM_READONLY bool isWhitespace(unsigned char c)