File tree Expand file tree Collapse file tree 5 files changed +4
-59
lines changed Expand file tree Collapse file tree 5 files changed +4
-59
lines changed Original file line number Diff line number Diff line change @@ -555,22 +555,15 @@ bool NarrowingConversionsCheck::handleConditionalOperator(
555
555
// We have an expression like so: `output = cond ? lhs : rhs`
556
556
// From the point of view of narrowing conversion we treat it as two
557
557
// expressions `output = lhs` and `output = rhs`.
558
- handleConditionalOperatorArgument (Context, Lhs, CO->getLHS ());
559
- handleConditionalOperatorArgument (Context, Lhs, CO->getRHS ());
558
+ handleBinaryOperator (Context, CO->getLHS ()->getExprLoc (), Lhs,
559
+ *CO->getLHS ());
560
+ handleBinaryOperator (Context, CO->getRHS ()->getExprLoc (), Lhs,
561
+ *CO->getRHS ());
560
562
return true ;
561
563
}
562
564
return false ;
563
565
}
564
566
565
- void NarrowingConversionsCheck::handleConditionalOperatorArgument (
566
- const ASTContext &Context, const Expr &Lhs, const Expr *Arg) {
567
- if (const auto *ICE = llvm::dyn_cast<ImplicitCastExpr>(Arg))
568
- if (!Arg->getIntegerConstantExpr (Context))
569
- Arg = ICE->getSubExpr ();
570
-
571
- handleBinaryOperator (Context, Arg->getExprLoc (), Lhs, *Arg);
572
- }
573
-
574
567
void NarrowingConversionsCheck::handleImplicitCast (
575
568
const ASTContext &Context, const ImplicitCastExpr &Cast) {
576
569
if (Cast.getExprLoc ().isMacroID ())
Original file line number Diff line number Diff line change @@ -85,8 +85,6 @@ class NarrowingConversionsCheck : public ClangTidyCheck {
85
85
bool handleConditionalOperator (const ASTContext &Context, const Expr &Lhs,
86
86
const Expr &Rhs);
87
87
88
- void handleConditionalOperatorArgument (const ASTContext &Context,
89
- const Expr &Lhs, const Expr *Arg);
90
88
void handleImplicitCast (const ASTContext &Context,
91
89
const ImplicitCastExpr &Cast);
92
90
Original file line number Diff line number Diff line change @@ -134,10 +134,6 @@ Changes in existing checks
134
134
<clang-tidy/checks/bugprone/infinite-loop>` check by adding detection for
135
135
variables introduced by structured bindings.
136
136
137
- - Improved :doc: `bugprone-narrowing-conversions
138
- <clang-tidy/checks/bugprone/narrowing-conversions>` check by fixing
139
- false positive from analysis of a conditional expression in C.
140
-
141
137
- Improved :doc: `bugprone-reserved-identifier
142
138
<clang-tidy/checks/bugprone/reserved-identifier>` check by ignoring
143
139
declarations in system headers.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments