@@ -238,38 +238,40 @@ bool SvdCpu::ProcessXmlAttributes(XMLTreeElement* xmlElement)
238238
239239bool SvdCpu::CopyItem (SvdItem *from)
240240{
241- const auto pFrom = (SvdCpu*) from;
242-
243- const auto & revisionStr = GetRevisionStr ();
244- const auto revision = GetRevision ();
245- const auto nvicPrioBits = GetNvicPrioBits ();
246- const auto mpuPresent = GetMpuPresent ();
247- const auto fpuPresent = GetFpuPresent ();
248- const auto vendorSystickConfig = GetVendorSystickConfig ();
249- const auto fpuDP = GetFpuDP ();
250- const auto icachePresent = GetIcachePresent ();
251- const auto dcachePresent = GetDcachePresent ();
252- const auto itcmPresent = GetItcmPresent ();
253- const auto dtcmPresent = GetDtcmPresent ();
254- const auto vtorPresent = GetVtorPresent ();
255- const auto endian = GetEndian ();
256- const auto type = GetType ();
257-
258- if (revisionStr == " " ) { SetRevisionStr (pFrom->GetRevisionStr ()); }
259- if (revision == 0 ) { SetRevision (pFrom->GetRevision ()); }
260- if (nvicPrioBits == 0 ) { SetNvicPrioBits (pFrom->GetNvicPrioBits ()); }
261- if (mpuPresent == 0 ) { SetMpuPresent (pFrom->GetMpuPresent ()); }
262- if (fpuPresent == 0 ) { SetFpuPresent (pFrom->GetFpuPresent ()); }
263- if (vendorSystickConfig == 0 ) { SetVendorSystickConfig (pFrom->GetVendorSystickConfig ()); }
264- if (fpuDP == 0 ) { SetFpuDP (pFrom->GetFpuDP ()); }
265- if (icachePresent == 0 ) { SetIcachePresent (pFrom->GetIcachePresent ()); }
266- if (dcachePresent == 0 ) { SetDcachePresent (pFrom->GetDcachePresent ()); }
267- if (itcmPresent == 0 ) { SetItcmPresent (pFrom->GetItcmPresent ()); }
268- if (dtcmPresent == 0 ) { SetDtcmPresent (pFrom->GetDtcmPresent ()); }
269- if (vtorPresent == 0 ) { SetVtorPresent (pFrom->GetVtorPresent ()); }
270- if (endian == SvdTypes::Endian::UNDEF) { SetEndian (pFrom->GetEndian ()); }
271- if (type == SvdTypes::CpuType::UNDEF) { SetType (pFrom->GetType ()); }
272-
241+ const auto pFrom = dynamic_cast <SvdCpu*>(from);
242+
243+ if (pFrom) {
244+ const auto & revisionStr = GetRevisionStr ();
245+ const auto revision = GetRevision ();
246+ const auto nvicPrioBits = GetNvicPrioBits ();
247+ const auto mpuPresent = GetMpuPresent ();
248+ const auto fpuPresent = GetFpuPresent ();
249+ const auto vendorSystickConfig = GetVendorSystickConfig ();
250+ const auto fpuDP = GetFpuDP ();
251+ const auto icachePresent = GetIcachePresent ();
252+ const auto dcachePresent = GetDcachePresent ();
253+ const auto itcmPresent = GetItcmPresent ();
254+ const auto dtcmPresent = GetDtcmPresent ();
255+ const auto vtorPresent = GetVtorPresent ();
256+ const auto endian = GetEndian ();
257+ const auto type = GetType ();
258+
259+ if (revisionStr == " " ) { SetRevisionStr (pFrom->GetRevisionStr ()); }
260+ if (revision == 0 ) { SetRevision (pFrom->GetRevision ()); }
261+ if (nvicPrioBits == 0 ) { SetNvicPrioBits (pFrom->GetNvicPrioBits ()); }
262+ if (mpuPresent == 0 ) { SetMpuPresent (pFrom->GetMpuPresent ()); }
263+ if (fpuPresent == 0 ) { SetFpuPresent (pFrom->GetFpuPresent ()); }
264+ if (vendorSystickConfig == 0 ) { SetVendorSystickConfig (pFrom->GetVendorSystickConfig ()); }
265+ if (fpuDP == 0 ) { SetFpuDP (pFrom->GetFpuDP ()); }
266+ if (icachePresent == 0 ) { SetIcachePresent (pFrom->GetIcachePresent ()); }
267+ if (dcachePresent == 0 ) { SetDcachePresent (pFrom->GetDcachePresent ()); }
268+ if (itcmPresent == 0 ) { SetItcmPresent (pFrom->GetItcmPresent ()); }
269+ if (dtcmPresent == 0 ) { SetDtcmPresent (pFrom->GetDtcmPresent ()); }
270+ if (vtorPresent == 0 ) { SetVtorPresent (pFrom->GetVtorPresent ()); }
271+ if (endian == SvdTypes::Endian::UNDEF) { SetEndian (pFrom->GetEndian ()); }
272+ if (type == SvdTypes::CpuType::UNDEF) { SetType (pFrom->GetType ()); }
273+ }
274+
273275 SvdItem::CopyItem (from);
274276
275277 return false ;
0 commit comments