[PATCH] D63082: [Diagnostics] Added support for -Wint-in-bool-context

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 13:01:07 PDT 2019


xbolva00 marked 3 inline comments as done.
xbolva00 added inline comments.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5609
+def warn_mul_in_bool_context : Warning<
+  "'*' in bool context, maybe you mean '&&'?">,
+  InGroup<IntInBoolContext>;
----------------
aaron.ballman wrote:
> I would appreciate seeing some motivating examples for this case, because it seems like the `&&` suggestion is misleading more often than it's helpful in the current test cases.
> 
> Also, what is a "bool context"?
Bool context - places where we expect boolean expressions.

If you have idea for better terminology, I am happy to apply it.

Yeah, I will remove “&&” suggestion.. 


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5611
+  InGroup<IntInBoolContext>;
+def warn_left_shift_in_bool_context : Warning<
+  "'<<' in bool context, maybe you mean '<'?">,
----------------
Oh, inconsistency. I will use boolean context than bool context :)  (if no suggestions)


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5625
+  "evaluate to 'true'">,
+  InGroup<IntInBoolContext>;
+
----------------
aaron.ballman wrote:
> This one seems like it should be in the `TautologicalConstantCompare` group, no?
Yes, we could move it there.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63082/new/

https://reviews.llvm.org/D63082





More information about the cfe-commits mailing list