[PATCH] D66590: [clangd] Fix toHalfOpenFileRange where start/end endpoints are in different files due to #include
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 27 01:38:49 PDT 2019
sammccall marked an inline comment as done.
sammccall added inline comments.
================
Comment at: clang-tools-extra/clangd/SourceCode.cpp:284
+ return SM.getComposedLoc(IncludingFile, Offset);
+ if (Buf[Offset] == '\n' || Offset == 0) // no hash, what's going on?
+ return SourceLocation();
----------------
SureYeaah wrote:
> nit: use this as a while condition?
>
> ```
> while(Offset-- && Buf[Offset] != '\n')
> ```
Ooh, clever... a little too subtle for my taste though :-)
(In particular, allowing the variable to overflow but then ensuring we never read from it...)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66590/new/
https://reviews.llvm.org/D66590
More information about the cfe-commits
mailing list