Fix a couple of self-assignments using memcpy.
ClosedPublic

Authored by hintonda on Thu, Nov 2, 4:03 PM.

Details

Summary

These two methods are essentially assignents, but don't check
for self-assignment and use memcpy for member variables.

Since they aren't actually operator=(), it's unclear what should be done:

  • check and shortcut
  • assert
  • allow but s/memcpy/memmove/

Diff Detail

Repository
rL LLVM
hintonda created this revision.Thu, Nov 2, 4:03 PM
clayborg requested changes to this revision.Mon, Nov 13, 10:11 AM

First change looks good. Second one we can probably avoid doing anything in Value::AppendDataToHostBuffer and return 0. No need to copy data over itself.

source/Core/Value.cpp
146–147 ↗(On Diff #121405)

Should probably return 0 if this == &rhs?

This revision now requires changes to proceed.Mon, Nov 13, 10:11 AM
hintonda updated this revision to Diff 122730.Mon, Nov 13, 2:26 PM
  • Address comments.
clayborg accepted this revision.Tue, Nov 14, 9:13 AM
This revision is now accepted and ready to land.Tue, Nov 14, 9:13 AM
This revision was automatically updated to reflect the committed changes.