Expand some code with temporary variables to rid ourselves of the warning
authorReid Spencer <rspencer@reidspencer.com>
Thu, 13 Apr 2006 18:29:58 +0000 (18:29 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Thu, 13 Apr 2006 18:29:58 +0000 (18:29 +0000)
about "dereferencing type-punned pointer will break strict-aliasing rules"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27671 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineDebugInfo.cpp

index 2e7e8c0d9f12b4b72da54f5ab7f10eb9b85ab700..2e3c034898d0d57df3a4cab8a4be505f07af1423 100644 (file)
@@ -580,7 +580,9 @@ AnchoredDesc::AnchoredDesc(unsigned T)
 void AnchoredDesc::ApplyToFields(DIVisitor *Visitor) {
   DebugInfoDesc::ApplyToFields(Visitor);
 
-  Visitor->Apply((DebugInfoDesc *&)Anchor);
+  DebugInfoDesc *Tmp = Anchor;
+  Visitor->Apply(Tmp);
+  Anchor = (AnchorDesc*)Tmp;
 }
 
 //===----------------------------------------------------------------------===//
@@ -670,7 +672,9 @@ void TypeDesc::ApplyToFields(DIVisitor *Visitor) {
   
   Visitor->Apply(Context);
   Visitor->Apply(Name);
-  Visitor->Apply((DebugInfoDesc *&)File);
+  DebugInfoDesc* Tmp = File;
+  Visitor->Apply(Tmp);
+  File = (CompileUnitDesc*)Tmp;
   Visitor->Apply(Line);
   Visitor->Apply(Size);
   Visitor->Apply(Align);
@@ -775,7 +779,9 @@ bool DerivedTypeDesc::classof(const DebugInfoDesc *D) {
 void DerivedTypeDesc::ApplyToFields(DIVisitor *Visitor) {
   TypeDesc::ApplyToFields(Visitor);
   
-  Visitor->Apply((DebugInfoDesc *&)FromType);
+  DebugInfoDesc* Tmp = FromType;
+  Visitor->Apply(Tmp);
+  FromType = (TypeDesc*)Tmp;
 }
 
 /// getDescString - Return a string used to compose global names and labels.
@@ -975,9 +981,13 @@ void VariableDesc::ApplyToFields(DIVisitor *Visitor) {
   
   Visitor->Apply(Context);
   Visitor->Apply(Name);
-  Visitor->Apply((DebugInfoDesc *&)File);
+  DebugInfoDesc* Tmp1 = File;
+  Visitor->Apply(Tmp1);
+  File = (CompileUnitDesc*)Tmp1;
   Visitor->Apply(Line);
-  Visitor->Apply((DebugInfoDesc *&)TyDesc);
+  DebugInfoDesc* Tmp2 = TyDesc;
+  Visitor->Apply(Tmp2);
+  TyDesc = (TypeDesc*)Tmp2;
 }
 
 /// getDescString - Return a string used to compose global names and labels.
@@ -1024,9 +1034,13 @@ void GlobalDesc::ApplyToFields(DIVisitor *Visitor) {
 
   Visitor->Apply(Context);
   Visitor->Apply(Name);
-  Visitor->Apply((DebugInfoDesc *&)File);
+  DebugInfoDesc* Tmp1 = File;
+  Visitor->Apply(Tmp1);
+  File = (CompileUnitDesc*)Tmp1;
   Visitor->Apply(Line);
-  Visitor->Apply((DebugInfoDesc *&)TyDesc);
+  DebugInfoDesc* Tmp2 = TyDesc;
+  Visitor->Apply(Tmp2);
+  TyDesc = (TypeDesc*)Tmp2;
   Visitor->Apply(IsStatic);
   Visitor->Apply(IsDefinition);
 }