Add completion to the query parser, and hook it up to clang-query.

Differential Revision: http://llvm-reviews.chandlerc.com/D2263

llvm-svn: 200604
diff --git a/clang-tools-extra/clang-query/tool/ClangQuery.cpp b/clang-tools-extra/clang-query/tool/ClangQuery.cpp
index 0150d41..f9b62e0 100644
--- a/clang-tools-extra/clang-query/tool/ClangQuery.cpp
+++ b/clang-tools-extra/clang-query/tool/ClangQuery.cpp
@@ -96,7 +96,7 @@
     for (cl::list<std::string>::iterator I = Commands.begin(),
                                          E = Commands.end();
          I != E; ++I) {
-      QueryRef Q = ParseQuery(I->c_str());
+      QueryRef Q = QueryParser::parse(I->c_str());
       if (!Q->run(llvm::outs(), QS))
         return 1;
     }
@@ -113,15 +113,16 @@
         std::string Line;
         std::getline(Input, Line);
 
-        QueryRef Q = ParseQuery(Line.c_str());
+        QueryRef Q = QueryParser::parse(Line.c_str());
         if (!Q->run(llvm::outs(), QS))
           return 1;
       }
     }
   } else {
     LineEditor LE("clang-query");
+    LE.setListCompleter(QueryParser::complete);
     while (llvm::Optional<std::string> Line = LE.readLine()) {
-      QueryRef Q = ParseQuery(*Line);
+      QueryRef Q = QueryParser::parse(*Line);
       Q->run(llvm::outs(), QS);
     }
   }