Skip to content

Commit 19d8261

Browse files
committed
simple optional usage
1 parent bf5f745 commit 19d8261

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

clang-tools-extra/clang-tidy/performance/BoolBitwiseOperationCheck.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,11 @@ void BoolBitwiseOperationCheck::check(const MatchFinder::MatchResult &Result) {
204204
RHSOpcode = RHS->getOpcode();
205205

206206
const BinaryOperator *SurroundedExpr = nullptr;
207-
if ((MatchedExpr->getOpcode() == BO_Or && ParentOpcode.has_value() &&
208-
*ParentOpcode == BO_LAnd) ||
209-
(MatchedExpr->getOpcode() == BO_And && ParentOpcode.has_value() &&
210-
llvm::is_contained({BO_Xor, BO_Or}, *ParentOpcode)))
207+
if ((MatchedExpr->getOpcode() == BO_Or && ParentOpcode == BO_LAnd) ||
208+
(MatchedExpr->getOpcode() == BO_And &&
209+
llvm::is_contained({BO_Xor, BO_Or}, ParentOpcode)))
211210
SurroundedExpr = MatchedExpr;
212-
else if (MatchedExpr->getOpcode() == BO_AndAssign && RHSOpcode.has_value() &&
213-
*RHSOpcode == BO_LOr)
211+
else if (MatchedExpr->getOpcode() == BO_AndAssign && RHSOpcode == BO_LOr)
214212
SurroundedExpr = RHS;
215213

216214
if (hasExplicitParentheses(SurroundedExpr, *Result.SourceManager,

0 commit comments

Comments
 (0)