[PATCH] D124054: [NFC] Avoid unnecessary duplication of code generating diagnostic.

Dan Liew via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 10:50:37 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG3d612a930dce: [NFC] Avoid unnecessary duplication of code generating diagnostic. (authored by delcypher).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124054/new/

https://reviews.llvm.org/D124054

Files:
  clang/lib/Sema/SemaExpr.cpp


Index: clang/lib/Sema/SemaExpr.cpp
===================================================================
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -16932,10 +16932,12 @@
   }
 
   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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124054.423965.patch
Type: text/x-patch
Size: 778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220420/9d786fcd/attachment-0001.bin>


More information about the cfe-commits mailing list