From: Alexander Kornienko Date: Wed, 28 Feb 2018 10:30:25 +0000 (+0000) Subject: [clang-tidy] Add a test for readability-implicit-bool-conversion with bitfields. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a94a4308e1bccddfa76d7836ad6c2ddf401caa09;p=platform%2Fupstream%2Fllvm.git [clang-tidy] Add a test for readability-implicit-bool-conversion with bitfields. llvm-svn: 326314 --- diff --git a/clang-tools-extra/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp b/clang-tools-extra/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp index 13524de..c50b798 100644 --- a/clang-tools-extra/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp @@ -12,6 +12,7 @@ int* functionReturningPointer(); struct Struct { int member; + unsigned bitfield : 1; }; @@ -23,6 +24,11 @@ void regularImplicitConversionIntegerToBoolIsNotIgnored() { } void implicitConversionIntegerToBoolInConditionalsIsAllowed() { + Struct s = {}; + if (s.member) {} + if (!s.member) {} + if (s.bitfield) {} + if (!s.bitfield) {} if (functionReturningInt()) {} if (!functionReturningInt()) {} if (functionReturningInt() && functionReturningPointer()) {}