File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 8
8
// ===----------------------------------------------------------------------===//
9
9
10
10
#include " clang/AST/CommentBriefParser.h"
11
+ #include " llvm/ADT/StringSwitch.h"
11
12
12
13
namespace clang {
13
14
namespace comments {
@@ -38,6 +39,21 @@ void cleanupBrief(std::string &S) {
38
39
39
40
S.resize (O - S.begin ());
40
41
}
42
+
43
+ bool isBlockCommand (StringRef Name) {
44
+ return llvm::StringSwitch<bool >(Name)
45
+ .Case (" brief" , true )
46
+ .Case (" result" , true )
47
+ .Case (" return" , true )
48
+ .Case (" returns" , true )
49
+ .Case (" author" , true )
50
+ .Case (" authors" , true )
51
+ .Case (" pre" , true )
52
+ .Case (" post" , true )
53
+ .Case (" param" , true )
54
+ .Case (" arg" , true )
55
+ .Default (false );
56
+ }
41
57
} // unnamed namespace
42
58
43
59
std::string BriefParser::Parse () {
@@ -61,9 +77,8 @@ std::string BriefParser::Parse() {
61
77
ConsumeToken ();
62
78
continue ;
63
79
}
64
- // Check if this command implicitly starts a new paragraph.
65
- if (Name == " param" || Name == " result" || Name == " return" ||
66
- Name == " returns" ) {
80
+ // Block commands implicitly start a new paragraph.
81
+ if (isBlockCommand (Name)) {
67
82
// We found an implicit paragraph end.
68
83
InFirstParagraph = false ;
69
84
if (InBrief) {
You can’t perform that action at this time.
0 commit comments