diff --git a/llvm/include/llvm/TextAPI/RecordsSlice.h b/llvm/include/llvm/TextAPI/RecordsSlice.h index 779321c96efdc..8d733fd797ec5 100644 --- a/llvm/include/llvm/TextAPI/RecordsSlice.h +++ b/llvm/include/llvm/TextAPI/RecordsSlice.h @@ -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(); } @@ -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; @@ -153,6 +153,10 @@ 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. @@ -160,7 +164,6 @@ class RecordsSlice { /// 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. diff --git a/llvm/unittests/TextAPI/RecordTests.cpp b/llvm/unittests/TextAPI/RecordTests.cpp index 076137de6ff1f..dbe58ca0eea59 100644 --- a/llvm/unittests/TextAPI/RecordTests.cpp +++ b/llvm/unittests/TextAPI/RecordTests.cpp @@ -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());