Skip to content

Commit

Permalink
[NFC] Avoid unnecessary duplication of code generating diagnostic.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
danliew-apple committed Apr 20, 2022
1 parent 5e54a41 commit 3d612a9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions clang/lib/Sema/SemaExpr.cpp
Expand Up @@ -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) {
Expand Down

0 comments on commit 3d612a9

Please sign in to comment.