llvm/llvm-project

Add option to readability-implicit-bool-conversion check to allow implicit conversion *to bool*

Open

#36.323 geöffnet am 2. Apr. 2018

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (1 zugewiesene Person)C++ (10.782 Forks)batch import
bugzillaclang-tidyenhancementgood first issue

Repository-Metriken

Stars
 (26.378 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 1T 2h) (1.000 gemergte PRs in 30 T)

Beschreibung

Bugzilla Link 36975
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

From the readability-implicit-bool-conversion check, I'd like to take advantage of these parts:

  • boolean expression/literal to integer,
  • boolean expression/literal to floating.

But not these:

  • integer expression/literal to boolean,
  • floating expression/literal to boolean,
  • pointer/pointer to member/nullptr/NULL to boolean,

Seems like an AllowConversionsToBool option would take care of this. Maybe for completeness/symmetry also a AllowConversionsFromBool option. Both defaulting to 0.

Contributor Guide