[PATCH] D18745: [clang-tidy] Adds modernize-use-bool-literals check.

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 6 03:24:00 PDT 2016


Prazek added a comment.

So the testing on llvm shows mostly one case - using DEBUG macro like this:

/home/prazek/llvm/lib/Support/APInt.cpp:1656:9: warning: implicitly converting integer literal to bool inside macro, use bool literal instead [modernize-use-bool-literals]

  DEBUG(dbgs() << " " << r[i]);
  ^

/home/prazek/llvm/include/llvm/Support/Debug.h:92:18: note: expanded from macro 'DEBUG'
#define DEBUG(X) DEBUG_WITH_TYPE(DEBUG_TYPE, X)

  ^

/home/prazek/llvm/include/llvm/Support/Debug.h:69:48: note: expanded from macro 'DEBUG_WITH_TYPE'
#define DEBUG_WITH_TYPE(TYPE, X) do { } while (0)

       ^

Some programers maybe would like to supress this in the case of expressions like while(1), or specially when it is inside macro. 
What do you think guys? Should we add some special option like supress-for-while or supress-macro-while?


http://reviews.llvm.org/D18745





More information about the cfe-commits mailing list