[PATCH] D81785: [clangd] Fix readability-else-after-return 'Adding a note without main diagnostic' crash
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 16 01:04:22 PDT 2020
hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp:191
// scope, we can pull the decl out of the if statement.
- DiagnosticBuilder Diag =
- diag(ElseLoc, WarningMessage, clang::DiagnosticIDs::Level::Remark)
- << ControlFlowInterruptor;
+ DiagnosticBuilder Diag = diag(ElseLoc, WarningMessage)
+ << ControlFlowInterruptor;
----------------
njames93 wrote:
> hokein wrote:
> > this would change the output of the check, I suppose this is not covered in `readability-else-after-return.cpp` lit test (that test only tests `warning` messages), could you add a test there? then we don't need a test case in clangd.
> For some reason, I don't know why, it doesn't appear to. I changed all diags in the check to use remark, yet the outputs all said warning. not sure why though. There is a test case already for this specific case in the check that looks for warning. maybe I should just remove the clangd test case though, its not terribly important for this.
thanks.
It seems that clang-tidy doesn't fully respect all diagnostic levels, it just supports `Warning`, and `Error`, see https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp#L411.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81785/new/
https://reviews.llvm.org/D81785
More information about the cfe-commits
mailing list