[Lldb-commits] [lldb] r137405 - /lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp

Johnny Chen johnny.chen at apple.com
Thu Aug 11 18:10:45 PDT 2011


Author: johnny
Date: Thu Aug 11 20:10:45 2011
New Revision: 137405

URL: http://llvm.org/viewvc/llvm-project?rev=137405&view=rev
Log:
Fix some warnings from static analyzer.
The initialization of 'replicated_element' to 0 is needed, otherwise we get a garbage value to start with.

Modified:
    lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=137405&r1=137404&r2=137405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Thu Aug 11 20:10:45 2011
@@ -794,7 +794,9 @@
     {
         uint32_t Rd; // the destination register
         uint32_t imm32; // the immediate value to be written to Rd
-        uint32_t carry; // the carry bit after ThumbExpandImm_C or ARMExpandImm_C.
+        uint32_t carry = 0; // the carry bit after ThumbExpandImm_C or ARMExpandImm_C.
+                            // for setflags == false, this value is a don't care
+                            // initialized to 0 to silence the static analyzer
         bool setflags;
         switch (encoding) {
             case eEncodingT1:
@@ -12004,7 +12006,7 @@
         if (!success)
             return false;
         
-        uint64_t replicated_element;
+        uint64_t replicated_element = 0;
         uint32_t esize = ebytes * 8;
         for (int e = 0; e < elements; ++e)
             replicated_element = (replicated_element << esize) | Bits64 (word, esize - 1, 0);
@@ -13048,9 +13050,7 @@
 {
     bool privileged = CurrentModeIsPrivileged();
 
-    uint32_t tmp_cpsr = 0;
-        
-    tmp_cpsr = tmp_cpsr | (Bits32 (m_opcode_cpsr, 23, 20) << 20);
+    uint32_t tmp_cpsr = Bits32 (m_opcode_cpsr, 23, 20) << 20;
                   
     if (BitIsSet (bytemask, 3))
     {





More information about the lldb-commits mailing list