@@ -220,6 +220,45 @@ void DataLayout::reset(StringRef Desc) {
220220 return report_fatal_error (std::move (Err));
221221}
222222
223+ DataLayout &DataLayout::operator =(const DataLayout &Other) {
224+ clear ();
225+ StringRepresentation = Other.StringRepresentation ;
226+ BigEndian = Other.BigEndian ;
227+ AllocaAddrSpace = Other.AllocaAddrSpace ;
228+ ProgramAddrSpace = Other.ProgramAddrSpace ;
229+ DefaultGlobalsAddrSpace = Other.DefaultGlobalsAddrSpace ;
230+ StackNaturalAlign = Other.StackNaturalAlign ;
231+ FunctionPtrAlign = Other.FunctionPtrAlign ;
232+ TheFunctionPtrAlignType = Other.TheFunctionPtrAlignType ;
233+ ManglingMode = Other.ManglingMode ;
234+ LegalIntWidths = Other.LegalIntWidths ;
235+ IntAlignments = Other.IntAlignments ;
236+ FloatAlignments = Other.FloatAlignments ;
237+ VectorAlignments = Other.VectorAlignments ;
238+ StructAlignment = Other.StructAlignment ;
239+ Pointers = Other.Pointers ;
240+ NonIntegralAddressSpaces = Other.NonIntegralAddressSpaces ;
241+ return *this ;
242+ }
243+
244+ bool DataLayout::operator ==(const DataLayout &Other) const {
245+ // NOTE: StringRepresentation might differ, it is not canonicalized.
246+ // FIXME: NonIntegralAddressSpaces isn't compared.
247+ return BigEndian == Other.BigEndian &&
248+ AllocaAddrSpace == Other.AllocaAddrSpace &&
249+ ProgramAddrSpace == Other.ProgramAddrSpace &&
250+ DefaultGlobalsAddrSpace == Other.DefaultGlobalsAddrSpace &&
251+ StackNaturalAlign == Other.StackNaturalAlign &&
252+ FunctionPtrAlign == Other.FunctionPtrAlign &&
253+ TheFunctionPtrAlignType == Other.TheFunctionPtrAlignType &&
254+ ManglingMode == Other.ManglingMode &&
255+ LegalIntWidths == Other.LegalIntWidths &&
256+ IntAlignments == Other.IntAlignments &&
257+ FloatAlignments == Other.FloatAlignments &&
258+ VectorAlignments == Other.VectorAlignments &&
259+ StructAlignment == Other.StructAlignment && Pointers == Other.Pointers ;
260+ }
261+
223262Expected<DataLayout> DataLayout::parse (StringRef LayoutDescription) {
224263 DataLayout Layout (" " );
225264 if (Error Err = Layout.parseSpecifier (LayoutDescription))
@@ -556,25 +595,6 @@ DataLayout::DataLayout(const Module *M) {
556595
557596void DataLayout::init (const Module *M) { *this = M->getDataLayout (); }
558597
559- bool DataLayout::operator ==(const DataLayout &Other) const {
560- bool Ret = BigEndian == Other.BigEndian &&
561- AllocaAddrSpace == Other.AllocaAddrSpace &&
562- StackNaturalAlign == Other.StackNaturalAlign &&
563- ProgramAddrSpace == Other.ProgramAddrSpace &&
564- DefaultGlobalsAddrSpace == Other.DefaultGlobalsAddrSpace &&
565- FunctionPtrAlign == Other.FunctionPtrAlign &&
566- TheFunctionPtrAlignType == Other.TheFunctionPtrAlignType &&
567- ManglingMode == Other.ManglingMode &&
568- LegalIntWidths == Other.LegalIntWidths &&
569- IntAlignments == Other.IntAlignments &&
570- FloatAlignments == Other.FloatAlignments &&
571- VectorAlignments == Other.VectorAlignments &&
572- StructAlignment == Other.StructAlignment &&
573- Pointers == Other.Pointers ;
574- // Note: getStringRepresentation() might differs, it is not canonicalized
575- return Ret;
576- }
577-
578598static SmallVectorImpl<LayoutAlignElem>::const_iterator
579599findAlignmentLowerBound (const SmallVectorImpl<LayoutAlignElem> &Alignments,
580600 uint32_t BitWidth) {
0 commit comments