summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2018-10-03 08:21:54 +0000
committerStephen Kelly <steveire@gmail.com>2018-10-03 08:21:54 +0000
commit2c4079c090aa05dc542169bbc0c3e4b31c6920e9 (patch)
tree7963b5afbd264bcac9b5aa72f1d124f33f0792eb /clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
parent7c787b8adf1b85e2bbb03db9a47ee8a6af9690ab (diff)
downloadbcm5719-llvm-2c4079c090aa05dc542169bbc0c3e4b31c6920e9.tar.gz
bcm5719-llvm-2c4079c090aa05dc542169bbc0c3e4b31c6920e9.zip
[clang-query] Add comment token handling
Summary: It is possible to pass a file of commands to clang-query using the command line option -f or --preload. Make it possible to write comments in such files. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D52752 llvm-svn: 343666
Diffstat (limited to 'clang-tools-extra/unittests/clang-query/QueryParserTest.cpp')
-rw-r--r--clang-tools-extra/unittests/clang-query/QueryParserTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clang-query/QueryParserTest.cpp b/clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
index 729862b5fda..62844c896e6 100644
--- a/clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
+++ b/clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
@@ -146,6 +146,17 @@ TEST_F(QueryParserTest, LetUnlet) {
cast<InvalidQuery>(Q)->ErrStr);
}
+TEST_F(QueryParserTest, Comment) {
+ QueryRef Q = parse("# let foo decl()");
+ ASSERT_TRUE(isa<NoOpQuery>(Q));
+
+ Q = parse("let foo decl() # creates a decl() matcher called foo");
+ ASSERT_TRUE(isa<LetQuery>(Q));
+
+ Q = parse("set bind-root false # reduce noise");
+ ASSERT_TRUE(isa<SetQuery<bool>>(Q));
+}
+
TEST_F(QueryParserTest, Complete) {
std::vector<llvm::LineEditor::Completion> Comps =
QueryParser::complete("", 0, QS);
OpenPOWER on IntegriCloud