[Sema] Fix a -Wobjc-signed-char-bool false-positive
Unsigned bit-field flags can only have boolean values, so handle that case in
Expr::isKnownToHaveBooleanValue.
rdar://56256999
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 3438c3a..4fd5fed5 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -191,6 +191,12 @@
if (const auto *OVE = dyn_cast<OpaqueValueExpr>(E))
return OVE->getSourceExpr()->isKnownToHaveBooleanValue();
+ if (const FieldDecl *FD = E->getSourceBitField())
+ if (FD->getType()->isUnsignedIntegerType() &&
+ !FD->getBitWidth()->isValueDependent() &&
+ FD->getBitWidthValue(FD->getASTContext()) == 1)
+ return true;
+
return false;
}