[PATCH] D68969: [clang-format] Remove the dependency on frontend

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 02:06:51 PDT 2019


MyDeveloperDay marked 2 inline comments as done.
MyDeveloperDay added a comment.





================
Comment at: clang/tools/clang-format/ClangFormat.cpp:345
   if (WarnFormat && !NoWarnFormat) {
+    ArrayRef<std::pair<unsigned, unsigned>> Ranges;
     for (const auto &R : Replaces) {
----------------
klimek wrote:
> Looks unused?
correct, I changed my mind and now call ArrayRef<std::pair<unsigned, unsigned>>() as the last argument not sure if thay would be slower than me creating one empty one outside the loop, any thoughts? I'll go with a consensus and will remove the other.


================
Comment at: clang/tools/clang-format/ClangFormat.cpp:351
+      SourceLocation LineBegin = Sources.translateFileLineCol(
+          FileEntryPtr.get(), PLoc.getLine() - 1, 0);
+      SourceLocation NextLineBegin =
----------------
klimek wrote:
> This is unexpected: I'd have expected this to be PLoc.getLine() here and PLoc.getLine() + 1 below. I'm probably missing something?
This caught me out too, but it kept pulling the next line. So I think it must be a zero based line as opposed to PesumedLoc which uses line 1 to mean the first line..

but leet me double check.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68969/new/

https://reviews.llvm.org/D68969





More information about the cfe-commits mailing list