[Lldb-commits] [lldb] 50630dc - [lldb] Fix warnings

Kazu Hirata via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 16 12:33:26 PDT 2022


Author: Kazu Hirata
Date: 2022-08-16T12:33:21-07:00
New Revision: 50630dcc4c8ab5de26e153a948577c4cc743b722

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

LOG: [lldb] Fix warnings

This patch fixes:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h:34:5:
  error: default label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]

and:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp:194:21:
  error: comparison of integers of different signs: 'int' and 'size_t'
  (aka 'unsigned long') [-Werror,-Wsign-compare]

Added: 
    

Modified: 
    lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
    lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
index 458b996d6ff62..10aefc6d9dc08 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
@@ -191,8 +191,7 @@ static InstrPattern PATTERNS[] = {
 bool EmulateInstructionRISCV::DecodeAndExecute(uint32_t inst,
                                                bool ignore_cond) {
   Log *log = GetLog(LLDBLog::Process | LLDBLog::Breakpoints);
-  for (int i = 0; i < llvm::array_lengthof(PATTERNS); ++i) {
-    const InstrPattern &pat = PATTERNS[i];
+  for (const InstrPattern &pat : PATTERNS) {
     if ((inst & pat.type_mask) == pat.eigen) {
       LLDB_LOGF(log, "EmulateInstructionRISCV::%s: inst(%x) was decoded to %s",
                 __FUNCTION__, inst, pat.name);

diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
index 6df9a7d409a75..39f7c429106bc 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
@@ -31,7 +31,6 @@ class EmulateInstructionRISCV : public EmulateInstruction {
       return true;
     case eInstructionTypePrologueEpilogue:
     case eInstructionTypeAll:
-    default:
       return false;
     }
   }


        


More information about the lldb-commits mailing list