[PATCH] D65919: [clang-tidy] Add llvm-prefer-register-over-unsigned check and apply it to LLVM

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 9 04:49:49 PDT 2019


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp:53
+  }
+  diag(UserVarDecl->getLocation(), "use '%0'", DiagnosticIDs::Note)
+      << Replacement
----------------
dsanders wrote:
> aaron.ballman wrote:
> > I don't think you should issue a second diagnostic on the same line. Instead, only issue the previous diagnostic with the fixit attached to it.
> I don't mind changing this but I thought I should mention that I'm following the example set by the code generated by add_new_check.py which has the diagnostic separate from the note with the fixit:
> ```
>   diag(MatchedDecl->getLocation(), "function %%0 is insufficiently awesome")
>       << MatchedDecl;
>   diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note)
>       << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
> ```
> Is the example doing it the right way?
That script is intended to generate boilerplate so that you don't have to and to show a very minimal example of how to print output. So it's both correct and not particularly helpful for real checks at the same time, if that makes sense.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65919





More information about the cfe-commits mailing list