@@ -401,9 +401,7 @@ class Init {
401
401
// / variables which may not be defined at the time the expression is formed.
402
402
// / If a value is set for the variable later, this method will be called on
403
403
// / users of the value to allow the value to propagate out.
404
- virtual const Init *resolveReferences (Resolver &R) const {
405
- return const_cast <Init *>(this );
406
- }
404
+ virtual const Init *resolveReferences (Resolver &R) const { return this ; }
407
405
408
406
// / Get the \p Init value of the specified bit.
409
407
virtual const Init *getBit (unsigned Bit) const = 0;
@@ -475,9 +473,7 @@ class UnsetInit : public Init {
475
473
const Init *getCastTo (const RecTy *Ty) const override ;
476
474
const Init *convertInitializerTo (const RecTy *Ty) const override ;
477
475
478
- const Init *getBit (unsigned Bit) const override {
479
- return const_cast <UnsetInit*>(this );
480
- }
476
+ const Init *getBit (unsigned Bit) const override { return this ; }
481
477
482
478
// / Is this a complete value with no unset (uninitialized) subvalues?
483
479
bool isComplete () const override { return false ; }
@@ -579,7 +575,7 @@ class BitInit final : public TypedInit {
579
575
580
576
const Init *getBit (unsigned Bit) const override {
581
577
assert (Bit < 1 && " Bit index out of range!" );
582
- return const_cast <BitInit*>( this ) ;
578
+ return this ;
583
579
}
584
580
585
581
bool isConcrete () const override { return true ; }
@@ -1318,7 +1314,7 @@ class VarBitInit final : public TypedInit {
1318
1314
1319
1315
const Init *getBit (unsigned B) const override {
1320
1316
assert (B < 1 && " Bit index out of range!" );
1321
- return const_cast <VarBitInit*>( this ) ;
1317
+ return this ;
1322
1318
}
1323
1319
};
1324
1320
0 commit comments