[llvm] 59d90fe - Simplify some typedef struct

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 19 11:36:51 PDT 2021


Author: Fangrui Song
Date: 2021-06-19T11:36:44-07:00
New Revision: 59d90fe817b5f1feae1a1406bd487e6552b9928d

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

LOG: Simplify some typedef struct

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
    llvm/lib/Target/PowerPC/PPCFastISel.cpp
    llvm/tools/llvm-profdata/llvm-profdata.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index ead953cbb8e54..75a0ab641e435 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -971,10 +971,10 @@ class TransferTracker {
     SmallVector<MachineInstr *, 4> Insts; /// Vector of DBG_VALUEs to insert.
   };
 
-  typedef struct {
+  struct LocAndProperties {
     LocIdx Loc;
     DbgValueProperties Properties;
-  } LocAndProperties;
+  };
 
   /// Collection of transfers (DBG_VALUEs) to be inserted.
   SmallVector<Transfer, 32> Transfers;

diff  --git a/llvm/lib/Target/PowerPC/PPCFastISel.cpp b/llvm/lib/Target/PowerPC/PPCFastISel.cpp
index 0cdf44e31ab9b..dfb2c1e5c0f58 100644
--- a/llvm/lib/Target/PowerPC/PPCFastISel.cpp
+++ b/llvm/lib/Target/PowerPC/PPCFastISel.cpp
@@ -63,7 +63,7 @@ using namespace llvm;
 
 namespace {
 
-typedef struct Address {
+struct Address {
   enum {
     RegBase,
     FrameIndexBase
@@ -81,7 +81,7 @@ typedef struct Address {
    : BaseType(RegBase), Offset(0) {
      Base.Reg = 0;
    }
-} Address;
+};
 
 class PPCFastISel final : public FastISel {
 

diff  --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index c15d467762a28..b373c8506e267 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -2004,7 +2004,8 @@ static int overlap_main(int argc, const char *argv[]) {
   return 0;
 }
 
-typedef struct ValueSitesStats {
+namespace {
+struct ValueSitesStats {
   ValueSitesStats()
       : TotalNumValueSites(0), TotalNumValueSitesWithValueProfile(0),
         TotalNumValues(0) {}
@@ -2012,7 +2013,8 @@ typedef struct ValueSitesStats {
   uint64_t TotalNumValueSitesWithValueProfile;
   uint64_t TotalNumValues;
   std::vector<unsigned> ValueSitesHistogram;
-} ValueSitesStats;
+};
+} // namespace
 
 static void traverseAllValueSites(const InstrProfRecord &Func, uint32_t VK,
                                   ValueSitesStats &Stats, raw_fd_ostream &OS,


        


More information about the llvm-commits mailing list