[TextAPI] Update RecordSlice attributes to follow code guidelines (#74743)

Came across simple code cleanup while upstreaming more code, this is
primarily an NFC.
This commit is contained in:
Cyndy Ishida 2023-12-07 13:11:13 -08:00 committed by GitHub
parent 3fd1d6953d
commit ab4d6cd6d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -128,7 +128,7 @@ public:
bool hasBinaryAttrs() const { return BA.get(); }
// Determine if record slice is unassigned.
bool isEmpty() const {
bool empty() const {
return !hasBinaryAttrs() && Globals.empty() && Classes.empty() &&
Categories.empty();
}
@ -141,7 +141,7 @@ public:
StringRef InstallName;
StringRef UUID;
StringRef Path;
FileType fileType = FileType::Invalid;
FileType File = FileType::Invalid;
llvm::MachO::PackedVersion CurrentVersion;
llvm::MachO::PackedVersion CompatVersion;
uint8_t SwiftABI = 0;
@ -153,6 +153,10 @@ public:
/// Return reference to BinaryAttrs.
BinaryAttrs &getBinaryAttrs();
/// Store any strings owned by RecordSlice into allocator and return back
/// reference to that.
StringRef copyString(StringRef String);
private:
const llvm::Triple TargetTriple;
// Hold tapi converted triple to avoid unecessary casts.
@ -160,7 +164,6 @@ private:
/// BumpPtrAllocator to store generated/copied strings.
llvm::BumpPtrAllocator StringAllocator;
StringRef copyString(StringRef String);
/// Promote linkage of requested record. It is no-op if linkage type is lower
/// than the current assignment.

View File

@ -48,7 +48,7 @@ TEST(TAPIRecord, SimpleObjC) {
TEST(TAPIRecord, SimpleSlice) {
Triple T("arm64-apple-macosx13.3");
RecordsSlice Slice(T);
EXPECT_TRUE(Slice.isEmpty());
EXPECT_TRUE(Slice.empty());
Slice.addRecord("_OBJC_CLASS_$_NSObject", SymbolFlags::None,
GlobalRecord::Kind::Unknown, RecordLinkage::Rexported);
Slice.addRecord("_OBJC_METACLASS_$_NSObject", SymbolFlags::None,
@ -59,7 +59,7 @@ TEST(TAPIRecord, SimpleSlice) {
GlobalRecord::Kind::Unknown, RecordLinkage::Exported);
Slice.addRecord("_foo", SymbolFlags::WeakDefined | SymbolFlags::Rexported,
GlobalRecord::Kind::Variable, RecordLinkage::Rexported);
EXPECT_FALSE(Slice.isEmpty());
EXPECT_FALSE(Slice.empty());
// Check global.
EXPECT_FALSE(Slice.findGlobal("_foo", GlobalRecord::Kind::Function));
@ -108,7 +108,7 @@ TEST(TAPIRecord, SimpleSlice) {
TEST(TAPIRecord, LibraryAttrs) {
Triple T("arm64-apple-ios15.1");
RecordsSlice Slice(T);
EXPECT_TRUE(Slice.isEmpty());
EXPECT_TRUE(Slice.empty());
auto BA = Slice.getBinaryAttrs();
EXPECT_TRUE(Slice.hasBinaryAttrs());