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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 21 12:29:07 PDT 2019


aaron.ballman 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>;
----------------
xbolva00 wrote:
> 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.. 
I don't have a good recommendation for a replacement for "boolean context", so I suppose we can leave it.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5625
+  "evaluate to 'true'">,
+  InGroup<IntInBoolContext>;
+
----------------
xbolva00 wrote:
> aaron.ballman wrote:
> > This one seems like it should be in the `TautologicalConstantCompare` group, no?
> Yes, we could move it there.
Don't *all* of these effectively boil down to a tautological comparison?


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

https://reviews.llvm.org/D63082





More information about the cfe-commits mailing list