Skip to content

Commit 6e523d8

Browse files
committed
review from 5chmidti
1 parent 793dc97 commit 6e523d8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ static bool assignsToBoolean(const BinaryOperator *BinOp, ASTContext *AC) {
4141
// Special handling for `template<bool bb=true|1>` cases
4242
if (const auto *D = ParentNoParen->get<Decl>()) {
4343
if (const auto *NTTPD = dyn_cast<NonTypeTemplateParmDecl>(D)) {
44-
if (NTTPD->getType()->isBooleanType())
44+
if (NTTPD->getType().getDesugaredType(*AC)->isBooleanType())
4545
return true;
4646
}
4747
}
4848

4949
if (const auto *S = ParentNoParen->get<Stmt>()) {
5050
if (const auto *ICE = dyn_cast<ImplicitCastExpr>(S)) {
51-
if (ICE->getType()->isBooleanType())
51+
if (ICE->getType().getDesugaredType(*AC)->isBooleanType())
5252
return true;
5353
}
5454
}
@@ -90,8 +90,8 @@ static bool isBooleanBitwise(const BinaryOperator *BinOp, ASTContext *AC, std::o
9090
for (const auto &[Bitwise, _] : OperatorsTransformation) {
9191
if (BinOp->getOpcodeStr() == Bitwise) {
9292
const bool hasBooleanOperands = llvm::all_of(
93-
std::array{BinOp->getLHS(), BinOp->getRHS()}, [](const Expr *E) {
94-
return E->IgnoreImpCasts()->getType().getTypePtr()->isBooleanType();
93+
std::array{BinOp->getLHS(), BinOp->getRHS()}, [&](const Expr *E) {
94+
return E->IgnoreImpCasts()->getType().getDesugaredType(*AC)->isBooleanType();
9595
});
9696
if (hasBooleanOperands) {
9797
rootAssignsToBoolean = rootAssignsToBoolean.value_or(false);
@@ -101,7 +101,7 @@ static bool isBooleanBitwise(const BinaryOperator *BinOp, ASTContext *AC, std::o
101101
rootAssignsToBoolean = rootAssignsToBoolean.value_or(true);
102102
return true;
103103
}
104-
if (BinOp->isCompoundAssignmentOp() && BinOp->getLHS()->IgnoreImpCasts()->getType().getTypePtr()->isBooleanType()) {
104+
if (BinOp->isCompoundAssignmentOp() && BinOp->getLHS()->IgnoreImpCasts()->getType().getDesugaredType(*AC)->isBooleanType()) {
105105
rootAssignsToBoolean = rootAssignsToBoolean.value_or(true);
106106
return true;
107107
}
@@ -144,8 +144,8 @@ void BoolBitwiseOperationCheck::emitWarningAndChangeOperatorsIfPossible(
144144
};
145145

146146
const bool HasVolatileOperand = llvm::any_of(
147-
std::array{BinOp->getLHS(), BinOp->getRHS()}, [](const Expr *E) {
148-
return E->IgnoreImpCasts()->getType().isVolatileQualified();
147+
std::array{BinOp->getLHS(), BinOp->getRHS()}, [&](const Expr *E) {
148+
return E->IgnoreImpCasts()->getType().getDesugaredType(Ctx).isVolatileQualified();
149149
});
150150
if (HasVolatileOperand)
151151
return static_cast<void>(DiagEmitter());

0 commit comments

Comments
 (0)