[Lldb-commits] [lldb] d446d91 - [lldb] Use single-argument static_assert where applicable (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Sun Aug 7 14:29:46 PDT 2022


Author: Jonas Devlieghere
Date: 2022-08-07T14:26:08-07:00
New Revision: d446d91aa39da6b616aacb3e036d4ff0d8905337

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

LOG: [lldb] Use single-argument static_assert where applicable (NFC)

Since C++17 the message string for static_assert is optional. Replaces
static asserts with an empty string literal with the single-argument
variant.

Added: 
    

Modified: 
    lldb/include/lldb/Utility/Log.h
    lldb/include/lldb/Utility/Scalar.h
    lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
    lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
    lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
    lldb/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
    lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Utility/Log.h b/lldb/include/lldb/Utility/Log.h
index 404cbed14c18b..304dc7a0368f2 100644
--- a/lldb/include/lldb/Utility/Log.h
+++ b/lldb/include/lldb/Utility/Log.h
@@ -137,7 +137,7 @@ class Log final {
                        llvm::StringLiteral description, Cat mask)
         : name(name), description(description), flag(MaskType(mask)) {
       static_assert(
-          std::is_same<Log::MaskType, std::underlying_type_t<Cat>>::value, "");
+          std::is_same<Log::MaskType, std::underlying_type_t<Cat>>::value);
     }
   };
 
@@ -157,7 +157,7 @@ class Log final {
         : log_ptr(nullptr), categories(categories),
           default_flags(MaskType(default_flags)) {
       static_assert(
-          std::is_same<Log::MaskType, std::underlying_type_t<Cat>>::value, "");
+          std::is_same<Log::MaskType, std::underlying_type_t<Cat>>::value);
     }
 
     // This function is safe to call at any time. If the channel is disabled
@@ -306,8 +306,8 @@ template <typename Cat> Log::Channel &LogChannelFor() = delete;
 /// Returns a valid Log object if any of the provided categories are enabled.
 /// Otherwise, returns nullptr.
 template <typename Cat> Log *GetLog(Cat mask) {
-  static_assert(std::is_same<Log::MaskType, std::underlying_type_t<Cat>>::value,
-                "");
+  static_assert(
+      std::is_same<Log::MaskType, std::underlying_type_t<Cat>>::value);
   return LogChannelFor<Cat>().GetLog(Log::MaskType(mask));
 }
 

diff  --git a/lldb/include/lldb/Utility/Scalar.h b/lldb/include/lldb/Utility/Scalar.h
index 2801b1bd63266..34c2111ae0ac6 100644
--- a/lldb/include/lldb/Utility/Scalar.h
+++ b/lldb/include/lldb/Utility/Scalar.h
@@ -34,7 +34,7 @@ class Stream;
 class Scalar {
   template<typename T>
   static llvm::APSInt MakeAPSInt(T v) {
-    static_assert(std::is_integral<T>::value, "");
+    static_assert(std::is_integral<T>::value);
     static_assert(sizeof(T) <= sizeof(uint64_t), "Conversion loses precision!");
     return llvm::APSInt(
         llvm::APInt(sizeof(T) * 8, uint64_t(v), std::is_signed<T>::value),

diff  --git a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
index ecc5f6ffd2880..9052f04c84887 100644
--- a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
+++ b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
@@ -1539,7 +1539,7 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl(
       default:
         return return_valobj_sp;
       case 64: {
-        static_assert(sizeof(double) == sizeof(uint64_t), "");
+        static_assert(sizeof(double) == sizeof(uint64_t));
 
         if (IsArmHardFloat(thread)) {
           RegisterValue reg_value;
@@ -1563,7 +1563,7 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl(
       }
       case 16: // Half precision returned after a conversion to single precision
       case 32: {
-        static_assert(sizeof(float) == sizeof(uint32_t), "");
+        static_assert(sizeof(float) == sizeof(uint32_t));
 
         if (IsArmHardFloat(thread)) {
           RegisterValue reg_value;

diff  --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
index 9d8ef339432da..c2b6ce138c77e 100644
--- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
+++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
@@ -835,11 +835,11 @@ ValueObjectSP ABISysV_mips::GetReturnValueObjectImpl(
       default:
         return return_valobj_sp;
       case 32:
-        static_assert(sizeof(float) == sizeof(uint32_t), "");
+        static_assert(sizeof(float) == sizeof(uint32_t));
         value.GetScalar() = *((float *)(&raw_value));
         break;
       case 64:
-        static_assert(sizeof(double) == sizeof(uint64_t), "");
+        static_assert(sizeof(double) == sizeof(uint64_t));
         const RegisterInfo *r3_reg_info =
             reg_ctx->GetRegisterInfoByName("r3", 0);
         if (target_byte_order == eByteOrderLittle)
@@ -867,7 +867,7 @@ ValueObjectSP ABISysV_mips::GetReturnValueObjectImpl(
         default:
           return return_valobj_sp;
         case 64: {
-          static_assert(sizeof(double) == sizeof(uint64_t), "");
+          static_assert(sizeof(double) == sizeof(uint64_t));
           const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
           RegisterValue f1_value;
           DataExtractor f1_data;
@@ -899,7 +899,7 @@ ValueObjectSP ABISysV_mips::GetReturnValueObjectImpl(
           break;
         }
         case 32: {
-          static_assert(sizeof(float) == sizeof(uint32_t), "");
+          static_assert(sizeof(float) == sizeof(uint32_t));
           value.GetScalar() = (float)f0_data.GetFloat(&offset);
           break;
         }

diff  --git a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
index 24941be515de0..bd5624099dc5c 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
@@ -99,7 +99,7 @@ static UUID parseModuleId(llvm::Triple::OSType os, llvm::StringRef str) {
     uuid_t uuid;
     llvm::support::ubig32_t age;
   } data;
-  static_assert(sizeof(data) == 20, "");
+  static_assert(sizeof(data) == 20);
   // The textual module id encoding should be between 33 and 40 bytes long,
   // depending on the size of the age field, which is of variable length.
   // The first three chunks of the id are encoded in big endian, so we need to

diff  --git a/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp b/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp
index e606ec9c3b644..6a91b165a0c70 100644
--- a/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp
+++ b/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp
@@ -775,7 +775,7 @@ RegisterContextMinidump_ARM64::RegisterContextMinidump_ARM64(
   auto regs_data = data.GetData(&offset, sizeof(m_regs.v));
   if (regs_data)
     memcpy(m_regs.v, regs_data, sizeof(m_regs.v));
-  static_assert(k_num_regs == k_num_reg_infos, "");
+  static_assert(k_num_regs == k_num_reg_infos);
 }
 size_t RegisterContextMinidump_ARM64::GetRegisterCount() { return k_num_regs; }
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
index 4370039d1a8de..ce0a054eee08e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -91,7 +91,7 @@ class DIERef {
   uint32_t m_section : 1;
   dw_offset_t m_die_offset;
 };
-static_assert(sizeof(DIERef) == 8, "");
+static_assert(sizeof(DIERef) == 8);
 
 typedef std::vector<DIERef> DIEArray;
 

diff  --git a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp
index 54785e549908d..60d4c3bc293a3 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp
@@ -122,7 +122,7 @@ bool MachVMRegion::GetRegionForAddress(nub_addr_t addr) {
   m_start = addr;
   m_depth = 1024;
   mach_msg_type_number_t info_size = kRegionInfoSize;
-  static_assert(sizeof(info_size) == 4, "");
+  static_assert(sizeof(info_size) == 4);
   m_err =
       ::mach_vm_region_recurse(m_task, &m_start, &m_size, &m_depth,
                                (vm_region_recurse_info_t)&m_data, &info_size);


        


More information about the lldb-commits mailing list