[clang-tools-extra] r343664 - [clang-query] Add single-letter 'q' alias for 'quit'

Stephen Kelly via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 3 00:52:44 PDT 2018


Author: steveire
Date: Wed Oct  3 00:52:44 2018
New Revision: 343664

URL: http://llvm.org/viewvc/llvm-project?rev=343664&view=rev
Log:
[clang-query] Add single-letter 'q' alias for 'quit'

Reviewers: aaron.ballman, pcc

Reviewed By: aaron.ballman

Subscribers: Szelethus, cfe-commits

Differential Revision: https://reviews.llvm.org/D52746

Modified:
    clang-tools-extra/trunk/clang-query/Query.cpp
    clang-tools-extra/trunk/clang-query/QueryParser.cpp
    clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp

Modified: clang-tools-extra/trunk/clang-query/Query.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/Query.cpp?rev=343664&r1=343663&r2=343664&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-query/Query.cpp (original)
+++ clang-tools-extra/trunk/clang-query/Query.cpp Wed Oct  3 00:52:44 2018
@@ -45,7 +45,7 @@ bool HelpQuery::run(llvm::raw_ostream &O
         "Set whether to print bindings as diagnostics,\n"
         "                                    "
         "AST pretty prints or AST dumps.\n"
-        "  quit                              "
+        "  quit, q                           "
         "Terminates the query session.\n\n";
   return true;
 }

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=343664&r1=343663&r2=343664&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-query/QueryParser.cpp (original)
+++ clang-tools-extra/trunk/clang-query/QueryParser.cpp Wed Oct  3 00:52:44 2018
@@ -166,6 +166,7 @@ QueryRef QueryParser::doParse() {
                               .Case("let", PQK_Let)
                               .Case("m", PQK_Match, /*IsCompletion=*/false)
                               .Case("match", PQK_Match)
+                              .Case("q", PQK_Quit,  /*IsCompletion=*/false)
                               .Case("quit", PQK_Quit)
                               .Case("set", PQK_Set)
                               .Case("unlet", PQK_Unlet)

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=343664&r1=343663&r2=343664&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp Wed Oct  3 00:52:44 2018
@@ -51,6 +51,9 @@ TEST_F(QueryParserTest, Quit) {
   QueryRef Q = parse("quit");
   ASSERT_TRUE(isa<QuitQuery>(Q));
 
+  Q = parse("q");
+  ASSERT_TRUE(isa<QuitQuery>(Q));
+
   Q = parse("quit me");
   ASSERT_TRUE(isa<InvalidQuery>(Q));
   EXPECT_EQ("unexpected extra input: ' me'", cast<InvalidQuery>(Q)->ErrStr);




More information about the cfe-commits mailing list