[clang-tools-extra] r343533 - [clang-query] Add missing 'l' command handling
Stephen Kelly via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 1 13:34:21 PDT 2018
Author: steveire
Date: Mon Oct 1 13:34:21 2018
New Revision: 343533
URL: http://llvm.org/viewvc/llvm-project?rev=343533&view=rev
Log:
[clang-query] Add missing 'l' command handling
The `let` command was added in commit 045c15ba (Add new 'let' command to
bind arbitrary values into constants., 2014-04-23).
The `let` command and the non-existant `l` command were documented in
commit 233092a0 (Add 'let' to the help message., 2015-02-27).
Implement the `l` command now for completeness.
Modified:
clang-tools-extra/trunk/clang-query/QueryParser.cpp
clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp
Modified: clang-tools-extra/trunk/clang-query/QueryParser.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/QueryParser.cpp?rev=343533&r1=343532&r2=343533&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-query/QueryParser.cpp (original)
+++ clang-tools-extra/trunk/clang-query/QueryParser.cpp Mon Oct 1 13:34:21 2018
@@ -162,6 +162,7 @@ QueryRef QueryParser::doParse() {
ParsedQueryKind QKind = LexOrCompleteWord<ParsedQueryKind>(this, CommandStr)
.Case("", PQK_NoOp)
.Case("help", PQK_Help)
+ .Case("l", PQK_Let, /*IsCompletion=*/false)
.Case("let", PQK_Let)
.Case("m", PQK_Match, /*IsCompletion=*/false)
.Case("match", PQK_Match)
Modified: clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp?rev=343533&r1=343532&r2=343533&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp Mon Oct 1 13:34:21 2018
@@ -103,6 +103,12 @@ TEST_F(QueryParserTest, LetUnlet) {
EXPECT_TRUE(cast<LetQuery>(Q)->Value.isMatcher());
EXPECT_TRUE(cast<LetQuery>(Q)->Value.getMatcher().hasTypedMatcher<Decl>());
+ Q = parse("l foo decl()");
+ ASSERT_TRUE(isa<LetQuery>(Q));
+ EXPECT_EQ("foo", cast<LetQuery>(Q)->Name);
+ EXPECT_TRUE(cast<LetQuery>(Q)->Value.isMatcher());
+ EXPECT_TRUE(cast<LetQuery>(Q)->Value.getMatcher().hasTypedMatcher<Decl>());
+
Q = parse("let bar \"str\"");
ASSERT_TRUE(isa<LetQuery>(Q));
EXPECT_EQ("bar", cast<LetQuery>(Q)->Name);
More information about the cfe-commits
mailing list