diff options
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 3438c3aadc6..4fd5fed5bee 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -191,6 +191,12 @@ bool Expr::isKnownToHaveBooleanValue() const { 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; } |