diff options
| author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-09-14 16:35:35 +0000 |
|---|---|---|
| committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-09-14 16:35:35 +0000 |
| commit | ad45ad6fe981a91b9f65f719408b2bf082310721 (patch) | |
| tree | e9dd63c43125492e34fd15ae551f5cb9db1e8b7b /clang/unittests/AST | |
| parent | 927bbc287163ff7c3a27066255bfd905e0dfd8c6 (diff) | |
| download | bcm5719-llvm-ad45ad6fe981a91b9f65f719408b2bf082310721.tar.gz bcm5719-llvm-ad45ad6fe981a91b9f65f719408b2bf082310721.zip | |
Comment parsing: don't parse comment marker followed by a digit as a command
since no Doxygen command starts with a digit.
llvm-svn: 163909
Diffstat (limited to 'clang/unittests/AST')
| -rw-r--r-- | clang/unittests/AST/CommentLexer.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/clang/unittests/AST/CommentLexer.cpp b/clang/unittests/AST/CommentLexer.cpp index 2ec741ba3d7..cc4535a163c 100644 --- a/clang/unittests/AST/CommentLexer.cpp +++ b/clang/unittests/AST/CommentLexer.cpp @@ -322,7 +322,35 @@ TEST_F(CommentLexerTest, DoxygenCommand4) { } } +// A command marker followed by a non-letter that is not a part of an escape +// sequence. TEST_F(CommentLexerTest, DoxygenCommand5) { + const char *Source = "/// \\^ \\0"; + std::vector<Token> Toks; + + lexString(Source, Toks); + + ASSERT_EQ(6U, Toks.size()); + + ASSERT_EQ(tok::text, Toks[0].getKind()); + ASSERT_EQ(StringRef(" "), Toks[0].getText()); + + ASSERT_EQ(tok::text, Toks[1].getKind()); + ASSERT_EQ(StringRef("\\"), Toks[1].getText()); + + ASSERT_EQ(tok::text, Toks[2].getKind()); + ASSERT_EQ(StringRef("^ "), Toks[2].getText()); + + ASSERT_EQ(tok::text, Toks[3].getKind()); + ASSERT_EQ(StringRef("\\"), Toks[3].getText()); + + ASSERT_EQ(tok::text, Toks[4].getKind()); + ASSERT_EQ(StringRef("0"), Toks[4].getText()); + + ASSERT_EQ(tok::newline, Toks[5].getKind()); +} + +TEST_F(CommentLexerTest, DoxygenCommand6) { const char *Source = "/// \\brief Aaa."; std::vector<Token> Toks; @@ -342,7 +370,7 @@ TEST_F(CommentLexerTest, DoxygenCommand5) { ASSERT_EQ(tok::newline, Toks[3].getKind()); } -TEST_F(CommentLexerTest, DoxygenCommand6) { +TEST_F(CommentLexerTest, DoxygenCommand7) { const char *Source = "/// \\em\\em \\em\t\\em\n"; std::vector<Token> Toks; @@ -374,7 +402,7 @@ TEST_F(CommentLexerTest, DoxygenCommand6) { ASSERT_EQ(tok::newline, Toks[7].getKind()); } -TEST_F(CommentLexerTest, DoxygenCommand7) { +TEST_F(CommentLexerTest, DoxygenCommand8) { const char *Source = "/// \\aaa\\bbb \\ccc\t\\ddd\n"; std::vector<Token> Toks; @@ -406,7 +434,7 @@ TEST_F(CommentLexerTest, DoxygenCommand7) { ASSERT_EQ(tok::newline, Toks[7].getKind()); } -TEST_F(CommentLexerTest, DoxygenCommand8) { +TEST_F(CommentLexerTest, DoxygenCommand9) { const char *Source = "// \\c\n"; std::vector<Token> Toks; |

