Skip to content

Commit 82c2a82

Browse files
committed
[TextAPI] Remove TBD file attributes that aren't used anymore.
UUID's & `installapi` flag are no longer useful in recent apple linker/tapi. The reason for removing them is that these are attributes that record how a library was built but not really about the library itself. TBD files now only track information this is important as link time dependencies. Reviewed By: ributzka Differential Revision: https://reviews.llvm.org/D149861 (cherry picked from commit a066695)
1 parent 1ecd842 commit 82c2a82

File tree

14 files changed

+10
-169
lines changed

14 files changed

+10
-169
lines changed

llvm/include/llvm/TextAPI/InterfaceFile.h

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,6 @@ class InterfaceFile {
242242
/// Get the Objective-C constraint.
243243
ObjCConstraintType getObjCConstraint() const { return ObjcConstraint; }
244244

245-
/// Specify if this file was generated during InstallAPI (or not).
246-
void setInstallAPI(bool V = true) { IsInstallAPI = V; }
247-
248-
/// Check if this file was generated during InstallAPI.
249-
bool isInstallAPI() const { return IsInstallAPI; }
250-
251245
/// Set the parent umbrella frameworks.
252246
/// \param Target_ The target applicable to Parent
253247
/// \param Parent The name of Parent
@@ -293,25 +287,6 @@ class InterfaceFile {
293287
return ReexportedLibraries;
294288
}
295289

296-
/// Add an Target/UUID pair.
297-
///
298-
/// \param Target The target triple for which this applies.
299-
/// \param UUID The UUID of the library for the specified architecture.
300-
void addUUID(const Target &Target, StringRef UUID);
301-
302-
/// Add an Target/UUID pair.
303-
///
304-
/// \param Target The target triple for which this applies.
305-
/// \param UUID The UUID of the library for the specified architecture.
306-
void addUUID(const Target &Target, uint8_t UUID[16]);
307-
308-
/// Get the list of Target/UUID pairs.
309-
///
310-
/// \return Returns a list of Target/UUID pairs.
311-
const std::vector<std::pair<Target, std::string>> &uuids() const {
312-
return UUIDs;
313-
}
314-
315290
/// Add a library for inlining to top level library.
316291
///
317292
///\param Document The library to inline with top level library.
@@ -398,7 +373,7 @@ class InterfaceFile {
398373
};
399374

400375
/// The equality is determined by attributes that impact linking
401-
/// compatibilities. UUIDs, Path, & FileKind are irrelevant since these by
376+
/// compatibilities. Path, & FileKind are irrelevant since these by
402377
/// itself should not impact linking.
403378
/// This is an expensive operation.
404379
bool operator==(const InterfaceFile &O) const;
@@ -425,13 +400,11 @@ class InterfaceFile {
425400
uint8_t SwiftABIVersion{0};
426401
bool IsTwoLevelNamespace{false};
427402
bool IsAppExtensionSafe{false};
428-
bool IsInstallAPI{false};
429403
ObjCConstraintType ObjcConstraint = ObjCConstraintType::None;
430404
std::vector<std::pair<Target, std::string>> ParentUmbrellas;
431405
std::vector<InterfaceFileRef> AllowableClients;
432406
std::vector<InterfaceFileRef> ReexportedLibraries;
433407
std::vector<std::shared_ptr<InterfaceFile>> Documents;
434-
std::vector<std::pair<Target, std::string>> UUIDs;
435408
std::vector<std::pair<Target, std::string>> RPaths;
436409
std::unique_ptr<SymbolSet> SymbolsSet;
437410
InterfaceFile *Parent = nullptr;

llvm/lib/TextAPI/InterfaceFile.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,6 @@ void InterfaceFile::addRPath(const Target &InputTarget, StringRef RPath) {
5959
RPaths.emplace(Iter, InputTarget, std::string(RPath));
6060
}
6161

62-
void InterfaceFile::addUUID(const Target &Target_, StringRef UUID) {
63-
auto Iter = lower_bound(UUIDs, Target_,
64-
[](const std::pair<Target, std::string> &LHS,
65-
Target RHS) { return LHS.first < RHS; });
66-
67-
if ((Iter != UUIDs.end()) && !(Target_ < Iter->first)) {
68-
Iter->second = std::string(UUID);
69-
return;
70-
}
71-
72-
UUIDs.emplace(Iter, Target_, std::string(UUID));
73-
}
74-
75-
void InterfaceFile::addUUID(const Target &Target, uint8_t UUID[16]) {
76-
std::stringstream Stream;
77-
for (unsigned i = 0; i < 16; ++i) {
78-
if (i == 4 || i == 6 || i == 8 || i == 10)
79-
Stream << '-';
80-
Stream << std::setfill('0') << std::setw(2) << std::uppercase << std::hex
81-
<< static_cast<int>(UUID[i]);
82-
}
83-
addUUID(Target, Stream.str());
84-
}
85-
8662
void InterfaceFile::addTarget(const Target &Target) {
8763
addEntry(Targets, Target);
8864
}
@@ -123,8 +99,6 @@ bool InterfaceFile::operator==(const InterfaceFile &O) const {
12399
return false;
124100
if (IsAppExtensionSafe != O.IsAppExtensionSafe)
125101
return false;
126-
if (IsInstallAPI != O.IsInstallAPI)
127-
return false;
128102
if (ParentUmbrellas != O.ParentUmbrellas)
129103
return false;
130104
if (AllowableClients != O.AllowableClients)

llvm/lib/TextAPI/TextStub.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ template <> struct MappingTraits<const InterfaceFile *> {
427427
explicit NormalizedTBD(IO &IO) {}
428428
NormalizedTBD(IO &IO, const InterfaceFile *&File) {
429429
Architectures = File->getArchitectures();
430-
UUIDs = File->uuids();
431430
Platforms = File->getPlatforms();
432431
InstallName = File->getInstallName();
433432
CurrentVersion = PackedVersion(File->getCurrentVersion());
@@ -442,9 +441,6 @@ template <> struct MappingTraits<const InterfaceFile *> {
442441
if (!File->isTwoLevelNamespace())
443442
Flags |= TBDFlags::FlatNamespace;
444443

445-
if (File->isInstallAPI())
446-
Flags |= TBDFlags::InstallAPI;
447-
448444
if (!File->umbrellas().empty())
449445
ParentUmbrella = File->umbrellas().begin()->second;
450446

@@ -607,8 +603,6 @@ template <> struct MappingTraits<const InterfaceFile *> {
607603
File->setPath(Ctx->Path);
608604
File->setFileType(Ctx->FileKind);
609605
File->addTargets(synthesizeTargets(Architectures, Platforms));
610-
for (auto &ID : UUIDs)
611-
File->addUUID(ID.first, ID.second);
612606
File->setInstallName(InstallName);
613607
File->setCurrentVersion(CurrentVersion);
614608
File->setCompatibilityVersion(CompatibilityVersion);
@@ -624,7 +618,6 @@ template <> struct MappingTraits<const InterfaceFile *> {
624618
File->setTwoLevelNamespace(!(Flags & TBDFlags::FlatNamespace));
625619
File->setApplicationExtensionSafe(
626620
!(Flags & TBDFlags::NotApplicationExtensionSafe));
627-
File->setInstallAPI(Flags & TBDFlags::InstallAPI);
628621
}
629622

630623
for (const auto &Section : Exports) {
@@ -797,8 +790,6 @@ template <> struct MappingTraits<const InterfaceFile *> {
797790
TBDVersion = Ctx->FileKind >> 1;
798791
Targets.insert(Targets.begin(), File->targets().begin(),
799792
File->targets().end());
800-
for (const auto &IT : File->uuids())
801-
UUIDs.emplace_back(IT.first, IT.second);
802793
InstallName = File->getInstallName();
803794
CurrentVersion = File->getCurrentVersion();
804795
CompatibilityVersion = File->getCompatibilityVersion();
@@ -811,9 +802,6 @@ template <> struct MappingTraits<const InterfaceFile *> {
811802
if (!File->isTwoLevelNamespace())
812803
Flags |= TBDFlags::FlatNamespace;
813804

814-
if (File->isInstallAPI())
815-
Flags |= TBDFlags::InstallAPI;
816-
817805
{
818806
std::map<std::string, TargetList> valueToTargetList;
819807
for (const auto &it : File->umbrellas())
@@ -893,8 +881,6 @@ template <> struct MappingTraits<const InterfaceFile *> {
893881
auto *File = new InterfaceFile;
894882
File->setPath(Ctx->Path);
895883
File->setFileType(Ctx->FileKind);
896-
for (auto &id : UUIDs)
897-
File->addUUID(id.TargetID, id.Value);
898884
File->addTargets(Targets);
899885
File->setInstallName(InstallName);
900886
File->setCurrentVersion(CurrentVersion);
@@ -906,7 +892,6 @@ template <> struct MappingTraits<const InterfaceFile *> {
906892
File->setTwoLevelNamespace(!(Flags & TBDFlags::FlatNamespace));
907893
File->setApplicationExtensionSafe(
908894
!(Flags & TBDFlags::NotApplicationExtensionSafe));
909-
File->setInstallAPI(Flags & TBDFlags::InstallAPI);
910895

911896
for (const auto &CurrentSection : AllowableClients) {
912897
for (const auto &lib : CurrentSection.Values)
@@ -1007,9 +992,10 @@ template <> struct MappingTraits<const InterfaceFile *> {
1007992
static void mapKeysToValues(FileType FileKind, IO &IO,
1008993
const InterfaceFile *&File) {
1009994
MappingNormalization<NormalizedTBD, const InterfaceFile *> Keys(IO, File);
995+
std::vector<UUID> EmptyUUID;
1010996
IO.mapRequired("archs", Keys->Architectures);
1011997
if (FileKind != FileType::TBD_V1)
1012-
IO.mapOptional("uuids", Keys->UUIDs);
998+
IO.mapOptional("uuids", EmptyUUID);
1013999
IO.mapRequired("platform", Keys->Platforms);
10141000
if (FileKind != FileType::TBD_V1)
10151001
IO.mapOptional("flags", Keys->Flags, TBDFlags::None);
@@ -1037,10 +1023,11 @@ template <> struct MappingTraits<const InterfaceFile *> {
10371023
static void mapKeysToValuesV4(IO &IO, const InterfaceFile *&File) {
10381024
MappingNormalization<NormalizedTBD_V4, const InterfaceFile *> Keys(IO,
10391025
File);
1026+
std::vector<UUIDv4> EmptyUUID;
10401027
IO.mapTag("!tapi-tbd", true);
10411028
IO.mapRequired("tbd-version", Keys->TBDVersion);
10421029
IO.mapRequired("targets", Keys->Targets);
1043-
IO.mapOptional("uuids", Keys->UUIDs);
1030+
IO.mapOptional("uuids", EmptyUUID);
10441031
IO.mapOptional("flags", Keys->Flags, TBDFlags::None);
10451032
IO.mapRequired("install-name", Keys->InstallName);
10461033
IO.mapOptional("current-version", Keys->CurrentVersion,

llvm/lib/TextAPI/TextStubCommon.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,10 @@ QuotingType ScalarTraits<SwiftVersion>::mustQuote(StringRef) {
217217
return QuotingType::None;
218218
}
219219

220-
void ScalarTraits<UUID>::output(const UUID &Value, void *, raw_ostream &OS) {
221-
OS << Value.first << ": " << Value.second;
222-
}
220+
void ScalarTraits<UUID>::output(const UUID &Value, void *, raw_ostream &OS) {}
221+
223222
StringRef ScalarTraits<UUID>::input(StringRef Scalar, void *, UUID &Value) {
224-
auto Split = Scalar.split(':');
225-
auto Arch = Split.first.trim();
226-
auto UUID = Split.second.trim();
227-
if (UUID.empty())
228-
return "invalid uuid string pair";
229-
Value.second = std::string(UUID);
230-
Value.first = Target{getArchitectureFromName(Arch), PLATFORM_UNKNOWN};
223+
Value = {};
231224
return {};
232225
}
233226

llvm/lib/TextAPI/TextStubCommon.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ template <> struct ScalarTraits<SwiftVersion> {
9090
static QuotingType mustQuote(StringRef);
9191
};
9292

93+
// UUIDs are no longer respected but kept in the YAML parser
94+
// to keep reading in older TBDs.
9395
template <> struct ScalarTraits<UUID> {
9496
static void output(const UUID &, void *, raw_ostream &);
9597
static StringRef input(StringRef, void *, UUID &);

llvm/test/tools/llvm-tapi-diff/left-single-inline.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
; CHECK-NEXT: > 0
4646
; CHECK-NEXT: Swift ABI Version
4747
; CHECK-NEXT: > 5
48-
; CHECK-NEXT: InstallAPI
49-
; CHECK-NEXT: > false
5048
; CHECK-NEXT: Two Level Namespace
5149
; CHECK-NEXT: > true
5250
; CHECK-NEXT: Application Extension Safe

llvm/test/tools/llvm-tapi-diff/mismatched-number-of-inlines.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
; CHECK-NEXT: > 1.2
1818
; CHECK-NEXT: Swift ABI Version
1919
; CHECK-NEXT: > 3
20-
; CHECK-NEXT: InstallAPI
21-
; CHECK-NEXT: > false
2220
; CHECK-NEXT: Two Level Namespace
2321
; CHECK-NEXT: > true
2422
; CHECK-NEXT: Application Extension Safe

llvm/test/tools/llvm-tapi-diff/multiple-inlines.test

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
; CHECK-NEXT: > 0
5050
; CHECK-NEXT: Swift ABI Version
5151
; CHECK-NEXT: > 5
52-
; CHECK-NEXT: InstallAPI
53-
; CHECK-NEXT: > false
5452
; CHECK-NEXT: Two Level Namespace
5553
; CHECK-NEXT: > true
5654
; CHECK-NEXT: Application Extension Safe
@@ -77,8 +75,6 @@
7775
; CHECK-NEXT: > 1.2
7876
; CHECK-NEXT: Swift ABI Version
7977
; CHECK-NEXT: > 3
80-
; CHECK-NEXT: InstallAPI
81-
; CHECK-NEXT: > false
8278
; CHECK-NEXT: Two Level Namespace
8379
; CHECK-NEXT: > true
8480
; CHECK-NEXT: Application Extension Safe

llvm/test/tools/llvm-tapi-diff/right-single-inlines.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
; CHECK-NEXT: < 0
4343
; CHECK-NEXT: Swift ABI Version
4444
; CHECK-NEXT: < 5
45-
; CHECK-NEXT: InstallAPI
46-
; CHECK-NEXT: < false
4745
; CHECK-NEXT: Two Level Namespace
4846
; CHECK-NEXT: < true
4947
; CHECK-NEXT: Application Extension Safe

llvm/tools/llvm-tapi-diff/DiffEngine.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,6 @@ std::vector<DiffOutput> getSingleIF(InterfaceFile *Interface,
211211
diffAttribute("Swift ABI Version", Output,
212212
DiffScalarVal<uint8_t, AD_Diff_Scalar_Unsigned>(
213213
Order, Interface->getSwiftABIVersion()));
214-
diffAttribute("InstallAPI", Output,
215-
DiffScalarVal<bool, AD_Diff_Scalar_Bool>(
216-
Order, Interface->isInstallAPI()));
217214
diffAttribute("Two Level Namespace", Output,
218215
DiffScalarVal<bool, AD_Diff_Scalar_Bool>(
219216
Order, Interface->isTwoLevelNamespace()));
@@ -348,11 +345,6 @@ DiffEngine::findDifferences(const InterfaceFile *IFLHS,
348345
DiffScalarVal<uint8_t, AD_Diff_Scalar_Unsigned>(
349346
rhs, IFRHS->getSwiftABIVersion()),
350347
"Swift ABI Version"));
351-
if (IFLHS->isInstallAPI() != IFRHS->isInstallAPI())
352-
Output.push_back(recordDifferences(
353-
DiffScalarVal<bool, AD_Diff_Scalar_Bool>(lhs, IFLHS->isInstallAPI()),
354-
DiffScalarVal<bool, AD_Diff_Scalar_Bool>(rhs, IFRHS->isInstallAPI()),
355-
"InstallAPI"));
356348

357349
if (IFLHS->isTwoLevelNamespace() != IFRHS->isTwoLevelNamespace())
358350
Output.push_back(recordDifferences(DiffScalarVal<bool, AD_Diff_Scalar_Bool>(

0 commit comments

Comments
 (0)