@@ -115,16 +115,16 @@ bool ICF::equalsConstant(const ConcatInputSection *ia,
115115 return false ;
116116 if (ra.offset != rb.offset )
117117 return false ;
118- if (ra. referent . is <Symbol *>() != rb. referent . is <Symbol *>())
118+ if (isa <Symbol *>(ra. referent ) != isa <Symbol *>(rb. referent ))
119119 return false ;
120120
121121 InputSection *isecA, *isecB;
122122
123123 uint64_t valueA = 0 ;
124124 uint64_t valueB = 0 ;
125- if (ra. referent . is <Symbol *>()) {
126- const auto *sa = ra. referent . get <Symbol *>();
127- const auto *sb = rb. referent . get <Symbol *>();
125+ if (isa <Symbol *>(ra. referent )) {
126+ const auto *sa = cast <Symbol *>(ra. referent );
127+ const auto *sb = cast <Symbol *>(rb. referent );
128128 if (sa->kind () != sb->kind ())
129129 return false ;
130130 // ICF runs before Undefineds are treated (and potentially converted into
@@ -143,8 +143,8 @@ bool ICF::equalsConstant(const ConcatInputSection *ia,
143143 isecB = db->isec ();
144144 valueB = db->value ;
145145 } else {
146- isecA = ra. referent . get <InputSection *>();
147- isecB = rb. referent . get <InputSection *>();
146+ isecA = cast <InputSection *>(ra. referent );
147+ isecB = cast <InputSection *>(rb. referent );
148148 }
149149
150150 // Typically, we should not encounter sections marked with `keepUnique` at
@@ -167,7 +167,7 @@ bool ICF::equalsConstant(const ConcatInputSection *ia,
167167 return ra.addend == rb.addend ;
168168 // Else we have two literal sections. References to them are equal iff their
169169 // offsets in the output section are equal.
170- if (ra. referent . is <Symbol *>())
170+ if (isa <Symbol *>(ra. referent ))
171171 // For symbol relocs, we compare the contents at the symbol address. We
172172 // don't do `getOffset(value + addend)` because value + addend may not be
173173 // a valid offset in the literal section.
@@ -195,21 +195,21 @@ bool ICF::equalsVariable(const ConcatInputSection *ia,
195195 if (ra.referent == rb.referent )
196196 return true ;
197197 const ConcatInputSection *isecA, *isecB;
198- if (ra. referent . is <Symbol *>()) {
198+ if (isa <Symbol *>(ra. referent )) {
199199 // Matching DylibSymbols are already filtered out by the
200200 // identical-referent check above. Non-matching DylibSymbols were filtered
201201 // out in equalsConstant(). So we can safely cast to Defined here.
202- const auto *da = cast<Defined>(ra. referent . get <Symbol *>());
203- const auto *db = cast<Defined>(rb. referent . get <Symbol *>());
202+ const auto *da = cast<Defined>(cast <Symbol *>(ra. referent ));
203+ const auto *db = cast<Defined>(cast <Symbol *>(rb. referent ));
204204 if (da->isAbsolute ())
205205 return true ;
206206 isecA = dyn_cast<ConcatInputSection>(da->isec ());
207207 if (!isecA)
208208 return true ; // literal sections were checked in equalsConstant.
209209 isecB = cast<ConcatInputSection>(db->isec ());
210210 } else {
211- const auto *sa = ra. referent . get <InputSection *>();
212- const auto *sb = rb. referent . get <InputSection *>();
211+ const auto *sa = cast <InputSection *>(ra. referent );
212+ const auto *sb = cast <InputSection *>(rb. referent );
213213 isecA = dyn_cast<ConcatInputSection>(sa);
214214 if (!isecA)
215215 return true ;
0 commit comments