================
Comment at: tools/clang-format/ClangFormat.cpp:190
@@ +189,3 @@
+ SourceLocation Start = Sources.translateLineCol(ID, FromLine, 1);
+ SourceLocation End = Sources.translateLineCol(ID, ToLine, (unsigned)-1);
+ if (Start.isInvalid() || End.isInvalid())
----------------
Daniel Jasper wrote:
> (unsigned)-1?????
>
> I think just using Sources.translateLineCol(ID, ToLine, 1) should almost
> always lead to the same result (but I am not 100% sure).
>
> How about:
> Sources.translateLineCol(ID, ToLine + 1, 1).getLocWithOffset(-1)?
I was also not sure about (unsigned)-1, but we should use a large number to
ensure the whole line is included in the range to avoid problems when multiple
statements are in one line. ToLine + 1 may fail to work for the last line. I've
changed this to UINT_MAX for now.
================
Comment at: tools/clang-format/ClangFormat.cpp:175
@@ +174,3 @@
+ if (!Offsets.empty() || !Lengths.empty()) {
+ llvm::errs() << "error: can not use -lines with -offset/-length\n";
+ return true;
----------------
Daniel Jasper wrote:
> nit: cannot
Done.
http://llvm-reviews.chandlerc.com/D1160
BRANCH
svn
ARCANIST PROJECT
clang
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits