OSDN Git Service

[APInt] Give the value union a name so we can remove assumptions on VAL being the...
authorCraig Topper <craig.topper@gmail.com>
Wed, 3 May 2017 15:46:24 +0000 (15:46 +0000)
committerCraig Topper <craig.topper@gmail.com>
Wed, 3 May 2017 15:46:24 +0000 (15:46 +0000)
commit52bc9d91024320864fc986029b0aa2d3c35d4e02
tree92a23cdac9b0c5db0d674e5aa9826a0ba4553210
parent8364badbd91f99ee3c654aac2cc486c26b787382
[APInt] Give the value union a name so we can remove assumptions on VAL being the larger member

Currently several places assume the VAL member is always at least the same size as pVal. In particular for a memcpy in the move assignment operator. While this is a true assumption, it isn't good practice to assume this.

This patch gives the union a name so we can write the memcpy in terms of the union itself. This also adds a similar memcpy to the move constructor where we previously just copied using VAL directly.

This patch is mostly just a mechanical addition of the U in front of VAL and pVAL everywhere. But several constructors had to be modified since we can't directly initializer a field of named union from the initializer list.

Differential Revision: https://reviews.llvm.org/D30629

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302040 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/APInt.h
lib/IR/LLVMContextImpl.h
lib/Support/APInt.cpp