File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -1318,13 +1318,9 @@ void LinkerDriver::convertResources() {
1318
1318
}
1319
1319
1320
1320
void LinkerDriver::maybeCreateECExportThunk (StringRef name, Symbol *&sym) {
1321
- Defined *def;
1322
1321
if (!sym)
1323
1322
return ;
1324
- if (auto undef = dyn_cast<Undefined>(sym))
1325
- def = undef->getDefinedWeakAlias ();
1326
- else
1327
- def = dyn_cast<Defined>(sym);
1323
+ Defined *def = sym->getDefined ();
1328
1324
if (!def)
1329
1325
return ;
1330
1326
@@ -1356,11 +1352,7 @@ void LinkerDriver::createECExportThunks() {
1356
1352
Symbol *sym = ctx.symtab .find (targetName);
1357
1353
if (!sym)
1358
1354
continue ;
1359
- Defined *targetSym;
1360
- if (auto undef = dyn_cast<Undefined>(sym))
1361
- targetSym = undef->getDefinedWeakAlias ();
1362
- else
1363
- targetSym = dyn_cast<Defined>(sym);
1355
+ Defined *targetSym = sym->getDefined ();
1364
1356
if (!targetSym)
1365
1357
continue ;
1366
1358
Original file line number Diff line number Diff line change @@ -91,6 +91,14 @@ bool Symbol::isLive() const {
91
91
return true ;
92
92
}
93
93
94
+ Defined *Symbol::getDefined () {
95
+ if (auto d = dyn_cast<Defined>(this ))
96
+ return d;
97
+ if (auto u = dyn_cast<Undefined>(this ))
98
+ return u->getDefinedWeakAlias ();
99
+ return nullptr ;
100
+ }
101
+
94
102
void Symbol::replaceKeepingName (Symbol *other, size_t size) {
95
103
StringRef origName = getName ();
96
104
memcpy (this , other, size);
Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ class Symbol {
95
95
symbolKind == LazyDLLSymbolKind;
96
96
}
97
97
98
+ // Get the Defined symbol associated with this symbol, either itself or its
99
+ // weak alias.
100
+ Defined *getDefined ();
101
+
98
102
private:
99
103
void computeName ();
100
104
You can’t perform that action at this time.
0 commit comments