[PATCH] Enhance clang-tidy readability-simplify-boolean-expr check to handle chained conditional assignment and chained conditional return

Alexander Kornienko alexfh at google.com
Thu May 7 07:01:36 PDT 2015


Looks good!

Sorry for the long delay. I was on vacation. Do you need me to commit this for you?


================
Comment at: clang-tidy/readability/SimplifyBooleanExprCheck.cpp:208
@@ +207,3 @@
+  if (ChainedConditionalReturn) {
+    Finder->addMatcher(ifStmt(isExpansionInMainFile(),
+                              hasThen(ReturnsBool(Value, ThenLiteralId)),
----------------
I guess I missed this in the initial code review.

Using `isExpansionInMainFile()` you disable fixes in headers which is sub-optimal. I think we should disable fixes in macros (and when a `true` or `false` comes from a macro) in a different way: check the relevant source location for being a file location (`SourceLocation::isFileID`). 

This is fine for a follow up.

http://reviews.llvm.org/D8996

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list