Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11684,15 +11684,6 @@ static void DiagnoseFloatingImpCast(Sema &S, const Expr *E, QualType T,
}
}

static void CheckCommaOperand(Sema &S, Expr *E, QualType T, SourceLocation CC,
bool ExtraCheckForImplicitConversion) {
E = E->IgnoreParenImpCasts();
AnalyzeImplicitConversions(S, E, CC);

if (ExtraCheckForImplicitConversion && E->getType() != T)
S.CheckImplicitConversion(E, T, CC);
}

/// Analyze the given compound assignment for the possible losing of
/// floating-point precision.
static void AnalyzeCompoundAssignment(Sema &S, BinaryOperator *E) {
Expand Down Expand Up @@ -12567,6 +12558,17 @@ struct AnalyzeImplicitConversionsWorkItem {
};
}

static void CheckCommaOperand(
Sema &S, Expr *E, QualType T, SourceLocation CC,
bool ExtraCheckForImplicitConversion,
llvm::SmallVectorImpl<AnalyzeImplicitConversionsWorkItem> &WorkList) {
E = E->IgnoreParenImpCasts();
WorkList.push_back({E, CC, false});

if (ExtraCheckForImplicitConversion && E->getType() != T)
S.CheckImplicitConversion(E, T, CC);
}

/// Data recursive variant of AnalyzeImplicitConversions. Subexpressions
/// that should be visited are added to WorkList.
static void AnalyzeImplicitConversions(
Expand Down Expand Up @@ -12642,9 +12644,9 @@ static void AnalyzeImplicitConversions(
/// how CheckConditionalOperand behaves; it's as-if the correct operand
/// were directly used for the implicit conversion check.
CheckCommaOperand(S, BO->getLHS(), T, BO->getOperatorLoc(),
/*ExtraCheckForImplicitConversion=*/false);
/*ExtraCheckForImplicitConversion=*/false, WorkList);
CheckCommaOperand(S, BO->getRHS(), T, BO->getOperatorLoc(),
/*ExtraCheckForImplicitConversion=*/true);
/*ExtraCheckForImplicitConversion=*/true, WorkList);
return;
}
}
Expand Down
Loading
Loading