Skip to content

Commit

Permalink
Replace memcpys by a static_cast and an integral promotion.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172108 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
gribozavr committed Jan 10, 2013
1 parent 197616a commit f6b6c37
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions unittests/Support/YAMLIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,15 +785,13 @@ namespace yaml {
// Type of "flags" field varies depending on "kind" field.
// Use memcpy here to avoid breaking strict aliasing rules.
if (kf.kind == kindA) {
AFlags aflags;
memcpy(&aflags, &kf.flags, sizeof(aflags));
AFlags aflags = static_cast<AFlags>(kf.flags);
io.mapRequired("flags", aflags);
memcpy(&kf.flags, &aflags, sizeof(kf.flags));
kf.flags = aflags;
} else {
BFlags bflags;
memcpy(&bflags, &kf.flags, sizeof(bflags));
BFlags bflags = static_cast<BFlags>(kf.flags);
io.mapRequired("flags", bflags);
memcpy(&kf.flags, &bflags, sizeof(kf.flags));
kf.flags = bflags;
}
}
};
Expand Down

0 comments on commit f6b6c37

Please sign in to comment.