Replace memcpys by a static_cast and an integral promotion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dmitri Gribenko 2013-01-10 21:21:32 +00:00
parent 197616adda
commit f6b6c37ca2

View File

@ -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;
}
}
};