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

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 13:11:17 PST 2023


Author: Cyndy Ishida
Date: 2023-12-07T13:11:13-08:00
New Revision: ab4d6cd6d14cef1a167de1aea2fe44900d1d7309

URL: https://github.com/llvm/llvm-project/commit/ab4d6cd6d14cef1a167de1aea2fe44900d1d7309
DIFF: https://github.com/llvm/llvm-project/commit/ab4d6cd6d14cef1a167de1aea2fe44900d1d7309.diff

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

Came across simple code cleanup while upstreaming more code, this is
primarily an NFC.

Added: 
    

Modified: 
    llvm/include/llvm/TextAPI/RecordsSlice.h
    llvm/unittests/TextAPI/RecordTests.cpp

Removed: 
    


################################################################################
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());


        


More information about the llvm-commits mailing list