[clang] 3d612a9 - [NFC] Avoid unnecessary duplication of code generating diagnostic.
Dan Liew via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 20 10:50:28 PDT 2022
Author: Dan Liew
Date: 2022-04-20T10:50:21-07:00
New Revision: 3d612a930dce229c887cd9a731084df419f43791
URL: https://github.com/llvm/llvm-project/commit/3d612a930dce229c887cd9a731084df419f43791
DIFF: https://github.com/llvm/llvm-project/commit/3d612a930dce229c887cd9a731084df419f43791.diff
LOG: [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
Added:
Modified:
clang/lib/Sema/SemaExpr.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 7fbe083571e67..58aab637ff308 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -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) {
More information about the cfe-commits
mailing list