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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 21 11:57:55 PST 2018


aaron.ballman added inline comments.


================
Comment at: clang-tidy/readability/DuplicatedAccessSpecifiersCheck.cpp:51
+      diag(ASDecl->getLocation(), "duplicated access specifier")
+          << MatchedDecl
+          << FixItHint::CreateRemoval(ASDecl->getSourceRange());
----------------
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.


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

https://reviews.llvm.org/D55793





More information about the cfe-commits mailing list