[PATCH] D18821: Add modernize-bool-to-integer-conversion

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 7 09:15:59 PDT 2016


alexfh added inline comments.

================
Comment at: clang-tidy/modernize/BoolToIntegerConversionCheck.cpp:47
@@ +46,3 @@
+  const auto Type = Cast->getType().getLocalUnqualifiedType();
+  if (isPreprocessorIndependent(BoolLiteral, Result)) {
+    diag(BoolLiteral->getLocation(), "implicitly converting bool literal to "
----------------
I'd prefer an alternative with less code duplication:

  auto Diag = diag("implicitly converting bool literal to %0%select{|inside a macro}1; use ...") << Type;
  if (<should add fixes>)
    Diag << 1 << FixItHint::...;
  else
    Diag << 0;


http://reviews.llvm.org/D18821





More information about the cfe-commits mailing list