File tree 2 files changed +9
-7
lines changed 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -1181,7 +1181,7 @@ class MCPlusBuilder {
1181
1181
1182
1182
// / Set the label of \p Inst. This label will be emitted right before \p Inst
1183
1183
// / is emitted to MCStreamer.
1184
- bool setLabel (MCInst &Inst, MCSymbol *Label, AllocatorIdTy AllocatorId = 0 ) ;
1184
+ bool setLabel (MCInst &Inst, MCSymbol *Label) const ;
1185
1185
1186
1186
// / Return MCSymbol that represents a target of this instruction at a given
1187
1187
// / operand number \p OpNum. If there's no symbol associated with
@@ -1816,6 +1816,8 @@ class MCPlusBuilder {
1816
1816
const ValueType &addAnnotation (MCInst &Inst, unsigned Index,
1817
1817
const ValueType &Val,
1818
1818
AllocatorIdTy AllocatorId = 0 ) {
1819
+ assert (Index >= MCPlus::MCAnnotation::kGeneric &&
1820
+ " Generic annotation type expected." );
1819
1821
assert (!hasAnnotation (Inst, Index));
1820
1822
AnnotationAllocator &Allocator = getAnnotationAllocator (AllocatorId);
1821
1823
auto *A = new (Allocator.ValueAllocator )
Original file line number Diff line number Diff line change @@ -267,15 +267,15 @@ bool MCPlusBuilder::clearOffset(MCInst &Inst) const {
267
267
}
268
268
269
269
MCSymbol *MCPlusBuilder::getLabel (const MCInst &Inst) const {
270
- if (auto Label = tryGetAnnotationAs<MCSymbol *>(Inst, MCAnnotation::kLabel ))
271
- return *Label;
270
+ if (std::optional<int64_t > Label =
271
+ getAnnotationOpValue (Inst, MCAnnotation::kLabel ))
272
+ return reinterpret_cast <MCSymbol *>(*Label);
272
273
return nullptr ;
273
274
}
274
275
275
- bool MCPlusBuilder::setLabel (MCInst &Inst, MCSymbol *Label,
276
- AllocatorIdTy AllocatorId) {
277
- getOrCreateAnnotationAs<MCSymbol *>(Inst, MCAnnotation::kLabel , AllocatorId) =
278
- Label;
276
+ bool MCPlusBuilder::setLabel (MCInst &Inst, MCSymbol *Label) const {
277
+ setAnnotationOpValue (Inst, MCAnnotation::kLabel ,
278
+ reinterpret_cast <int64_t >(Label));
279
279
return true ;
280
280
}
281
281
You can’t perform that action at this time.
0 commit comments