Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions llvm/include/llvm/TextAPI/RecordsSlice.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class RecordsSlice {
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();
}
Expand All @@ -141,7 +141,7 @@ class RecordsSlice {
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;
Expand All @@ -153,14 +153,17 @@ class RecordsSlice {
/// 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.
const Target TAPITarget;

/// 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.
Expand Down
6 changes: 3 additions & 3 deletions llvm/unittests/TextAPI/RecordTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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));
Expand Down Expand Up @@ -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());
Expand Down