Skip to content

Commit 709eaac

Browse files
author
Reid Spencer
committed
Expand some code with temporary variables to rid ourselves of the warning
about "dereferencing type-punned pointer will break strict-aliasing rules" llvm-svn: 27671
1 parent ef023cb commit 709eaac

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

llvm/lib/CodeGen/MachineDebugInfo.cpp

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,9 @@ AnchoredDesc::AnchoredDesc(unsigned T)
580580
void AnchoredDesc::ApplyToFields(DIVisitor *Visitor) {
581581
DebugInfoDesc::ApplyToFields(Visitor);
582582

583-
Visitor->Apply((DebugInfoDesc *&)Anchor);
583+
DebugInfoDesc *Tmp = Anchor;
584+
Visitor->Apply(Tmp);
585+
Anchor = (AnchorDesc*)Tmp;
584586
}
585587

586588
//===----------------------------------------------------------------------===//
@@ -670,7 +672,9 @@ void TypeDesc::ApplyToFields(DIVisitor *Visitor) {
670672

671673
Visitor->Apply(Context);
672674
Visitor->Apply(Name);
673-
Visitor->Apply((DebugInfoDesc *&)File);
675+
DebugInfoDesc* Tmp = File;
676+
Visitor->Apply(Tmp);
677+
File = (CompileUnitDesc*)Tmp;
674678
Visitor->Apply(Line);
675679
Visitor->Apply(Size);
676680
Visitor->Apply(Align);
@@ -775,7 +779,9 @@ bool DerivedTypeDesc::classof(const DebugInfoDesc *D) {
775779
void DerivedTypeDesc::ApplyToFields(DIVisitor *Visitor) {
776780
TypeDesc::ApplyToFields(Visitor);
777781

778-
Visitor->Apply((DebugInfoDesc *&)FromType);
782+
DebugInfoDesc* Tmp = FromType;
783+
Visitor->Apply(Tmp);
784+
FromType = (TypeDesc*)Tmp;
779785
}
780786

781787
/// getDescString - Return a string used to compose global names and labels.
@@ -975,9 +981,13 @@ void VariableDesc::ApplyToFields(DIVisitor *Visitor) {
975981

976982
Visitor->Apply(Context);
977983
Visitor->Apply(Name);
978-
Visitor->Apply((DebugInfoDesc *&)File);
984+
DebugInfoDesc* Tmp1 = File;
985+
Visitor->Apply(Tmp1);
986+
File = (CompileUnitDesc*)Tmp1;
979987
Visitor->Apply(Line);
980-
Visitor->Apply((DebugInfoDesc *&)TyDesc);
988+
DebugInfoDesc* Tmp2 = TyDesc;
989+
Visitor->Apply(Tmp2);
990+
TyDesc = (TypeDesc*)Tmp2;
981991
}
982992

983993
/// getDescString - Return a string used to compose global names and labels.
@@ -1024,9 +1034,13 @@ void GlobalDesc::ApplyToFields(DIVisitor *Visitor) {
10241034

10251035
Visitor->Apply(Context);
10261036
Visitor->Apply(Name);
1027-
Visitor->Apply((DebugInfoDesc *&)File);
1037+
DebugInfoDesc* Tmp1 = File;
1038+
Visitor->Apply(Tmp1);
1039+
File = (CompileUnitDesc*)Tmp1;
10281040
Visitor->Apply(Line);
1029-
Visitor->Apply((DebugInfoDesc *&)TyDesc);
1041+
DebugInfoDesc* Tmp2 = TyDesc;
1042+
Visitor->Apply(Tmp2);
1043+
TyDesc = (TypeDesc*)Tmp2;
10301044
Visitor->Apply(IsStatic);
10311045
Visitor->Apply(IsDefinition);
10321046
}

0 commit comments

Comments
 (0)