[clang-tools-extra] r326314 - [clang-tidy] Add a test for readability-implicit-bool-conversion with bitfields.
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 28 02:30:25 PST 2018
Author: alexfh
Date: Wed Feb 28 02:30:25 2018
New Revision: 326314
URL: http://llvm.org/viewvc/llvm-project?rev=326314&view=rev
Log:
[clang-tidy] Add a test for readability-implicit-bool-conversion with bitfields.
Modified:
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp
Modified: clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp?rev=326314&r1=326313&r2=326314&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp Wed Feb 28 02:30:25 2018
@@ -12,6 +12,7 @@ int* functionReturningPointer();
struct Struct {
int member;
+ unsigned bitfield : 1;
};
@@ -23,6 +24,11 @@ void regularImplicitConversionIntegerToB
}
void implicitConversionIntegerToBoolInConditionalsIsAllowed() {
+ Struct s = {};
+ if (s.member) {}
+ if (!s.member) {}
+ if (s.bitfield) {}
+ if (!s.bitfield) {}
if (functionReturningInt()) {}
if (!functionReturningInt()) {}
if (functionReturningInt() && functionReturningPointer()) {}
More information about the cfe-commits
mailing list