Skip to content

Commit 07e3ca2

Browse files
committed
Revert "[TextAPI] Implement TBDv5 Reader"
This reverts commit b861b12. This reverts commit 4be1764. This patch wont build on some compilers on buildbot.
1 parent 4be1764 commit 07e3ca2

File tree

19 files changed

+27
-1270
lines changed

19 files changed

+27
-1270
lines changed

lld/test/MachO/Inputs/libStubLink.tbd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ current-version: 1.0.0
2222
exports:
2323
- targets: [ arm64-ios-simulator ]
2424
symbols: [ _arm64_sim_only ]
25-
...

lld/test/MachO/invalid/invalid-stub.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
# RUN: not %lld -L%t -linvalidYAML %t/test.o -o %t/test 2>&1 | FileCheck %s -DDIR=%t
88
# RUN: not %lld -F%t -framework invalidYAML %t/test.o -o %t/test 2>&1 | FileCheck %s -DDIR=%t --check-prefix=CHECK-FRAMEWORK
99

10-
# CHECK: could not load TAPI file at [[DIR]]{{[\\/]}}libinvalidYAML.tbd: unsupported file type
11-
# CHECK-FRAMEWORK: could not load TAPI file at [[DIR]]{{[\\/]}}invalidYAML.framework{{[\\/]}}invalidYAML.tbd: unsupported file type
10+
# CHECK: could not load TAPI file at [[DIR]]{{[\\/]}}libinvalidYAML.tbd: malformed file
11+
# CHECK-FRAMEWORK: could not load TAPI file at [[DIR]]{{[\\/]}}invalidYAML.framework{{[\\/]}}invalidYAML.tbd: malformed file
12+
1213
.globl _main
1314
_main:
1415
ret

lld/test/MachO/tapi-link.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ exports:
121121
re-exports: [ 'libNested.dylib' ]
122122
...
123123

124+
## This tests that weak and thread-local symbols are imported as such.
124125
#--- libTlvWeak.tbd
125126
--- !tapi-tbd
126127
tbd-version: 4
@@ -130,8 +131,8 @@ uuids:
130131
value: 00000000-0000-0000-0000-000000000000
131132
install-name: '/usr/lib/libTlvWeak.dylib'
132133
current-version: 0001.001.1
133-
exports: # Validate weak & thread-local symbols
134+
exports:
134135
- targets: [ x86_64-macos ]
135136
weak-symbols: [ _weak ]
136137
thread-local-symbols: [ _tlv ]
137-
...
138+
---

llvm/include/llvm/TextAPI/InterfaceFile.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ enum FileType : unsigned {
6666
/// Text-based stub file (.tbd) version 4.0
6767
TBD_V4 = 1U << 3,
6868

69-
/// Text-based stub file (.tbd) version 5.0
70-
TBD_V5 = 1U << 4,
71-
7269
All = ~0U,
7370

7471
LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/All),

llvm/lib/TextAPI/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ add_llvm_component_library(LLVMTextAPI
22
Architecture.cpp
33
ArchitectureSet.cpp
44
InterfaceFile.cpp
5-
TextStubV5.cpp
65
PackedVersion.cpp
76
Platform.cpp
87
Symbol.cpp

llvm/lib/TextAPI/TextStub.cpp

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,16 @@ struct UUIDv4 {
258258
UUIDv4(const Target &TargetID, const std::string &Value)
259259
: TargetID(TargetID), Value(Value) {}
260260
};
261+
262+
// clang-format off
263+
enum TBDFlags : unsigned {
264+
None = 0U,
265+
FlatNamespace = 1U << 0,
266+
NotApplicationExtensionSafe = 1U << 1,
267+
InstallAPI = 1U << 2,
268+
LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/InstallAPI),
269+
};
270+
// clang-format on
261271
} // end anonymous namespace.
262272

263273
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(Architecture)
@@ -1095,49 +1105,10 @@ static void DiagHandler(const SMDiagnostic &Diag, void *Context) {
10951105
File->ErrorMessage = ("malformed file\n" + Message).str();
10961106
}
10971107

1098-
namespace {
1099-
1100-
Expected<FileType> canReadFileType(MemoryBufferRef InputBuffer) {
1101-
auto TAPIFile = InputBuffer.getBuffer().trim();
1102-
if (TAPIFile.startswith("{") && TAPIFile.endswith("}"))
1103-
return FileType::TBD_V5;
1104-
1105-
if (!TAPIFile.endswith("..."))
1106-
return createStringError(std::errc::not_supported, "unsupported file type");
1107-
1108-
if (TAPIFile.startswith("--- !tapi-tbd\n"))
1109-
return FileType::TBD_V4;
1110-
1111-
if (TAPIFile.startswith("--- !tapi-tbd-v3\n"))
1112-
return FileType::TBD_V3;
1113-
1114-
if (TAPIFile.startswith("--- !tapi-tbd-v2\n"))
1115-
return FileType::TBD_V2;
1116-
1117-
if (TAPIFile.startswith("--- !tapi-tbd-v1\n") ||
1118-
TAPIFile.startswith("---\narchs:"))
1119-
return FileType::TBD_V1;
1120-
1121-
return createStringError(std::errc::not_supported, "unsupported file type");
1122-
}
1123-
} // namespace
1124-
11251108
Expected<std::unique_ptr<InterfaceFile>>
11261109
TextAPIReader::get(MemoryBufferRef InputBuffer) {
11271110
TextAPIContext Ctx;
11281111
Ctx.Path = std::string(InputBuffer.getBufferIdentifier());
1129-
if (auto FTOrErr = canReadFileType(InputBuffer))
1130-
Ctx.FileKind = *FTOrErr;
1131-
else
1132-
return FTOrErr.takeError();
1133-
1134-
// Handle JSON Format.
1135-
if (Ctx.FileKind >= FileType::TBD_V5) {
1136-
auto FileOrErr = getInterfaceFileFromJSON(InputBuffer.getBuffer());
1137-
if (!FileOrErr)
1138-
return FileOrErr.takeError();
1139-
return std::move(*FileOrErr);
1140-
}
11411112
yaml::Input YAMLIn(InputBuffer.getBuffer(), &Ctx, DiagHandler, &Ctx);
11421113

11431114
// Fill vector with interface file objects created by parsing the YAML file.

llvm/lib/TextAPI/TextStubCommon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// Implements common Text Stub YAML mappings.
9+
// Implememts common Text Stub YAML mappings.
1010
//
1111
//===----------------------------------------------------------------------===//
1212

llvm/lib/TextAPI/TextStubCommon.h

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@
2222

2323
using UUID = std::pair<llvm::MachO::Target, std::string>;
2424

25-
// clang-format off
26-
enum TBDFlags : unsigned {
27-
None = 0U,
28-
FlatNamespace = 1U << 0,
29-
NotApplicationExtensionSafe = 1U << 1,
30-
InstallAPI = 1U << 2,
31-
LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/InstallAPI),
32-
};
33-
// clang-format on
34-
3525
LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef, FlowStringRef)
3626
LLVM_YAML_STRONG_TYPEDEF(uint8_t, SwiftVersion)
3727
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(UUID)
@@ -40,13 +30,9 @@ LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(FlowStringRef)
4030
namespace llvm {
4131

4232
namespace MachO {
43-
class ArchitectureSet;
44-
class PackedVersion;
45-
46-
Expected<std::unique_ptr<InterfaceFile>>
47-
getInterfaceFileFromJSON(StringRef JSON);
48-
} // namespace MachO
49-
33+
class ArchitectureSet;
34+
class PackedVersion;
35+
}
5036
namespace yaml {
5137

5238
template <> struct ScalarTraits<FlowStringRef> {

0 commit comments

Comments
 (0)