@@ -267,23 +267,64 @@ class AggValueSlot {
267267 Address addr;
268268 clang::Qualifiers quals;
269269
270+ // / This is set to true if some external code is responsible for setting up a
271+ // / destructor for the slot. Otherwise the code which constructs it should
272+ // / push the appropriate cleanup.
273+ LLVM_PREFERRED_TYPE (bool )
274+ [[maybe_unused]] unsigned destructedFlag : 1 ;
275+
270276 // / This is set to true if the memory in the slot is known to be zero before
271277 // / the assignment into it. This means that zero fields don't need to be set.
272- bool zeroedFlag : 1 ;
278+ LLVM_PREFERRED_TYPE (bool )
279+ unsigned zeroedFlag : 1 ;
280+
281+ // / This is set to true if the slot might be aliased and it's not undefined
282+ // / behavior to access it through such an alias. Note that it's always
283+ // / undefined behavior to access a C++ object that's under construction
284+ // / through an alias derived from outside the construction process.
285+ // /
286+ // / This flag controls whether calls that produce the aggregate
287+ // / value may be evaluated directly into the slot, or whether they
288+ // / must be evaluated into an unaliased temporary and then memcpy'ed
289+ // / over. Since it's invalid in general to memcpy a non-POD C++
290+ // / object, it's important that this flag never be set when
291+ // / evaluating an expression which constructs such an object.
292+ LLVM_PREFERRED_TYPE (bool )
293+ [[maybe_unused]] unsigned aliasedFlag : 1 ;
294+
295+ // / This is set to true if the tail padding of this slot might overlap
296+ // / another object that may have already been initialized (and whose
297+ // / value must be preserved by this initialization). If so, we may only
298+ // / store up to the dsize of the type. Otherwise we can widen stores to
299+ // / the size of the type.
300+ LLVM_PREFERRED_TYPE (bool )
301+ [[maybe_unused]] unsigned overlapFlag : 1 ;
273302
274303public:
304+ enum IsDestructed_t { IsNotDestructed, IsDestructed };
275305 enum IsZeroed_t { IsNotZeroed, IsZeroed };
306+ enum IsAliased_t { IsNotAliased, IsAliased };
307+ enum Overlap_t { MayOverlap, DoesNotOverlap };
276308
277- AggValueSlot (Address addr, clang::Qualifiers quals, bool zeroedFlag)
278- : addr(addr), quals(quals), zeroedFlag(zeroedFlag) {}
309+ AggValueSlot (Address addr, clang::Qualifiers quals, bool destructedFlag,
310+ bool zeroedFlag, bool aliasedFlag, bool overlapFlag)
311+ : addr(addr), quals(quals), destructedFlag(destructedFlag),
312+ zeroedFlag (zeroedFlag), aliasedFlag(aliasedFlag),
313+ overlapFlag(overlapFlag) {}
279314
280315 static AggValueSlot forAddr (Address addr, clang::Qualifiers quals,
316+ IsDestructed_t isDestructed,
317+ IsAliased_t isAliased, Overlap_t mayOverlap,
281318 IsZeroed_t isZeroed = IsNotZeroed) {
282- return AggValueSlot (addr, quals, isZeroed);
319+ return AggValueSlot (addr, quals, isDestructed, isZeroed, isAliased,
320+ mayOverlap);
283321 }
284322
285- static AggValueSlot forLValue (const LValue &lv) {
286- return forAddr (lv.getAddress (), lv.getQuals ());
323+ static AggValueSlot forLValue (const LValue &LV, IsDestructed_t isDestructed,
324+ IsAliased_t isAliased, Overlap_t mayOverlap,
325+ IsZeroed_t isZeroed = IsNotZeroed) {
326+ return forAddr (LV.getAddress (), LV.getQuals (), isDestructed, isAliased,
327+ mayOverlap, isZeroed);
287328 }
288329
289330 clang::Qualifiers getQualifiers () const { return quals; }
0 commit comments