[PATCH] D56415: NFC: Port QueryParser to StringRef
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 8 08:47:13 PST 2019
steveire marked an inline comment as done.
steveire added inline comments.
================
Comment at: clang-query/QueryParser.cpp:33
+ if (Line.empty())
+ return StringRef(Line.begin(), 0);
----------------
aaron.ballman wrote:
> steveire wrote:
> > aaron.ballman wrote:
> > > Why not just return `Line`?
> > It is the pre-existing behavior to return a zero-length StringRef with a valid Begin pointer in this case. I think the reason is something to do with code completion. I can check later.
> I believe returning `Line` is identical -- you should wind up with the same "begin" pointer for the returned string and a length of zero (because `Line` must be empty by this point).
Actually, I can see it by reading the code - `P->CompletionPos <= Word.data()` in the `LexOrCompleteWord` ctor woudln't work anymore without this hack. (Working on removing the hack is out of scope of this change).
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56415/new/
https://reviews.llvm.org/D56415
More information about the cfe-commits
mailing list