[PATCH] D75286: [clangd] Handle clang-tidy suppression comments for diagnostics inside macro expansions

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 28 17:44:07 PDT 2020


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:708-710
+    return std::tie(M1.FilePath, M1.FileOffset, LHS.DiagnosticName,
+                    M1.Message) <
+           std::tie(M2.FilePath, M2.FileOffset, RHS.DiagnosticName, M2.Message);
----------------
nridge wrote:
> nridge wrote:
> > sammccall wrote:
> > > nridge wrote:
> > > > njames93 wrote:
> > > > > This looks like a clang-format artifact, there are several other below. Could these be removed from this patch
> > > > If you insist, I can move them to a separate patch. I don't want to leave it unmodified because the change will come back every time someone touches the file.
> > > I don't personally care about this too much, but the changes are somewhat distracting in review, blame etc.
> > > 
> > > The policy we've mostly followed is to format changed lines only (git clang-format, turn format-on-save off) and leave misformatted code alone until it's next touched.
> > > 
> > > (Not sure if LLVM offers any guidance either way, but that's what Google does internally and IME it's been great)
> > The issue I have with that is that turning format-on-save off means you inevitably end up doing a lot of manual formatting as you write the code. With format-on-save, you can just write the tokens for a statement not caring about the formatting, do a save, and have the statement be formatted before you start writing the next one.
> I guess what we really want is "format on save for modified lines only". I found a [VSCode extension](https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.format-modified) which does that, I'll give that a try.
What I do (apart from when i forget) is run git clang-format before creating the patch, Then just don't worry about formatting while I'm writing the code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75286





More information about the cfe-commits mailing list