[PATCH] Add readability-simplify-boolean-expr check to clang-tidy

Richard legalize at xmission.com
Mon Feb 16 08:39:55 PST 2015

In article <CAPtQZ7-7UQAN9KcoQ8XGKht16tiFaRBHq0yM7=qTz-ucek0MkQ at mail.gmail.com>,
    Ismail Pazarbasi <ismail.pazarbasi at gmail.com> writes:

> Yes, that was my concern. I think we should avoid correcting or
> warning about macros eagerly.

I agree.

>   // foo.h
>   #define EXPECT_FALSE(x) ((x) == false) // macro written in a header file
>   // foo.cpp
>   #include "foo.h"
>   #define MY_EXPECT_FALSE(x) ((x) == false)
>   static void f() {
>     if (EXPECT_FALSE(0 == 1)); // ok
>     if (MY_EXPECT_FALSE(0 == 1)); // warn
>   }

I will add this (or something similar) to my FileCheck test suite.

I was using isExpansionInMainFile() to avoid matching any system
included headers, but perhaps I was misunderstanding how that
narrowing matcher works.
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>

More information about the cfe-commits mailing list