[PATCH] D81785: [clangd] Fix readability-else-after-return 'Adding a note without main diagnostic' crash

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 15 08:41:05 PDT 2020


njames93 added inline comments.


================
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;
----------------
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.


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