aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/AST/CommentParser.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2014-01-27 17:55:43 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2014-01-27 17:55:43 +0000
commit6bf8f803f21c1603731ac7fc3064dc3a1ef7a698 (patch)
treeb2cee54e02497d02a7f3822c5c5e25d20a16e020 /clang/unittests/AST/CommentParser.cpp
parent73afb432135a59570a6b07d34ce20e59805e00ae (diff)
downloadllvm-6bf8f803f21c1603731ac7fc3064dc3a1ef7a698.zip
llvm-6bf8f803f21c1603731ac7fc3064dc3a1ef7a698.tar.gz
llvm-6bf8f803f21c1603731ac7fc3064dc3a1ef7a698.tar.bz2
Comment parsing: don't crash while parsing \deprecated in a standalone comment
(comment without a decl). I think this can not happen during normal compilation with -Wdocumentation, only while using Clang APIs to parse comments outside of a source file. Based on a patch by Olivier Goffart. llvm-svn: 200230
Diffstat (limited to 'clang/unittests/AST/CommentParser.cpp')
-rw-r--r--clang/unittests/AST/CommentParser.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/unittests/AST/CommentParser.cpp b/clang/unittests/AST/CommentParser.cpp
index f75c636..c72aef1 100644
--- a/clang/unittests/AST/CommentParser.cpp
+++ b/clang/unittests/AST/CommentParser.cpp
@@ -1420,6 +1420,26 @@ TEST_F(CommentParserTest, VerbatimLine2) {
}
}
+TEST_F(CommentParserTest, Deprecated) {
+ const char *Sources[] = {
+ "/** @deprecated*/",
+ "/// @deprecated\n"
+ };
+
+ for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ FullComment *FC = parseString(Sources[i]);
+ ASSERT_TRUE(HasChildCount(FC, 2));
+
+ ASSERT_TRUE(HasParagraphCommentAt(FC, 0, " "));
+ {
+ BlockCommandComment *BCC;
+ ParagraphComment *PC;
+ ASSERT_TRUE(HasBlockCommandAt(FC, Traits, 1, BCC, "deprecated", PC));
+ ASSERT_TRUE(HasChildCount(PC, 0));
+ }
+ }
+}
+
} // unnamed namespace
} // end namespace comments