[PATCH] D23265: [clang-tidy] enhance readability-else-after-return
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 8 07:33:57 PDT 2016
aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a reviewer: aaron.ballman.
================
Comment at: clang-tidy/readability/ElseAfterReturnCheck.cpp:38-40
@@ -34,2 +37,5 @@
SourceLocation ElseLoc = If->getElseLoc();
- DiagnosticBuilder Diag = diag(ElseLoc, "don't use else after return");
+ StringRef DiagMessage = "do not use 'else' or 'else if' after something that "
+ "interrupts control flow - like return, break, "
+ "throw, continue, goto, etc";
+ DiagnosticBuilder Diag = diag(ElseLoc, DiagMessage);
----------------
I think it might be better to specifically identify the flow control construct used instead of a laundry list of possibilities. Then it can be "do not use '%select{else|else if}0' after '%1'".
https://reviews.llvm.org/D23265
More information about the cfe-commits
mailing list