summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/RawCommentList.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2013-04-26 20:12:49 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2013-04-26 20:12:49 +0000
commite9585628ae8cb26d623c779aeb63f7cf60a18082 (patch)
tree2415bb5f0a95a3ea4e16a452fe6847652ab3b55d /clang/lib/AST/RawCommentList.cpp
parent6e040c0be2064154f86250eafe2fafec2c192be0 (diff)
downloadbcm5719-llvm-e9585628ae8cb26d623c779aeb63f7cf60a18082.tar.gz
bcm5719-llvm-e9585628ae8cb26d623c779aeb63f7cf60a18082.zip
Comment parsing: -fparse-all-comments: recognize empty line comments
In -fparse-all-comments mode empty '//' comments were recognized as RCK_Invalid, and were not merged with next and previous lines. Patch by Amin Shali. llvm-svn: 180625
Diffstat (limited to 'clang/lib/AST/RawCommentList.cpp')
-rw-r--r--clang/lib/AST/RawCommentList.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/AST/RawCommentList.cpp b/clang/lib/AST/RawCommentList.cpp
index 78164593806..fb85c142e3f 100644
--- a/clang/lib/AST/RawCommentList.cpp
+++ b/clang/lib/AST/RawCommentList.cpp
@@ -21,8 +21,10 @@ using namespace clang;
namespace {
/// Get comment kind and bool describing if it is a trailing comment.
-std::pair<RawComment::CommentKind, bool> getCommentKind(StringRef Comment) {
- if (Comment.size() < 3 || Comment[0] != '/')
+std::pair<RawComment::CommentKind, bool> getCommentKind(StringRef Comment,
+ bool ParseAllComments) {
+ const size_t MinCommentLength = ParseAllComments ? 2 : 3;
+ if ((Comment.size() < MinCommentLength) || Comment[0] != '/')
return std::make_pair(RawComment::RCK_Invalid, false);
RawComment::CommentKind K;
@@ -76,7 +78,7 @@ RawComment::RawComment(const SourceManager &SourceMgr, SourceRange SR,
if (!Merged) {
// Guess comment kind.
- std::pair<CommentKind, bool> K = getCommentKind(RawText);
+ std::pair<CommentKind, bool> K = getCommentKind(RawText, ParseAllComments);
Kind = K.first;
IsTrailingComment = K.second;
OpenPOWER on IntegriCloud