mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
Revert "unique_ptrify ValID::ConstantStructElts"
This reverts r231200 and r231204. The second one added an explicit move ctor for MSVC. This change broke the clang-cl self-host due to weirdness in MSVC's implementation of std::map::insert. Somehow we lost our rvalue ref-ness when going through variadic placement new: template <class _Objty, class... _Types> void construct(_Objty *_Ptr, _Types &&... _Args) { // construct _Objty(_Types...) at _Ptr ::new ((void *)_Ptr) _Objty(_STD forward<_Types>(_Args)...); } For some reason, Clang decided to call the deleted std::pair copy constructor at this point. Needs further investigation, once I can build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231269 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a2b8275694
commit
2337c1fd83
@ -2365,10 +2365,9 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
|
||||
ParseToken(lltok::rbrace, "expected end of struct constant"))
|
||||
return true;
|
||||
|
||||
ID.ConstantStructElts.reset(new Constant *[Elts.size()]);
|
||||
ID.ConstantStructElts = new Constant*[Elts.size()];
|
||||
ID.UIntVal = Elts.size();
|
||||
memcpy(ID.ConstantStructElts.get(), Elts.data(),
|
||||
Elts.size() * sizeof(Elts[0]));
|
||||
memcpy(ID.ConstantStructElts, Elts.data(), Elts.size()*sizeof(Elts[0]));
|
||||
ID.Kind = ValID::t_ConstantStruct;
|
||||
return false;
|
||||
}
|
||||
@ -2387,9 +2386,8 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
|
||||
return true;
|
||||
|
||||
if (isPackedStruct) {
|
||||
ID.ConstantStructElts.reset(new Constant *[Elts.size()]);
|
||||
memcpy(ID.ConstantStructElts.get(), Elts.data(),
|
||||
Elts.size() * sizeof(Elts[0]));
|
||||
ID.ConstantStructElts = new Constant*[Elts.size()];
|
||||
memcpy(ID.ConstantStructElts, Elts.data(), Elts.size()*sizeof(Elts[0]));
|
||||
ID.UIntVal = Elts.size();
|
||||
ID.Kind = ValID::t_PackedConstantStruct;
|
||||
return false;
|
||||
@ -3949,8 +3947,8 @@ bool LLParser::ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V,
|
||||
return Error(ID.Loc, "element " + Twine(i) +
|
||||
" of struct initializer doesn't match struct element type");
|
||||
|
||||
V = ConstantStruct::get(
|
||||
ST, makeArrayRef(ID.ConstantStructElts.get(), ID.UIntVal));
|
||||
V = ConstantStruct::get(ST, makeArrayRef(ID.ConstantStructElts,
|
||||
ID.UIntVal));
|
||||
} else
|
||||
return Error(ID.Loc, "constant expression type mismatch");
|
||||
return false;
|
||||
|
@ -62,17 +62,13 @@ namespace llvm {
|
||||
APSInt APSIntVal;
|
||||
APFloat APFloatVal;
|
||||
Constant *ConstantVal;
|
||||
std::unique_ptr<Constant*[]> ConstantStructElts;
|
||||
Constant **ConstantStructElts;
|
||||
|
||||
ValID() : Kind(t_LocalID), APFloatVal(0.0) {}
|
||||
// Workaround for MSVC not synthesizing implicit move members.
|
||||
ValID(ValID &&RHS)
|
||||
: Kind(std::move(RHS.Kind)), Loc(std::move(RHS.Loc)),
|
||||
UIntVal(std::move(RHS.UIntVal)), StrVal(std::move(RHS.StrVal)),
|
||||
StrVal2(std::move(RHS.StrVal2)), APSIntVal(std::move(RHS.APSIntVal)),
|
||||
APFloatVal(std::move(RHS.APFloatVal)),
|
||||
ConstantVal(std::move(RHS.ConstantVal)),
|
||||
ConstantStructElts(std::move(RHS.ConstantStructElts)) {}
|
||||
~ValID() {
|
||||
if (Kind == t_ConstantStruct || Kind == t_PackedConstantStruct)
|
||||
delete [] ConstantStructElts;
|
||||
}
|
||||
|
||||
bool operator<(const ValID &RHS) const {
|
||||
if (Kind == t_LocalID || Kind == t_GlobalID)
|
||||
|
Loading…
x
Reference in New Issue
Block a user