apelete updated this revision to Diff 55753.
apelete added a comment.

[clang-analyzer] fix warnings emitted on lldb code base

Changes since last revision:

- fast forward rebase on git master branch.


http://reviews.llvm.org/D19086

Files:
  include/lldb/Utility/LLDBAssert.h
  source/API/SBThread.cpp
  source/Core/DynamicLoader.cpp
  source/Core/FormatEntity.cpp
  source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
@@ -468,7 +468,6 @@
                 DWARFFormValue encoding_uid;
                 uint32_t member_byte_offset = UINT32_MAX;
                 DWARFExpression member_location_expression(dwarf_cu);
-                bool artificial = true;
 
                 DWARFAttributes attributes;
                 size_t num_attributes = die.GetAttributes(attributes);
@@ -494,7 +493,7 @@
                                     member_byte_offset = form_value.Unsigned();
                                 break;
                             case DW_AT_artificial:
-                                artificial = form_value.Boolean();
+                                // TODO: Handle when needed
                                 break;
                             case DW_AT_accessibility:
                                 // TODO: Handle when needed
@@ -506,7 +505,7 @@
                     }
                 }
 
-                if (strcmp(name, ".dynamic_type") == 0)
+                if (name && strcmp(name, ".dynamic_type") == 0)
                     m_ast.SetDynamicTypeId(compiler_type, member_location_expression);
                 else
                 {
Index: source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
===================================================================
--- source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
+++ source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
@@ -283,8 +283,11 @@
     RegisterContext *reg_ctx = thread->GetRegisterContext().get();
 
     if (!reg_ctx)
+    {
         error.SetErrorString("no registers are available");
-        
+        return error;
+    }
+
     DataExtractor data;
     Error data_error;
     size_t num_bytes = new_value_sp->GetData(data, data_error);
@@ -307,6 +310,7 @@
             if (num_bytes <= 16)
             {
                 const RegisterInfo *r2_info = reg_ctx->GetRegisterInfoByName("r2", 0);
+
                 if (num_bytes <= 8)
                 {
                     uint64_t raw_value = data.GetMaxU64(&offset, num_bytes);
Index: source/Core/FormatEntity.cpp
===================================================================
--- source/Core/FormatEntity.cpp
+++ source/Core/FormatEntity.cpp
@@ -1013,7 +1013,8 @@
 
             if (special_directions.empty())
             {
-                success &= item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
+                if (item)
+                    success &= item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
             }
             else
             {
Index: source/Core/DynamicLoader.cpp
===================================================================
--- source/Core/DynamicLoader.cpp
+++ source/Core/DynamicLoader.cpp
@@ -194,7 +194,7 @@
         {
             // Try to fetch the load address of the file from the process as we need absolute load
             // address to read the file out of the memory instead of a load bias.
-            bool is_loaded;
+            bool is_loaded = false;
             lldb::addr_t load_addr;
             Error error = m_process->GetFileLoadAddress(file, is_loaded, load_addr);
             if (error.Success() && is_loaded)
Index: source/API/SBThread.cpp
===================================================================
--- source/API/SBThread.cpp
+++ source/API/SBThread.cpp
@@ -923,7 +923,7 @@
         bool abort_other_plans = false;
         bool stop_other_threads = false;
         Thread *thread = exe_ctx.GetThreadPtr();
-        if (sb_frame.GetThread().GetThreadID() != thread->GetID())
+        if (log && sb_frame.GetThread().GetThreadID() != thread->GetID())
         {
             log->Printf("SBThread(%p)::StepOutOfFrame passed a frame from another thread (0x%" PRIx64 " vrs. 0x%" PRIx64 ", returning.",
                         static_cast<void*>(exe_ctx.GetThreadPtr()),
Index: include/lldb/Utility/LLDBAssert.h
===================================================================
--- include/lldb/Utility/LLDBAssert.h
+++ include/lldb/Utility/LLDBAssert.h
@@ -24,7 +24,7 @@
                  const char* expr_text,
                  const char* func,
                  const char* file,
-                 unsigned int line);
+                 unsigned int line) __attribute__((__noreturn__));
 }
 
 #endif // utility_LLDBAssert_h_
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to