@@ -401,9 +401,7 @@ class Init {
401401 // / variables which may not be defined at the time the expression is formed.
402402 // / If a value is set for the variable later, this method will be called on
403403 // / 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 ; }
407405
408406 // / Get the \p Init value of the specified bit.
409407 virtual const Init *getBit (unsigned Bit) const = 0;
@@ -475,9 +473,7 @@ class UnsetInit : public Init {
475473 const Init *getCastTo (const RecTy *Ty) const override ;
476474 const Init *convertInitializerTo (const RecTy *Ty) const override ;
477475
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 ; }
481477
482478 // / Is this a complete value with no unset (uninitialized) subvalues?
483479 bool isComplete () const override { return false ; }
@@ -579,7 +575,7 @@ class BitInit final : public TypedInit {
579575
580576 const Init *getBit (unsigned Bit) const override {
581577 assert (Bit < 1 && " Bit index out of range!" );
582- return const_cast <BitInit*>( this ) ;
578+ return this ;
583579 }
584580
585581 bool isConcrete () const override { return true ; }
@@ -1318,7 +1314,7 @@ class VarBitInit final : public TypedInit {
13181314
13191315 const Init *getBit (unsigned B) const override {
13201316 assert (B < 1 && " Bit index out of range!" );
1321- return const_cast <VarBitInit*>( this ) ;
1317+ return this ;
13221318 }
13231319};
13241320
0 commit comments