@@ -1314,44 +1314,11 @@ bool LinkEntity::isAvailableExternally(IRGenModule &IGM) const {
1314
1314
llvm_unreachable (" bad link entity kind" );
1315
1315
}
1316
1316
1317
- bool LinkEntity::isFragile (ForDefinition_t isDefinition) const {
1318
- switch (getKind ()) {
1319
- case Kind::SILFunction:
1320
- return getSILFunction ()->isSerialized ();
1321
-
1322
- case Kind::SILGlobalVariable:
1323
- return getSILGlobalVariable ()->isSerialized ();
1324
-
1325
- case Kind::ReflectionAssociatedTypeDescriptor:
1326
- case Kind::ReflectionSuperclassDescriptor:
1327
- case Kind::AssociatedTypeMetadataAccessFunction:
1328
- case Kind::AssociatedTypeWitnessTableAccessFunction:
1329
- case Kind::GenericProtocolWitnessTableCache:
1330
- case Kind::GenericProtocolWitnessTableInstantiationFunction:
1331
- case Kind::ObjCClassRef:
1332
- return false ;
1333
-
1334
- default :
1335
- break ;
1336
- }
1337
- if (isProtocolConformanceKind (getKind ())) {
1338
- auto conformance = getProtocolConformance ();
1339
-
1340
- auto conformanceModule = conformance->getDeclContext ()->getParentModule ();
1341
- auto isCompletelySerialized =
1342
- conformanceModule->getASTContext ().LangOpts .SILSerializeWitnessTables ;
1343
-
1344
- // The conformance is fragile if it is in a -sil-serialize-all module.
1345
- return isCompletelySerialized;
1346
- }
1347
- return false ;
1348
- }
1349
-
1350
1317
static std::tuple<llvm::GlobalValue::LinkageTypes,
1351
1318
llvm::GlobalValue::VisibilityTypes,
1352
1319
llvm::GlobalValue::DLLStorageClassTypes>
1353
1320
getIRLinkage (const UniversalLinkageInfo &info, SILLinkage linkage,
1354
- bool isFragile, bool isSILOnly, ForDefinition_t isDefinition,
1321
+ bool isSILOnly, ForDefinition_t isDefinition,
1355
1322
bool isWeakImported) {
1356
1323
#define RESULT (LINKAGE, VISIBILITY, DLL_STORAGE ) \
1357
1324
std::make_tuple (llvm::GlobalValue::LINKAGE##Linkage, \
@@ -1372,29 +1339,6 @@ getIRLinkage(const UniversalLinkageInfo &info, SILLinkage linkage,
1372
1339
info.UseDLLStorage ? llvm::GlobalValue::DLLImportStorageClass
1373
1340
: llvm::GlobalValue::DefaultStorageClass;
1374
1341
1375
- if (isFragile) {
1376
- // Fragile functions/globals must be visible from outside, regardless of
1377
- // their access level. If a caller is also fragile and inlined into another
1378
- // module it must be able to access this (not-inlined) function/global.
1379
- switch (linkage) {
1380
- case SILLinkage::Hidden:
1381
- case SILLinkage::Private:
1382
- linkage = SILLinkage::Public;
1383
- break ;
1384
-
1385
- case SILLinkage::HiddenExternal:
1386
- case SILLinkage::PrivateExternal:
1387
- linkage = SILLinkage::PublicExternal;
1388
- break ;
1389
-
1390
- case SILLinkage::Public:
1391
- case SILLinkage::Shared:
1392
- case SILLinkage::PublicExternal:
1393
- case SILLinkage::SharedExternal:
1394
- break ;
1395
- }
1396
- }
1397
-
1398
1342
switch (linkage) {
1399
1343
case SILLinkage::Public:
1400
1344
// Don't code-gen transparent functions. Internal linkage will enable llvm
@@ -1453,8 +1397,7 @@ getIRLinkage(const UniversalLinkageInfo &info, SILLinkage linkage,
1453
1397
return std::make_tuple (isDefinition
1454
1398
? llvm::GlobalValue::AvailableExternallyLinkage
1455
1399
: llvm::GlobalValue::ExternalLinkage,
1456
- isFragile ? llvm::GlobalValue::DefaultVisibility
1457
- : llvm::GlobalValue::HiddenVisibility,
1400
+ llvm::GlobalValue::HiddenVisibility,
1458
1401
ImportedStorage);
1459
1402
1460
1403
}
@@ -1472,7 +1415,7 @@ static void updateLinkageForDefinition(IRGenModule &IGM,
1472
1415
UniversalLinkageInfo linkInfo (IGM);
1473
1416
auto linkage =
1474
1417
getIRLinkage (linkInfo, entity.getLinkage (ForDefinition),
1475
- entity.isFragile (ForDefinition), entity. isSILOnly (),
1418
+ entity.isSILOnly (),
1476
1419
ForDefinition, entity.isWeakImported (IGM.getSwiftModule ()));
1477
1420
global->setLinkage (std::get<0 >(linkage));
1478
1421
global->setVisibility (std::get<1 >(linkage));
@@ -1504,7 +1447,7 @@ LinkInfo LinkInfo::get(const UniversalLinkageInfo &linkInfo,
1504
1447
1505
1448
std::tie (result.Linkage , result.Visibility , result.DLLStorageClass ) =
1506
1449
getIRLinkage (linkInfo, entity.getLinkage (isDefinition),
1507
- entity.isFragile (isDefinition), entity. isSILOnly (),
1450
+ entity.isSILOnly (),
1508
1451
isDefinition, entity.isWeakImported (swiftModule));
1509
1452
1510
1453
result.ForDefinition = isDefinition;
@@ -1515,20 +1458,19 @@ LinkInfo LinkInfo::get(const UniversalLinkageInfo &linkInfo,
1515
1458
LinkInfo LinkInfo::get (const UniversalLinkageInfo &linkInfo,
1516
1459
StringRef name,
1517
1460
SILLinkage linkage,
1518
- bool isFragile,
1519
1461
bool isSILOnly,
1520
1462
ForDefinition_t isDefinition,
1521
1463
bool isWeakImported) {
1522
1464
LinkInfo result;
1523
-
1465
+
1524
1466
result.Name += name;
1525
1467
std::tie (result.Linkage , result.Visibility , result.DLLStorageClass ) =
1526
- getIRLinkage (linkInfo, linkage, isFragile, isSILOnly,
1468
+ getIRLinkage (linkInfo, linkage, isSILOnly,
1527
1469
isDefinition, isWeakImported);
1528
1470
result.ForDefinition = isDefinition;
1529
1471
return result;
1530
1472
}
1531
-
1473
+
1532
1474
static bool isPointerTo (llvm::Type *ptrTy, llvm::Type *objTy) {
1533
1475
return cast<llvm::PointerType>(ptrTy)->getElementType () == objTy;
1534
1476
}
0 commit comments