[NFC] Avoid unnecessary duplication of code generating diagnostic.

The previous code unneccessarily duplicated the creation of a diagnostic
where the only difference was the `AssignmentAction` being passed.

rdar://88664722

Differential Revision: https://reviews.llvm.org/D124054
This commit is contained in:
Dan Liew 2022-04-19 16:28:33 -07:00
parent 5e54a413de
commit 3d612a930d
1 changed files with 5 additions and 3 deletions

View File

@ -16932,10 +16932,12 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
}
PartialDiagnostic FDiag = PDiag(DiagKind);
AssignmentAction ActionForDiag = Action;
if (Action == AA_Passing_CFAudited)
FDiag << FirstType << SecondType << AA_Passing << SrcExpr->getSourceRange();
else
FDiag << FirstType << SecondType << Action << SrcExpr->getSourceRange();
ActionForDiag = AA_Passing;
FDiag << FirstType << SecondType << ActionForDiag
<< SrcExpr->getSourceRange();
if (DiagKind == diag::ext_typecheck_convert_incompatible_pointer_sign ||
DiagKind == diag::err_typecheck_convert_incompatible_pointer_sign) {