[PATCH] D148612: [clang][dataflow] Use existing accessors to check for copy and move assignment ops.

Martin Böhme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 24 07:32:24 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG6b85cc18eb7b: [clang][dataflow] Use existing accessors to check for copy and move assignment… (authored by mboehme).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148612

Files:
  clang/lib/Analysis/FlowSensitive/Transfer.cpp


Index: clang/lib/Analysis/FlowSensitive/Transfer.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/Transfer.cpp
+++ clang/lib/Analysis/FlowSensitive/Transfer.cpp
@@ -646,9 +646,12 @@
       assert(Arg1 != nullptr);
 
       // Evaluate only copy and move assignment operators.
-      auto *Arg0Type = Arg0->getType()->getUnqualifiedDesugaredType();
-      auto *Arg1Type = Arg1->getType()->getUnqualifiedDesugaredType();
-      if (Arg0Type != Arg1Type)
+      const auto *Method =
+          dyn_cast_or_null<CXXMethodDecl>(S->getDirectCallee());
+      if (!Method)
+        return;
+      if (!Method->isCopyAssignmentOperator() &&
+          !Method->isMoveAssignmentOperator())
         return;
 
       auto *ObjectLoc = Env.getStorageLocation(*Arg0, SkipPast::Reference);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148612.516406.patch
Type: text/x-patch
Size: 838 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230424/ec0530ab/attachment.bin>


More information about the cfe-commits mailing list