This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by pcc on Nov 24 2013, 11:55 PM.

Diff Detail

Event Timeline

pcc updated this revision to Unknown Object (????).Nov 25 2013, 12:20 AM
  • Add a test
klimek added inline comments.Jan 27 2014, 11:12 AM
clang-query/QueryParser.cpp
51

When reading this without the context of how it's used it's hard to know why this is templated, and what the template parameters are supposed to be.

64–71

I find this somewhat hard to read.
Things that might make it easier:

  • pull out a constant for ~0u, or use one of the already existing constants
  • s/SS/Switch/, or find an even more descriptive name what we're switching on here
  • is there a particular reason you're using memcmp instead of using StringRefs and substr and operator==?
clang-query/QueryParser.h
23

While mostly self-explanatory, I still think the public interface might benefit from some comments...

53

I think some of the code later might be simpler if this was an offset from Begin. I might be missing something, though.

pcc updated this revision to Unknown Object (????).Jan 30 2014, 6:22 PM
  • Address review comments
clang-query/QueryParser.cpp
51

Added some comments (here and for lexOrCompleteWord).

64–71

pull out a constant for ~0u, or use one of the already existing constants

Done.

s/SS/Switch/, or find an even more descriptive name what we're switching on here

Done.

is there a particular reason you're using memcmp instead of using StringRefs and substr and operator==?

No particularly good reason. In fact I think the call to memcmp was a memory error. I've changed this as you suggested.

I also got rid of the SeenCases set; I replaced it with a new IsCompletion argument to Case which should make that logic more readable.

clang-query/QueryParser.h
23

Added.

53

The main reason I decided to make this a pointer was that Begin moves along the string as we parse, and if this were an offset we would need to keep it updated.

pcc closed this revision.Jan 31 2014, 5:48 PM

Closed by commit rL200604 (authored by @pcc).