[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 06:11:20 PDT 2023


mboehme updated this revision to Diff 516378.
mboehme added a comment.

Rebased to head


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.516378.patch
Type: text/x-patch
Size: 838 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230424/5929a37c/attachment.bin>


More information about the cfe-commits mailing list