[PATCH] D55793: [clang-tidy] Add duplicated access specifier readability check (PR25403)

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 23 04:19:31 PST 2018


JonasToth added inline comments.


================
Comment at: clang-tidy/readability/DuplicatedAccessSpecifiersCheck.cpp:51
+      diag(ASDecl->getLocation(), "duplicated access specifier")
+          << MatchedDecl
+          << FixItHint::CreateRemoval(ASDecl->getSourceRange());
----------------
aaron.ballman wrote:
> m4tx wrote:
> > aaron.ballman wrote:
> > > There is no %0 in the diagnostic string, so I'm not certain what this argument is trying to print out. Did you mean `ASDecl->getSourceRange()` for the underlining?
> > Sorry, this is another line I forgot to remove. Thanks for pointing this out!
> > 
> > By the way, does the underlining work in clang-tidy's `diag()` function? I see it is used outside the project, but here only `FixItHint`s seem to generate underline in the generated messages.
> That's a good question that I don't actually know the answer to. :-D I believe it still works -- you can try it out by passing a `SourceRange` to the `diag()` call, like:
> ```
> diag(LastASDecl->getLocation(), "duplicated access specifier") << SomeSourceRange;
> ```
> You should see the range from `SomeSourceRange` underlined.
I believe, if you pass in a token or tokenrange or so, the underlying exists. I thought i got suprised by something like that once, not sure though.


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

https://reviews.llvm.org/D55793





More information about the cfe-commits mailing list