<p dir="ltr">An accidental C++11ism slipped in. Thanks for the revert :)</p>
<div class="gmail_quote">On 8 Jan 2014 21:06, "Argyrios Kyrtzidis" <<a href="mailto:akyrtzi@gmail.com">akyrtzi@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Reverted in r198849.<br>
<br>
On Jan 8, 2014, at 8:31 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
<br>
> Hi Richard,<br>
><br>
> I believe that your commit r198845 has broken the following buildbot:<br>
><br>
> <a href="http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/11015" target="_blank">http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/11015</a><br>
><br>
> Would you please fix this?<br>
><br>
> Thanks,<br>
> Duncan<br>
><br>
> On 2014 Jan 8, at 19:29, Richard Smith <<a href="mailto:richard-llvm@metafoo.co.uk">richard-llvm@metafoo.co.uk</a>> wrote:<br>
><br>
>> Author: rsmith<br>
>> Date: Wed Jan 8 21:29:54 2014<br>
>> New Revision: 198845<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=198845&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=198845&view=rev</a><br>
>> Log:<br>
>> PR18427: Use an appropriately-aligned buffer in APValue, to avoid a crash on<br>
>> SPARC, where uint64_t apparently requires higher alignment than void*.<br>
>><br>
>> Modified:<br>
>> cfe/trunk/include/clang/AST/APValue.h<br>
>> cfe/trunk/lib/AST/APValue.cpp<br>
>><br>
>> Modified: cfe/trunk/include/clang/AST/APValue.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/APValue.h?rev=198845&r1=198844&r2=198845&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/APValue.h?rev=198845&r1=198844&r2=198845&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/include/clang/AST/APValue.h (original)<br>
>> +++ cfe/trunk/include/clang/AST/APValue.h Wed Jan 8 21:29:54 2014<br>
>> @@ -108,15 +108,10 @@ private:<br>
>> };<br>
>> struct MemberPointerData;<br>
>><br>
>> - enum {<br>
>> - MaxSize = (sizeof(ComplexAPSInt) > sizeof(ComplexAPFloat) ?<br>
>> - sizeof(ComplexAPSInt) : sizeof(ComplexAPFloat))<br>
>> - };<br>
>> -<br>
>> - union {<br>
>> - void *Aligner;<br>
>> - char Data[MaxSize];<br>
>> - };<br>
>> + // We ensure elsewhere that Data is big enough for LV and MemberPointerData.<br>
>> + llvm::AlignedCharArrayUnion<void *, APSInt, APFloat, ComplexAPSInt,<br>
>> + ComplexAPFloat, Vec, Arr, StructData, UnionData,<br>
>> + AddrLabelDiffData> Data;<br>
>><br>
>> public:<br>
>> APValue() : Kind(Uninitialized) {}<br>
>> @@ -200,7 +195,7 @@ public:<br>
>><br>
>> APSInt &getInt() {<br>
>> assert(isInt() && "Invalid accessor");<br>
>> - return *(APSInt*)(char*)Data;<br>
>> + return *(APSInt*)(char*)Data.buffer;<br>
>> }<br>
>> const APSInt &getInt() const {<br>
>> return const_cast<APValue*>(this)->getInt();<br>
>> @@ -208,7 +203,7 @@ public:<br>
>><br>
>> APFloat &getFloat() {<br>
>> assert(isFloat() && "Invalid accessor");<br>
>> - return *(APFloat*)(char*)Data;<br>
>> + return *(APFloat*)(char*)Data.buffer;<br>
>> }<br>
>> const APFloat &getFloat() const {<br>
>> return const_cast<APValue*>(this)->getFloat();<br>
>> @@ -216,7 +211,7 @@ public:<br>
>><br>
>> APSInt &getComplexIntReal() {<br>
>> assert(isComplexInt() && "Invalid accessor");<br>
>> - return ((ComplexAPSInt*)(char*)Data)->Real;<br>
>> + return ((ComplexAPSInt*)(char*)Data.buffer)->Real;<br>
>> }<br>
>> const APSInt &getComplexIntReal() const {<br>
>> return const_cast<APValue*>(this)->getComplexIntReal();<br>
>> @@ -224,7 +219,7 @@ public:<br>
>><br>
>> APSInt &getComplexIntImag() {<br>
>> assert(isComplexInt() && "Invalid accessor");<br>
>> - return ((ComplexAPSInt*)(char*)Data)->Imag;<br>
>> + return ((ComplexAPSInt*)(char*)Data.buffer)->Imag;<br>
>> }<br>
>> const APSInt &getComplexIntImag() const {<br>
>> return const_cast<APValue*>(this)->getComplexIntImag();<br>
>> @@ -232,7 +227,7 @@ public:<br>
>><br>
>> APFloat &getComplexFloatReal() {<br>
>> assert(isComplexFloat() && "Invalid accessor");<br>
>> - return ((ComplexAPFloat*)(char*)Data)->Real;<br>
>> + return ((ComplexAPFloat*)(char*)Data.buffer)->Real;<br>
>> }<br>
>> const APFloat &getComplexFloatReal() const {<br>
>> return const_cast<APValue*>(this)->getComplexFloatReal();<br>
>> @@ -240,7 +235,7 @@ public:<br>
>><br>
>> APFloat &getComplexFloatImag() {<br>
>> assert(isComplexFloat() && "Invalid accessor");<br>
>> - return ((ComplexAPFloat*)(char*)Data)->Imag;<br>
>> + return ((ComplexAPFloat*)(char*)Data.buffer)->Imag;<br>
>> }<br>
>> const APFloat &getComplexFloatImag() const {<br>
>> return const_cast<APValue*>(this)->getComplexFloatImag();<br>
>> @@ -259,20 +254,20 @@ public:<br>
>> APValue &getVectorElt(unsigned I) {<br>
>> assert(isVector() && "Invalid accessor");<br>
>> assert(I < getVectorLength() && "Index out of range");<br>
>> - return ((Vec*)(char*)Data)->Elts[I];<br>
>> + return ((Vec*)(char*)Data.buffer)->Elts[I];<br>
>> }<br>
>> const APValue &getVectorElt(unsigned I) const {<br>
>> return const_cast<APValue*>(this)->getVectorElt(I);<br>
>> }<br>
>> unsigned getVectorLength() const {<br>
>> assert(isVector() && "Invalid accessor");<br>
>> - return ((const Vec*)(const void *)Data)->NumElts;<br>
>> + return ((const Vec*)(const void *)Data.buffer)->NumElts;<br>
>> }<br>
>><br>
>> APValue &getArrayInitializedElt(unsigned I) {<br>
>> assert(isArray() && "Invalid accessor");<br>
>> assert(I < getArrayInitializedElts() && "Index out of range");<br>
>> - return ((Arr*)(char*)Data)->Elts[I];<br>
>> + return ((Arr*)(char*)Data.buffer)->Elts[I];<br>
>> }<br>
>> const APValue &getArrayInitializedElt(unsigned I) const {<br>
>> return const_cast<APValue*>(this)->getArrayInitializedElt(I);<br>
>> @@ -283,35 +278,35 @@ public:<br>
>> APValue &getArrayFiller() {<br>
>> assert(isArray() && "Invalid accessor");<br>
>> assert(hasArrayFiller() && "No array filler");<br>
>> - return ((Arr*)(char*)Data)->Elts[getArrayInitializedElts()];<br>
>> + return ((Arr*)(char*)Data.buffer)->Elts[getArrayInitializedElts()];<br>
>> }<br>
>> const APValue &getArrayFiller() const {<br>
>> return const_cast<APValue*>(this)->getArrayFiller();<br>
>> }<br>
>> unsigned getArrayInitializedElts() const {<br>
>> assert(isArray() && "Invalid accessor");<br>
>> - return ((const Arr*)(const void *)Data)->NumElts;<br>
>> + return ((const Arr*)(const void *)Data.buffer)->NumElts;<br>
>> }<br>
>> unsigned getArraySize() const {<br>
>> assert(isArray() && "Invalid accessor");<br>
>> - return ((const Arr*)(const void *)Data)->ArrSize;<br>
>> + return ((const Arr*)(const void *)Data.buffer)->ArrSize;<br>
>> }<br>
>><br>
>> unsigned getStructNumBases() const {<br>
>> assert(isStruct() && "Invalid accessor");<br>
>> - return ((const StructData*)(const char*)Data)->NumBases;<br>
>> + return ((const StructData*)(const char*)Data.buffer)->NumBases;<br>
>> }<br>
>> unsigned getStructNumFields() const {<br>
>> assert(isStruct() && "Invalid accessor");<br>
>> - return ((const StructData*)(const char*)Data)->NumFields;<br>
>> + return ((const StructData*)(const char*)Data.buffer)->NumFields;<br>
>> }<br>
>> APValue &getStructBase(unsigned i) {<br>
>> assert(isStruct() && "Invalid accessor");<br>
>> - return ((StructData*)(char*)Data)->Elts[i];<br>
>> + return ((StructData*)(char*)Data.buffer)->Elts[i];<br>
>> }<br>
>> APValue &getStructField(unsigned i) {<br>
>> assert(isStruct() && "Invalid accessor");<br>
>> - return ((StructData*)(char*)Data)->Elts[getStructNumBases() + i];<br>
>> + return ((StructData*)(char*)Data.buffer)->Elts[getStructNumBases() + i];<br>
>> }<br>
>> const APValue &getStructBase(unsigned i) const {<br>
>> return const_cast<APValue*>(this)->getStructBase(i);<br>
>> @@ -322,11 +317,11 @@ public:<br>
>><br>
>> const FieldDecl *getUnionField() const {<br>
>> assert(isUnion() && "Invalid accessor");<br>
>> - return ((const UnionData*)(const char*)Data)->Field;<br>
>> + return ((const UnionData*)(const char*)Data.buffer)->Field;<br>
>> }<br>
>> APValue &getUnionValue() {<br>
>> assert(isUnion() && "Invalid accessor");<br>
>> - return *((UnionData*)(char*)Data)->Value;<br>
>> + return *((UnionData*)(char*)Data.buffer)->Value;<br>
>> }<br>
>> const APValue &getUnionValue() const {<br>
>> return const_cast<APValue*>(this)->getUnionValue();<br>
>> @@ -338,41 +333,41 @@ public:<br>
>><br>
>> const AddrLabelExpr* getAddrLabelDiffLHS() const {<br>
>> assert(isAddrLabelDiff() && "Invalid accessor");<br>
>> - return ((const AddrLabelDiffData*)(const char*)Data)->LHSExpr;<br>
>> + return ((const AddrLabelDiffData*)(const char*)Data.buffer)->LHSExpr;<br>
>> }<br>
>> const AddrLabelExpr* getAddrLabelDiffRHS() const {<br>
>> assert(isAddrLabelDiff() && "Invalid accessor");<br>
>> - return ((const AddrLabelDiffData*)(const char*)Data)->RHSExpr;<br>
>> + return ((const AddrLabelDiffData*)(const char*)Data.buffer)->RHSExpr;<br>
>> }<br>
>><br>
>> void setInt(const APSInt &I) {<br>
>> assert(isInt() && "Invalid accessor");<br>
>> - *(APSInt*)(char*)Data = I;<br>
>> + *(APSInt*)(char*)Data.buffer = I;<br>
>> }<br>
>> void setFloat(const APFloat &F) {<br>
>> assert(isFloat() && "Invalid accessor");<br>
>> - *(APFloat*)(char*)Data = F;<br>
>> + *(APFloat*)(char*)Data.buffer = F;<br>
>> }<br>
>> void setVector(const APValue *E, unsigned N) {<br>
>> assert(isVector() && "Invalid accessor");<br>
>> - ((Vec*)(char*)Data)->Elts = new APValue[N];<br>
>> - ((Vec*)(char*)Data)->NumElts = N;<br>
>> + ((Vec*)(char*)Data.buffer)->Elts = new APValue[N];<br>
>> + ((Vec*)(char*)Data.buffer)->NumElts = N;<br>
>> for (unsigned i = 0; i != N; ++i)<br>
>> - ((Vec*)(char*)Data)->Elts[i] = E[i];<br>
>> + ((Vec*)(char*)Data.buffer)->Elts[i] = E[i];<br>
>> }<br>
>> void setComplexInt(const APSInt &R, const APSInt &I) {<br>
>> assert(R.getBitWidth() == I.getBitWidth() &&<br>
>> "Invalid complex int (type mismatch).");<br>
>> assert(isComplexInt() && "Invalid accessor");<br>
>> - ((ComplexAPSInt*)(char*)Data)->Real = R;<br>
>> - ((ComplexAPSInt*)(char*)Data)->Imag = I;<br>
>> + ((ComplexAPSInt*)(char*)Data.buffer)->Real = R;<br>
>> + ((ComplexAPSInt*)(char*)Data.buffer)->Imag = I;<br>
>> }<br>
>> void setComplexFloat(const APFloat &R, const APFloat &I) {<br>
>> assert(&R.getSemantics() == &I.getSemantics() &&<br>
>> "Invalid complex float (type mismatch).");<br>
>> assert(isComplexFloat() && "Invalid accessor");<br>
>> - ((ComplexAPFloat*)(char*)Data)->Real = R;<br>
>> - ((ComplexAPFloat*)(char*)Data)->Imag = I;<br>
>> + ((ComplexAPFloat*)(char*)Data.buffer)->Real = R;<br>
>> + ((ComplexAPFloat*)(char*)Data.buffer)->Imag = I;<br>
>> }<br>
>> void setLValue(LValueBase B, const CharUnits &O, NoLValuePath,<br>
>> unsigned CallIndex);<br>
>> @@ -381,13 +376,13 @@ public:<br>
>> unsigned CallIndex);<br>
>> void setUnion(const FieldDecl *Field, const APValue &Value) {<br>
>> assert(isUnion() && "Invalid accessor");<br>
>> - ((UnionData*)(char*)Data)->Field = Field;<br>
>> - *((UnionData*)(char*)Data)->Value = Value;<br>
>> + ((UnionData*)(char*)Data.buffer)->Field = Field;<br>
>> + *((UnionData*)(char*)Data.buffer)->Value = Value;<br>
>> }<br>
>> void setAddrLabelDiff(const AddrLabelExpr* LHSExpr,<br>
>> const AddrLabelExpr* RHSExpr) {<br>
>> - ((AddrLabelDiffData*)(char*)Data)->LHSExpr = LHSExpr;<br>
>> - ((AddrLabelDiffData*)(char*)Data)->RHSExpr = RHSExpr;<br>
>> + ((AddrLabelDiffData*)(char*)Data.buffer)->LHSExpr = LHSExpr;<br>
>> + ((AddrLabelDiffData*)(char*)Data.buffer)->RHSExpr = RHSExpr;<br>
>> }<br>
>><br>
>> /// Assign by swapping from a copy of the RHS.<br>
>> @@ -404,46 +399,46 @@ private:<br>
>> }<br>
>> void MakeInt() {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - new ((void*)Data) APSInt(1);<br>
>> + new ((void*)Data.buffer) APSInt(1);<br>
>> Kind = Int;<br>
>> }<br>
>> void MakeFloat() {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - new ((void*)(char*)Data) APFloat(0.0);<br>
>> + new ((void*)(char*)Data.buffer) APFloat(0.0);<br>
>> Kind = Float;<br>
>> }<br>
>> void MakeVector() {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - new ((void*)(char*)Data) Vec();<br>
>> + new ((void*)(char*)Data.buffer) Vec();<br>
>> Kind = Vector;<br>
>> }<br>
>> void MakeComplexInt() {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - new ((void*)(char*)Data) ComplexAPSInt();<br>
>> + new ((void*)(char*)Data.buffer) ComplexAPSInt();<br>
>> Kind = ComplexInt;<br>
>> }<br>
>> void MakeComplexFloat() {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - new ((void*)(char*)Data) ComplexAPFloat();<br>
>> + new ((void*)(char*)Data.buffer) ComplexAPFloat();<br>
>> Kind = ComplexFloat;<br>
>> }<br>
>> void MakeLValue();<br>
>> void MakeArray(unsigned InitElts, unsigned Size);<br>
>> void MakeStruct(unsigned B, unsigned M) {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - new ((void*)(char*)Data) StructData(B, M);<br>
>> + new ((void*)(char*)Data.buffer) StructData(B, M);<br>
>> Kind = Struct;<br>
>> }<br>
>> void MakeUnion() {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - new ((void*)(char*)Data) UnionData();<br>
>> + new ((void*)(char*)Data.buffer) UnionData();<br>
>> Kind = Union;<br>
>> }<br>
>> void MakeMemberPointer(const ValueDecl *Member, bool IsDerivedMember,<br>
>> ArrayRef<const CXXRecordDecl*> Path);<br>
>> void MakeAddrLabelDiff() {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - new ((void*)(char*)Data) AddrLabelDiffData();<br>
>> + new ((void*)(char*)Data.buffer) AddrLabelDiffData();<br>
>> Kind = AddrLabelDiff;<br>
>> }<br>
>> };<br>
>><br>
>> Modified: cfe/trunk/lib/AST/APValue.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/APValue.cpp?rev=198845&r1=198844&r2=198845&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/APValue.cpp?rev=198845&r1=198844&r2=198845&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/AST/APValue.cpp (original)<br>
>> +++ cfe/trunk/lib/AST/APValue.cpp Wed Jan 8 21:29:54 2014<br>
>> @@ -34,7 +34,7 @@ namespace {<br>
>><br>
>> struct APValue::LV : LVBase {<br>
>> static const unsigned InlinePathSpace =<br>
>> - (MaxSize - sizeof(LVBase)) / sizeof(LValuePathEntry);<br>
>> + (sizeof(Data.buffer) - sizeof(LVBase)) / sizeof(LValuePathEntry);<br>
>><br>
>> /// Path - The sequence of base classes, fields and array indices to follow to<br>
>> /// walk from Base to the subobject. When performing GCC-style folding, there<br>
>> @@ -75,7 +75,8 @@ namespace {<br>
>><br>
>> struct APValue::MemberPointerData : MemberPointerBase {<br>
>> static const unsigned InlinePathSpace =<br>
>> - (MaxSize - sizeof(MemberPointerBase)) / sizeof(const CXXRecordDecl*);<br>
>> + (sizeof(Data.buffer) - sizeof(MemberPointerBase)) /<br>
>> + sizeof(const CXXRecordDecl *);<br>
>> typedef const CXXRecordDecl *PathElem;<br>
>> union {<br>
>> PathElem Path[InlinePathSpace];<br>
>> @@ -136,7 +137,7 @@ APValue::APValue(const APValue &RHS) : K<br>
>> break;<br>
>> case Vector:<br>
>> MakeVector();<br>
>> - setVector(((const Vec *)(const char *)RHS.Data)->Elts,<br>
>> + setVector(((const Vec *)(const char *)RHS.Data.buffer)->Elts,<br>
>> RHS.getVectorLength());<br>
>> break;<br>
>> case ComplexInt:<br>
>> @@ -188,27 +189,27 @@ APValue::APValue(const APValue &RHS) : K<br>
>><br>
>> void APValue::DestroyDataAndMakeUninit() {<br>
>> if (Kind == Int)<br>
>> - ((APSInt*)(char*)Data)->~APSInt();<br>
>> + ((APSInt*)(char*)Data.buffer)->~APSInt();<br>
>> else if (Kind == Float)<br>
>> - ((APFloat*)(char*)Data)->~APFloat();<br>
>> + ((APFloat*)(char*)Data.buffer)->~APFloat();<br>
>> else if (Kind == Vector)<br>
>> - ((Vec*)(char*)Data)->~Vec();<br>
>> + ((Vec*)(char*)Data.buffer)->~Vec();<br>
>> else if (Kind == ComplexInt)<br>
>> - ((ComplexAPSInt*)(char*)Data)->~ComplexAPSInt();<br>
>> + ((ComplexAPSInt*)(char*)Data.buffer)->~ComplexAPSInt();<br>
>> else if (Kind == ComplexFloat)<br>
>> - ((ComplexAPFloat*)(char*)Data)->~ComplexAPFloat();<br>
>> + ((ComplexAPFloat*)(char*)Data.buffer)->~ComplexAPFloat();<br>
>> else if (Kind == LValue)<br>
>> - ((LV*)(char*)Data)->~LV();<br>
>> + ((LV*)(char*)Data.buffer)->~LV();<br>
>> else if (Kind == Array)<br>
>> - ((Arr*)(char*)Data)->~Arr();<br>
>> + ((Arr*)(char*)Data.buffer)->~Arr();<br>
>> else if (Kind == Struct)<br>
>> - ((StructData*)(char*)Data)->~StructData();<br>
>> + ((StructData*)(char*)Data.buffer)->~StructData();<br>
>> else if (Kind == Union)<br>
>> - ((UnionData*)(char*)Data)->~UnionData();<br>
>> + ((UnionData*)(char*)Data.buffer)->~UnionData();<br>
>> else if (Kind == MemberPointer)<br>
>> - ((MemberPointerData*)(char*)Data)->~MemberPointerData();<br>
>> + ((MemberPointerData*)(char*)Data.buffer)->~MemberPointerData();<br>
>> else if (Kind == AddrLabelDiff)<br>
>> - ((AddrLabelDiffData*)(char*)Data)->~AddrLabelDiffData();<br>
>> + ((AddrLabelDiffData*)(char*)Data.buffer)->~AddrLabelDiffData();<br>
>> Kind = Uninitialized;<br>
>> }<br>
>><br>
>> @@ -239,19 +240,21 @@ bool APValue::needsCleanup() const {<br>
>> "same size.");<br>
>> return getComplexIntReal().needsCleanup();<br>
>> case LValue:<br>
>> - return reinterpret_cast<const LV *>(Data)->hasPathPtr();<br>
>> + return reinterpret_cast<const LV *>(Data.buffer)->hasPathPtr();<br>
>> case MemberPointer:<br>
>> - return reinterpret_cast<const MemberPointerData *>(Data)->hasPathPtr();<br>
>> + return reinterpret_cast<const MemberPointerData *>(Data.buffer)<br>
>> + ->hasPathPtr();<br>
>> }<br>
>> llvm_unreachable("Unknown APValue kind!");<br>
>> }<br>
>><br>
>> void APValue::swap(APValue &RHS) {<br>
>> std::swap(Kind, RHS.Kind);<br>
>> + const unsigned MaxSize = sizeof(Data.buffer);<br>
>> char TmpData[MaxSize];<br>
>> - memcpy(TmpData, Data, MaxSize);<br>
>> - memcpy(Data, RHS.Data, MaxSize);<br>
>> - memcpy(RHS.Data, TmpData, MaxSize);<br>
>> + memcpy(TmpData, Data.buffer, MaxSize);<br>
>> + memcpy(Data.buffer, RHS.Data.buffer, MaxSize);<br>
>> + memcpy(RHS.Data.buffer, TmpData, MaxSize);<br>
>> }<br>
>><br>
>> void APValue::dump() const {<br>
>> @@ -546,39 +549,39 @@ std::string APValue::getAsString(ASTCont<br>
>><br>
>> const APValue::LValueBase APValue::getLValueBase() const {<br>
>> assert(isLValue() && "Invalid accessor");<br>
>> - return ((const LV*)(const void*)Data)->BaseAndIsOnePastTheEnd.getPointer();<br>
>> + return ((const LV*)(const void*)Data.buffer)->BaseAndIsOnePastTheEnd.getPointer();<br>
>> }<br>
>><br>
>> bool APValue::isLValueOnePastTheEnd() const {<br>
>> assert(isLValue() && "Invalid accessor");<br>
>> - return ((const LV*)(const void*)Data)->BaseAndIsOnePastTheEnd.getInt();<br>
>> + return ((const LV*)(const void*)Data.buffer)->BaseAndIsOnePastTheEnd.getInt();<br>
>> }<br>
>><br>
>> CharUnits &APValue::getLValueOffset() {<br>
>> assert(isLValue() && "Invalid accessor");<br>
>> - return ((LV*)(void*)Data)->Offset;<br>
>> + return ((LV*)(void*)Data.buffer)->Offset;<br>
>> }<br>
>><br>
>> bool APValue::hasLValuePath() const {<br>
>> assert(isLValue() && "Invalid accessor");<br>
>> - return ((const LV*)(const char*)Data)->hasPath();<br>
>> + return ((const LV*)(const char*)Data.buffer)->hasPath();<br>
>> }<br>
>><br>
>> ArrayRef<APValue::LValuePathEntry> APValue::getLValuePath() const {<br>
>> assert(isLValue() && hasLValuePath() && "Invalid accessor");<br>
>> - const LV &LVal = *((const LV*)(const char*)Data);<br>
>> + const LV &LVal = *((const LV*)(const char*)Data.buffer);<br>
>> return ArrayRef<LValuePathEntry>(LVal.getPath(), LVal.PathLength);<br>
>> }<br>
>><br>
>> unsigned APValue::getLValueCallIndex() const {<br>
>> assert(isLValue() && "Invalid accessor");<br>
>> - return ((const LV*)(const char*)Data)->CallIndex;<br>
>> + return ((const LV*)(const char*)Data.buffer)->CallIndex;<br>
>> }<br>
>><br>
>> void APValue::setLValue(LValueBase B, const CharUnits &O, NoLValuePath,<br>
>> unsigned CallIndex) {<br>
>> assert(isLValue() && "Invalid accessor");<br>
>> - LV &LVal = *((LV*)(char*)Data);<br>
>> + LV &LVal = *((LV*)(char*)Data.buffer);<br>
>> LVal.BaseAndIsOnePastTheEnd.setPointer(B);<br>
>> LVal.BaseAndIsOnePastTheEnd.setInt(false);<br>
>> LVal.Offset = O;<br>
>> @@ -590,7 +593,7 @@ void APValue::setLValue(LValueBase B, co<br>
>> ArrayRef<LValuePathEntry> Path, bool IsOnePastTheEnd,<br>
>> unsigned CallIndex) {<br>
>> assert(isLValue() && "Invalid accessor");<br>
>> - LV &LVal = *((LV*)(char*)Data);<br>
>> + LV &LVal = *((LV*)(char*)Data.buffer);<br>
>> LVal.BaseAndIsOnePastTheEnd.setPointer(B);<br>
>> LVal.BaseAndIsOnePastTheEnd.setInt(IsOnePastTheEnd);<br>
>> LVal.Offset = O;<br>
>> @@ -601,39 +604,42 @@ void APValue::setLValue(LValueBase B, co<br>
>><br>
>> const ValueDecl *APValue::getMemberPointerDecl() const {<br>
>> assert(isMemberPointer() && "Invalid accessor");<br>
>> - const MemberPointerData &MPD = *((const MemberPointerData*)(const char*)Data);<br>
>> + const MemberPointerData &MPD =<br>
>> + *((const MemberPointerData *)(const char *)Data.buffer);<br>
>> return MPD.MemberAndIsDerivedMember.getPointer();<br>
>> }<br>
>><br>
>> bool APValue::isMemberPointerToDerivedMember() const {<br>
>> assert(isMemberPointer() && "Invalid accessor");<br>
>> - const MemberPointerData &MPD = *((const MemberPointerData*)(const char*)Data);<br>
>> + const MemberPointerData &MPD =<br>
>> + *((const MemberPointerData *)(const char *)Data.buffer);<br>
>> return MPD.MemberAndIsDerivedMember.getInt();<br>
>> }<br>
>><br>
>> ArrayRef<const CXXRecordDecl*> APValue::getMemberPointerPath() const {<br>
>> assert(isMemberPointer() && "Invalid accessor");<br>
>> - const MemberPointerData &MPD = *((const MemberPointerData*)(const char*)Data);<br>
>> + const MemberPointerData &MPD =<br>
>> + *((const MemberPointerData *)(const char *)Data.buffer);<br>
>> return ArrayRef<const CXXRecordDecl*>(MPD.getPath(), MPD.PathLength);<br>
>> }<br>
>><br>
>> void APValue::MakeLValue() {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - assert(sizeof(LV) <= MaxSize && "LV too big");<br>
>> - new ((void*)(char*)Data) LV();<br>
>> + assert(sizeof(LV) <= sizeof(Data.buffer) && "LV too big");<br>
>> + new ((void*)(char*)Data.buffer) LV();<br>
>> Kind = LValue;<br>
>> }<br>
>><br>
>> void APValue::MakeArray(unsigned InitElts, unsigned Size) {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - new ((void*)(char*)Data) Arr(InitElts, Size);<br>
>> + new ((void*)(char*)Data.buffer) Arr(InitElts, Size);<br>
>> Kind = Array;<br>
>> }<br>
>><br>
>> void APValue::MakeMemberPointer(const ValueDecl *Member, bool IsDerivedMember,<br>
>> ArrayRef<const CXXRecordDecl*> Path) {<br>
>> assert(isUninit() && "Bad state change");<br>
>> - MemberPointerData *MPD = new ((void*)(char*)Data) MemberPointerData;<br>
>> + MemberPointerData *MPD = new ((void*)(char*)Data.buffer) MemberPointerData;<br>
>> Kind = MemberPointer;<br>
>> MPD->MemberAndIsDerivedMember.setPointer(Member);<br>
>> MPD->MemberAndIsDerivedMember.setInt(IsDerivedMember);<br>
>><br>
>><br>
>> _______________________________________________<br>
>> cfe-commits mailing list<br>
>> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br>
</blockquote></div>