Skip to content

Commit ab4d6cd

Browse files
authored
[TextAPI] Update RecordSlice attributes to follow code guidelines (#74743)
Came across simple code cleanup while upstreaming more code, this is primarily an NFC.
1 parent 3fd1d69 commit ab4d6cd

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

llvm/include/llvm/TextAPI/RecordsSlice.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class RecordsSlice {
128128
bool hasBinaryAttrs() const { return BA.get(); }
129129

130130
// Determine if record slice is unassigned.
131-
bool isEmpty() const {
131+
bool empty() const {
132132
return !hasBinaryAttrs() && Globals.empty() && Classes.empty() &&
133133
Categories.empty();
134134
}
@@ -141,7 +141,7 @@ class RecordsSlice {
141141
StringRef InstallName;
142142
StringRef UUID;
143143
StringRef Path;
144-
FileType fileType = FileType::Invalid;
144+
FileType File = FileType::Invalid;
145145
llvm::MachO::PackedVersion CurrentVersion;
146146
llvm::MachO::PackedVersion CompatVersion;
147147
uint8_t SwiftABI = 0;
@@ -153,14 +153,17 @@ class RecordsSlice {
153153
/// Return reference to BinaryAttrs.
154154
BinaryAttrs &getBinaryAttrs();
155155

156+
/// Store any strings owned by RecordSlice into allocator and return back
157+
/// reference to that.
158+
StringRef copyString(StringRef String);
159+
156160
private:
157161
const llvm::Triple TargetTriple;
158162
// Hold tapi converted triple to avoid unecessary casts.
159163
const Target TAPITarget;
160164

161165
/// BumpPtrAllocator to store generated/copied strings.
162166
llvm::BumpPtrAllocator StringAllocator;
163-
StringRef copyString(StringRef String);
164167

165168
/// Promote linkage of requested record. It is no-op if linkage type is lower
166169
/// than the current assignment.

llvm/unittests/TextAPI/RecordTests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ TEST(TAPIRecord, SimpleObjC) {
4848
TEST(TAPIRecord, SimpleSlice) {
4949
Triple T("arm64-apple-macosx13.3");
5050
RecordsSlice Slice(T);
51-
EXPECT_TRUE(Slice.isEmpty());
51+
EXPECT_TRUE(Slice.empty());
5252
Slice.addRecord("_OBJC_CLASS_$_NSObject", SymbolFlags::None,
5353
GlobalRecord::Kind::Unknown, RecordLinkage::Rexported);
5454
Slice.addRecord("_OBJC_METACLASS_$_NSObject", SymbolFlags::None,
@@ -59,7 +59,7 @@ TEST(TAPIRecord, SimpleSlice) {
5959
GlobalRecord::Kind::Unknown, RecordLinkage::Exported);
6060
Slice.addRecord("_foo", SymbolFlags::WeakDefined | SymbolFlags::Rexported,
6161
GlobalRecord::Kind::Variable, RecordLinkage::Rexported);
62-
EXPECT_FALSE(Slice.isEmpty());
62+
EXPECT_FALSE(Slice.empty());
6363

6464
// Check global.
6565
EXPECT_FALSE(Slice.findGlobal("_foo", GlobalRecord::Kind::Function));
@@ -108,7 +108,7 @@ TEST(TAPIRecord, SimpleSlice) {
108108
TEST(TAPIRecord, LibraryAttrs) {
109109
Triple T("arm64-apple-ios15.1");
110110
RecordsSlice Slice(T);
111-
EXPECT_TRUE(Slice.isEmpty());
111+
EXPECT_TRUE(Slice.empty());
112112

113113
auto BA = Slice.getBinaryAttrs();
114114
EXPECT_TRUE(Slice.hasBinaryAttrs());

0 commit comments

Comments
 (0)