diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-06-29 18:19:20 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-06-29 18:19:20 +0000 |
commit | 025d518e3e46d11384a867e1f3082e4db3e85e63 (patch) | |
tree | 7f88b111616804822617e8f3dabbc3c389614a1c /clang/lib/AST/CommentBriefParser.cpp | |
parent | e8cee12ce2b839f2622b8751efb26ac8db5a1eb1 (diff) | |
download | bcm5719-llvm-025d518e3e46d11384a867e1f3082e4db3e85e63.tar.gz bcm5719-llvm-025d518e3e46d11384a867e1f3082e4db3e85e63.zip |
Factor out a check for block commands (that implicitly start a new paragraph) into a separate function.
llvm-svn: 159444
Diffstat (limited to 'clang/lib/AST/CommentBriefParser.cpp')
-rw-r--r-- | clang/lib/AST/CommentBriefParser.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/clang/lib/AST/CommentBriefParser.cpp b/clang/lib/AST/CommentBriefParser.cpp index 4040a999249..a56d79bda75 100644 --- a/clang/lib/AST/CommentBriefParser.cpp +++ b/clang/lib/AST/CommentBriefParser.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "clang/AST/CommentBriefParser.h" +#include "llvm/ADT/StringSwitch.h" namespace clang { namespace comments { @@ -38,6 +39,21 @@ void cleanupBrief(std::string &S) { S.resize(O - S.begin()); } + +bool isBlockCommand(StringRef Name) { + return llvm::StringSwitch<bool>(Name) + .Case("brief", true) + .Case("result", true) + .Case("return", true) + .Case("returns", true) + .Case("author", true) + .Case("authors", true) + .Case("pre", true) + .Case("post", true) + .Case("param", true) + .Case("arg", true) + .Default(false); +} } // unnamed namespace std::string BriefParser::Parse() { @@ -61,9 +77,8 @@ std::string BriefParser::Parse() { ConsumeToken(); continue; } - // Check if this command implicitly starts a new paragraph. - if (Name == "param" || Name == "result" || Name == "return" || - Name == "returns") { + // Block commands implicitly start a new paragraph. + if (isBlockCommand(Name)) { // We found an implicit paragraph end. InFirstParagraph = false; if (InBrief) { |