@@ -116,46 +116,56 @@ typedef MapVector<const MCSection *, ConstantPool> ConstantPoolMapTy;
116
116
class UnwindContext {
117
117
MCAsmParser &Parser;
118
118
119
- SMLoc FnStartLoc;
120
- SMLoc CantUnwindLoc;
121
- SMLoc PersonalityLoc;
122
- SMLoc HandlerDataLoc;
119
+ typedef SmallVector<SMLoc, 4 > Locs;
120
+
121
+ Locs FnStartLocs;
122
+ Locs CantUnwindLocs;
123
+ Locs PersonalityLocs;
124
+ Locs HandlerDataLocs;
123
125
int FPReg;
124
126
125
127
public:
126
128
UnwindContext (MCAsmParser &P) : Parser(P), FPReg(-1 ) {}
127
129
128
- bool hasFnStart () const { return FnStartLoc. isValid (); }
129
- bool cantUnwind () const { return CantUnwindLoc. isValid (); }
130
- bool hasHandlerData () const { return HandlerDataLoc. isValid (); }
131
- bool hasPersonality () const { return PersonalityLoc. isValid (); }
130
+ bool hasFnStart () const { return !FnStartLocs. empty (); }
131
+ bool cantUnwind () const { return !CantUnwindLocs. empty (); }
132
+ bool hasHandlerData () const { return !HandlerDataLocs. empty (); }
133
+ bool hasPersonality () const { return !PersonalityLocs. empty (); }
132
134
133
- void recordFnStart (SMLoc L) { FnStartLoc = L ; }
134
- void recordCantUnwind (SMLoc L) { CantUnwindLoc = L ; }
135
- void recordPersonality (SMLoc L) { PersonalityLoc = L ; }
136
- void recordHandlerData (SMLoc L) { HandlerDataLoc = L ; }
135
+ void recordFnStart (SMLoc L) { FnStartLocs. push_back (L) ; }
136
+ void recordCantUnwind (SMLoc L) { CantUnwindLocs. push_back (L) ; }
137
+ void recordPersonality (SMLoc L) { PersonalityLocs. push_back (L) ; }
138
+ void recordHandlerData (SMLoc L) { HandlerDataLocs. push_back (L) ; }
137
139
138
140
void saveFPReg (int Reg) { FPReg = Reg; }
139
141
int getFPReg () const { return FPReg; }
140
142
141
143
void emitFnStartLocNotes () const {
142
- Parser.Note (FnStartLoc, " .fnstart was specified here" );
144
+ for (Locs::const_iterator FI = FnStartLocs.begin (), FE = FnStartLocs.end ();
145
+ FI != FE; ++FI)
146
+ Parser.Note (*FI, " .fnstart was specified here" );
143
147
}
144
148
void emitCantUnwindLocNotes () const {
145
- Parser.Note (CantUnwindLoc, " .cantunwind was specified here" );
149
+ for (Locs::const_iterator UI = CantUnwindLocs.begin (),
150
+ UE = CantUnwindLocs.end (); UI != UE; ++UI)
151
+ Parser.Note (*UI, " .cantunwind was specified here" );
146
152
}
147
153
void emitHandlerDataLocNotes () const {
148
- Parser.Note (HandlerDataLoc, " .handlerdata was specified here" );
154
+ for (Locs::const_iterator HI = HandlerDataLocs.begin (),
155
+ HE = HandlerDataLocs.end (); HI != HE; ++HI)
156
+ Parser.Note (*HI, " .handlerdata was specified here" );
149
157
}
150
158
void emitPersonalityLocNotes () const {
151
- Parser.Note (PersonalityLoc, " .personality was specified here" );
159
+ for (Locs::const_iterator PI = PersonalityLocs.begin (),
160
+ PE = PersonalityLocs.end (); PI != PE; ++PI)
161
+ Parser.Note (*PI, " .personality was specified here" );
152
162
}
153
163
154
164
void reset () {
155
- FnStartLoc = SMLoc ();
156
- CantUnwindLoc = SMLoc ();
157
- PersonalityLoc = SMLoc ();
158
- HandlerDataLoc = SMLoc ();
165
+ FnStartLocs = Locs ();
166
+ CantUnwindLocs = Locs ();
167
+ PersonalityLocs = Locs ();
168
+ HandlerDataLocs = Locs ();
159
169
FPReg = -1 ;
160
170
}
161
171
};
0 commit comments