Skip to content

Commit

Permalink
[clang][dataflow] Use existing accessors to check for copy and move a…
Browse files Browse the repository at this point in the history
…ssignment ops.

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D148612
  • Loading branch information
martinboehme committed Apr 24, 2023
1 parent 0b7f53e commit 6b85cc1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions clang/lib/Analysis/FlowSensitive/Transfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,12 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
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);
Expand Down

0 comments on commit 6b85cc1

Please sign in to comment.