[Lldb-commits] [lldb] r361580 - Fix integer literals which are cast to bool

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu May 23 17:44:33 PDT 2019


Author: jdevlieghere
Date: Thu May 23 17:44:33 2019
New Revision: 361580

URL: http://llvm.org/viewvc/llvm-project?rev=361580&view=rev
Log:
Fix integer literals which are cast to bool

This change replaces built-in types that are implicitly converted to
booleans.

Differential revision: https://reviews.llvm.org/D62284

Modified:
    lldb/trunk/source/Commands/CommandObjectPlatform.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Commands/CommandObjectThread.cpp
    lldb/trunk/source/Core/Address.cpp
    lldb/trunk/source/Host/macosx/objcxx/Host.mm
    lldb/trunk/source/Interpreter/Options.cpp
    lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Symbol/ClangASTContext.cpp
    lldb/trunk/source/Symbol/ClangASTImporter.cpp
    lldb/trunk/source/Symbol/CompilerType.cpp
    lldb/trunk/source/Symbol/Function.cpp
    lldb/trunk/source/Symbol/SymbolContext.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/Target.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Utility/JSON.cpp
    lldb/trunk/source/Utility/SelectHelper.cpp
    lldb/trunk/source/Utility/StructuredData.cpp
    lldb/trunk/tools/debugserver/source/DNB.cpp
    lldb/trunk/tools/debugserver/source/JSON.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
    lldb/trunk/tools/debugserver/source/RNBRemote.cpp
    lldb/trunk/tools/debugserver/source/debugserver.cpp
    lldb/trunk/tools/debugserver/source/libdebugserver.cpp

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Thu May 23 17:44:33 2019
@@ -235,7 +235,7 @@ protected:
                  host_platform_sp->GetDescription());
 
     uint32_t idx;
-    for (idx = 0; 1; ++idx) {
+    for (idx = 0; true; ++idx) {
       const char *plugin_name =
           PluginManager::GetPlatformPluginNameAtIndex(idx);
       if (plugin_name == nullptr)

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu May 23 17:44:33 2019
@@ -3740,7 +3740,7 @@ public:
         break;
 
       case 'v':
-        m_verbose = 1;
+        m_verbose = true;
         break;
 
       case 'A':

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Thu May 23 17:44:33 2019
@@ -482,7 +482,7 @@ public:
 
       case 'e':
         if (option_arg == "block") {
-          m_end_line_is_block_end = 1;
+          m_end_line_is_block_end = true;
           break;
         }
         if (option_arg.getAsInteger(0, m_end_line))

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Thu May 23 17:44:33 2019
@@ -161,7 +161,7 @@ static bool ReadAddress(ExecutionContext
 static bool DumpUInt(ExecutionContextScope *exe_scope, const Address &address,
                      uint32_t byte_size, Stream *strm) {
   if (exe_scope == nullptr || byte_size == 0)
-    return 0;
+    return false;
   std::vector<uint8_t> buf(byte_size, 0);
 
   if (ReadBytes(exe_scope, address, &buf[0], buf.size()) == buf.size()) {

Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/Host.mm?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/objcxx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/objcxx/Host.mm Thu May 23 17:44:33 2019
@@ -547,7 +547,7 @@ static bool GetMacOSXProcessArgs(const P
                 match_info_ptr->GetNameMatchType(),
                 match_info_ptr->GetProcessInfo().GetName())) {
           // Skip NULLs
-          while (1) {
+          while (true) {
             const uint8_t *p = data.PeekData(offset, 1);
             if ((p == NULL) || (*p != '\0'))
               break;

Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Thu May 23 17:44:33 2019
@@ -1007,7 +1007,7 @@ llvm::Expected<Args> Options::ParseAlias
   std::unique_lock<std::mutex> lock;
   OptionParser::Prepare(lock);
   int val;
-  while (1) {
+  while (true) {
     int long_options_index = -1;
     val = OptionParser::Parse(argv.size(), &*argv.begin(), sstr.GetString(),
                               long_options, &long_options_index);
@@ -1160,7 +1160,7 @@ OptionElementVector Options::ParseForCom
   bool failed_once = false;
   uint32_t dash_dash_pos = -1;
 
-  while (1) {
+  while (true) {
     bool missing_argument = false;
     int long_options_index = -1;
 
@@ -1358,7 +1358,7 @@ llvm::Expected<Args> Options::Parse(cons
   std::unique_lock<std::mutex> lock;
   OptionParser::Prepare(lock);
   int val;
-  while (1) {
+  while (true) {
     int long_options_index = -1;
     val = OptionParser::Parse(argv.size(), &*argv.begin(), sstr.GetString(),
                               long_options, &long_options_index);

Modified: lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp Thu May 23 17:44:33 2019
@@ -917,15 +917,15 @@ ValueObjectSP ABISysV_mips64::GetReturnV
       uint32_t integer_bytes = 0;
 
       // True if return values are in FP return registers.
-      bool use_fp_regs = 0;
+      bool use_fp_regs = false;
       // True if we found any non floating point field in structure.
-      bool found_non_fp_field = 0;
+      bool found_non_fp_field = false;
       // True if return values are in r2 register.
-      bool use_r2 = 0;
+      bool use_r2 = false;
       // True if return values are in r3 register.
-      bool use_r3 = 0;
+      bool use_r3 = false;
       // True if the result is copied into our data buffer
-      bool sucess = 0;
+      bool sucess = false;
       std::string name;
       bool is_complex;
       uint32_t count;
@@ -943,9 +943,9 @@ ValueObjectSP ABISysV_mips64::GetReturnV
                                                    nullptr, nullptr);
 
           if (field_compiler_type.IsFloatingPointType(count, is_complex))
-            use_fp_regs = 1;
+            use_fp_regs = true;
           else
-            found_non_fp_field = 1;
+            found_non_fp_field = true;
         }
 
         if (use_fp_regs && !found_non_fp_field) {
@@ -1059,20 +1059,20 @@ ValueObjectSP ABISysV_mips64::GetReturnV
               // structure
               integer_bytes = integer_bytes + *field_byte_width +
                               padding; // Increase the consumed bytes.
-              use_r2 = 1;
+              use_r2 = true;
             } else {
               // There isn't enough space left in r2 for this field, so this
               // will be in r3.
               integer_bytes = integer_bytes + *field_byte_width +
                               padding; // Increase the consumed bytes.
-              use_r3 = 1;
+              use_r3 = true;
             }
           }
           // We already have consumed at-least 8 bytes that means r2 is done,
           // and this field will be in r3. Check if this field can fit in r3.
           else if (integer_bytes + *field_byte_width + padding <= 16) {
             integer_bytes = integer_bytes + *field_byte_width + padding;
-            use_r3 = 1;
+            use_r3 = true;
           } else {
             // There isn't any space left for this field, this should not
             // happen as we have already checked the overall size is not
@@ -1085,10 +1085,10 @@ ValueObjectSP ABISysV_mips64::GetReturnV
       // Vector types up to 16 bytes are returned in GP return registers
       if (type_flags & eTypeIsVector) {
         if (*byte_size <= 8)
-          use_r2 = 1;
+          use_r2 = true;
         else {
-          use_r2 = 1;
-          use_r3 = 1;
+          use_r2 = true;
+          use_r3 = true;
         }
       }
 
@@ -1100,7 +1100,7 @@ ValueObjectSP ABISysV_mips64::GetReturnV
             error);
         if (bytes_copied != r2_info->byte_size)
           return return_valobj_sp;
-        sucess = 1;
+        sucess = true;
       }
       if (use_r3) {
         reg_ctx->ReadRegister(r3_info, r3_value);
@@ -1110,7 +1110,7 @@ ValueObjectSP ABISysV_mips64::GetReturnV
 
         if (bytes_copied != r3_info->byte_size)
           return return_valobj_sp;
-        sucess = 1;
+        sucess = true;
       }
       if (sucess) {
         // The result is in our data buffer.  Create a variable object out of

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp Thu May 23 17:44:33 2019
@@ -239,7 +239,7 @@ bool ASTResultSynthesizer::SynthesizeBod
       break;
 
     last_expr = implicit_cast->getSubExpr();
-  } while (0);
+  } while (false);
 
   // is_lvalue is used to record whether the expression returns an assignable
   // Lvalue or an Rvalue.  This is relevant because they are handled

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Thu May 23 17:44:33 2019
@@ -101,7 +101,7 @@ void ClangASTSource::InstallASTContext(c
         break;
 
       sources.push_back(runtime_decl_vendor->GetImporterSource());
-    } while (0);
+    } while (false);
 
     do {
       DeclVendor *modules_decl_vendor =
@@ -111,7 +111,7 @@ void ClangASTSource::InstallASTContext(c
         break;
 
       sources.push_back(modules_decl_vendor->GetImporterSource());
-    } while (0);
+    } while (false);
 
     if (!is_shared_context) {
       // Update the scratch AST context's merger to reflect any new sources we
@@ -125,7 +125,9 @@ void ClangASTSource::InstallASTContext(c
       sources.push_back({*scratch_ast_context->getASTContext(),
                          *scratch_ast_context->getFileManager(),
                          scratch_ast_context->GetOriginMap()});
-    } while (0);
+    }
+    while (false)
+      ;
 
     m_merger_up =
         llvm::make_unique<clang::ExternalASTMerger>(target, sources);
@@ -934,7 +936,7 @@ void ClangASTSource::FindExternalVisible
             context.m_found.type = true;
           }
         }
-      } while (0);
+      } while (false);
     }
 
     if (!context.m_found.type) {
@@ -985,10 +987,10 @@ void ClangASTSource::FindExternalVisible
         }
 
         context.AddNamedDecl(copied_named_decl);
-      } while (0);
+      } while (false);
     }
 
-  } while (0);
+  } while (false);
 }
 
 template <class D> class TaggedASTDecl {
@@ -1173,7 +1175,7 @@ void ClangASTSource::FindObjCMethodDecls
     if (FindObjCMethodDeclsWithOrigin(current_id, context,
                                       original_interface_decl, "at origin"))
       return; // found it, no need to look any further
-  } while (0);
+  } while (false);
 
   StreamString ss;
 
@@ -1278,7 +1280,7 @@ void ClangASTSource::FindObjCMethodDecls
       if (*cursor == ' ' || *cursor == '(')
         sc_list.Append(candidate_sc);
     }
-  } while (0);
+  } while (false);
 
   if (sc_list.GetSize()) {
     // We found a good function symbol.  Use that.
@@ -1361,7 +1363,7 @@ void ClangASTSource::FindObjCMethodDecls
                                   "in debug info");
 
     return;
-  } while (0);
+  } while (false);
 
   do {
     // Check the modules only if the debug information didn't have a complete
@@ -1388,7 +1390,7 @@ void ClangASTSource::FindObjCMethodDecls
               current_id, context, interface_decl_from_modules, "in modules"))
         return;
     }
-  } while (0);
+  } while (false);
 
   do {
     // Check the runtime only if the debug information didn't have a complete
@@ -1425,7 +1427,7 @@ void ClangASTSource::FindObjCMethodDecls
 
     FindObjCMethodDeclsWithOrigin(current_id, context, runtime_interface_decl,
                                   "in runtime");
-  } while (0);
+  } while (false);
 }
 
 static bool FindObjCPropertyAndIvarDeclsWithOrigin(
@@ -1544,7 +1546,7 @@ void ClangASTSource::FindObjCPropertyAnd
                                            complete_iface_decl);
 
     return;
-  } while (0);
+  } while (false);
 
   do {
     // Check the modules only if the debug information didn't have a complete
@@ -1580,7 +1582,7 @@ void ClangASTSource::FindObjCPropertyAnd
     if (FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *this,
                                                interface_decl_from_modules))
       return;
-  } while (0);
+  } while (false);
 
   do {
     // Check the runtime only if the debug information didn't have a complete
@@ -1625,7 +1627,7 @@ void ClangASTSource::FindObjCPropertyAnd
     if (FindObjCPropertyAndIvarDeclsWithOrigin(
             current_id, context, *this, interface_decl_from_runtime))
       return;
-  } while (0);
+  } while (false);
 }
 
 typedef llvm::DenseMap<const FieldDecl *, uint64_t> FieldOffsetMap;

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp Thu May 23 17:44:33 2019
@@ -927,7 +927,7 @@ void ClangExpressionDeclMap::FindExterna
                     name.GetCString());
 
       context.AddNamedDecl(parser_named_decl);
-    } while (0);
+    } while (false);
   }
 
   if (name.GetCString()[0] == '$' && !namespace_decl) {
@@ -1562,7 +1562,7 @@ void ClangExpressionDeclMap::FindExterna
             context.m_found.variable = true;
           }
         }
-      } while (0);
+      } while (false);
     }
 
     if (target && !context.m_found.variable && !namespace_decl) {

Modified: lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp Thu May 23 17:44:33 2019
@@ -657,10 +657,10 @@ bool EmulateInstructionARM64::EmulateADD
 
   if (sub_op) {
     operand2 = NOT(operand2);
-    carry_in = 1;
+    carry_in = true;
     imm = -imm; // For the Register plug offset context below
   } else {
-    carry_in = 0;
+    carry_in = false;
   }
 
   ProcState proc_state;

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp Thu May 23 17:44:33 2019
@@ -334,9 +334,9 @@ bool ClassDescriptorV2::Describe(
   std::unique_ptr<class_rw_t> class_rw;
 
   if (!Read_objc_class(process, objc_class))
-    return 0;
+    return false;
   if (!Read_class_row(process, *objc_class, class_ro, class_rw))
-    return 0;
+    return false;
 
   static ConstString NSObject_name("NSObject");
 

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp Thu May 23 17:44:33 2019
@@ -62,7 +62,7 @@ public:
           non_const_interface_decl->lookup(name);
 
       return (result.size() != 0);
-    } while (0);
+    } while (false);
 
     SetNoExternalVisibleDeclsForName(decl_ctx, name);
     return false;
@@ -208,7 +208,7 @@ public:
 
     uint32_t stepsLeft = 256;
 
-    while (1) {
+    while (true) {
       if (--stepsLeft == 0) {
         m_is_valid = false;
         return;
@@ -647,7 +647,7 @@ AppleObjCDeclVendor::FindDecls(ConstStri
     decls.push_back(iface_decl);
     ret++;
     break;
-  } while (0);
+  } while (false);
 
   return ret;
 }

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu May 23 17:44:33 2019
@@ -5038,7 +5038,7 @@ ObjectFileMachO::GetArchitecture(const l
               triple.setEnvironmentName(os_env.environment);
             return arch;
           }
-        } while (0);
+        } while (false);
         offset = cmd_offset + load_cmd.cmdsize;
       }
 

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Thu May 23 17:44:33 2019
@@ -87,7 +87,7 @@ bool CommunicationKDP::SendRequestAndGet
   for (uint32_t i = 0; i < num_retries; ++i) {
     if (SendRequestPacketNoLock(request_packet)) {
       const uint8_t request_sequence_id = (uint8_t)request_packet.GetData()[1];
-      while (1) {
+      while (true) {
         if (WaitForPacketWithTimeoutMicroSecondsNoLock(
                 reply_packet,
                 std::chrono::microseconds(GetPacketTimeout()).count())) {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Thu May 23 17:44:33 2019
@@ -2664,7 +2664,7 @@ bool DWARFASTParserClang::ParseChildMemb
     DelayedPropertyList &delayed_properties, AccessType &default_accessibility,
     bool &is_a_class, ClangASTImporter::LayoutInfo &layout_info) {
   if (!parent_die)
-    return 0;
+    return false;
 
   // Get the parent byte size so we can verify any members will fit
   const uint64_t parent_byte_size =
@@ -2679,7 +2679,7 @@ bool DWARFASTParserClang::ParseChildMemb
   ClangASTContext *ast =
       llvm::dyn_cast_or_null<ClangASTContext>(class_clang_type.GetTypeSystem());
   if (ast == nullptr)
-    return 0;
+    return false;
 
   for (DWARFDIE die = parent_die.GetFirstChild(); die.IsValid();
        die = die.GetSibling()) {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu May 23 17:44:33 2019
@@ -2104,7 +2104,7 @@ bool SymbolFileDWARF::ResolveFunction(co
   if (die.Tag() == DW_TAG_inlined_subroutine) {
     inlined_die = die;
 
-    while (1) {
+    while (true) {
       die = die.GetParent();
 
       if (die) {

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu May 23 17:44:33 2019
@@ -2457,7 +2457,7 @@ bool ClangASTContext::DeclsAreEquivalent
       clang::DeclContext *lhs_decl_ctx = lhs_decl->getDeclContext();
       clang::DeclContext *rhs_decl_ctx = rhs_decl->getDeclContext();
       if (lhs_decl_ctx && rhs_decl_ctx) {
-        while (1) {
+        while (true) {
           if (lhs_decl_ctx && rhs_decl_ctx) {
             const clang::Decl::Kind lhs_decl_ctx_kind =
                 lhs_decl_ctx->getDeclKind();
@@ -2495,7 +2495,7 @@ bool ClangASTContext::DeclsAreEquivalent
         // make sure the names match as well
         lhs_decl_ctx = lhs_decl->getDeclContext();
         rhs_decl_ctx = rhs_decl->getDeclContext();
-        while (1) {
+        while (true) {
           switch (lhs_decl_ctx->getDeclKind()) {
           case clang::Decl::TranslationUnit:
             // We don't care about the translation unit names
@@ -9629,7 +9629,7 @@ bool ClangASTContext::DumpTypeValue(
       break;
     }
   }
-  return 0;
+  return false;
 }
 
 void ClangASTContext::DumpSummary(lldb::opaque_compiler_type_t type,

Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Thu May 23 17:44:33 2019
@@ -1018,7 +1018,7 @@ void ClangASTImporter::ASTImporterDelega
 
       to_objc_interface->setSuperClass(m_source_ctx->getTrivialTypeSourceInfo(
           m_source_ctx->getObjCInterfaceType(imported_from_superclass)));
-    } while (0);
+    } while (false);
   }
 }
 

Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Thu May 23 17:44:33 2019
@@ -144,7 +144,7 @@ bool CompilerType::IsBlockPointerType(
     CompilerType *function_pointer_type_ptr) const {
   if (IsValid())
     return m_type_system->IsBlockPointerType(m_type, function_pointer_type_ptr);
-  return 0;
+  return false;
 }
 
 bool CompilerType::IsIntegerType(bool &is_signed) const {

Modified: lldb/trunk/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Thu May 23 17:44:33 2019
@@ -546,7 +546,7 @@ uint32_t Function::GetPrologueByteSize()
 
         // Now calculate the offset to pass the subsequent line 0 entries.
         uint32_t first_non_zero_line = prologue_end_line_idx;
-        while (1) {
+        while (true) {
           LineEntry line_entry;
           if (line_table->GetLineEntryAtIndex(first_non_zero_line,
                                               line_entry)) {

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Thu May 23 17:44:33 2019
@@ -729,7 +729,7 @@ bool SymbolContext::GetAddressRangeFromH
 
   uint32_t line_index = 0;
   bool found = false;
-  while (1) {
+  while (true) {
     LineEntry this_line;
     line_index = comp_unit->FindLineEntry(line_index, line_entry.line, nullptr,
                                           false, &this_line);

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu May 23 17:44:33 2019
@@ -5350,7 +5350,7 @@ Process::RunThreadPlan(ExecutionContext
 
             event_explanation = ts.GetData();
           }
-        } while (0);
+        } while (false);
 
         if (event_explanation)
           log->Printf("Process::RunThreadPlan(): execution interrupted: %s %s",

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Thu May 23 17:44:33 2019
@@ -1856,7 +1856,7 @@ size_t Target::ReadCStringFromMemory(con
   out_str.clear();
   addr_t curr_addr = addr.GetLoadAddress(this);
   Address address(addr);
-  while (1) {
+  while (true) {
     size_t length = ReadCStringFromMemory(address, buf, sizeof(buf), error);
     if (length == 0)
       break;

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Thu May 23 17:44:33 2019
@@ -853,7 +853,7 @@ bool Thread::ShouldStop(Event *event_ptr
       // Otherwise, don't let the base plan override what the other plans say
       // to do, since presumably if there were other plans they would know what
       // to do...
-      while (1) {
+      while (true) {
         if (PlanIsBasePlan(current_plan))
           break;
 
@@ -978,7 +978,7 @@ Vote Thread::ShouldReportStop(Event *eve
   } else {
     Vote thread_vote = eVoteNoOpinion;
     ThreadPlan *plan_ptr = GetCurrentPlan();
-    while (1) {
+    while (true) {
       if (plan_ptr->PlanExplainsStop(event_ptr)) {
         thread_vote = plan_ptr->ShouldReportStop(event_ptr);
         break;
@@ -1298,7 +1298,7 @@ void Thread::DiscardThreadPlans(bool for
     return;
   }
 
-  while (1) {
+  while (true) {
     int master_plan_idx;
     bool discard = true;
 
@@ -1677,7 +1677,7 @@ Status Thread::ReturnFromFrame(lldb::Sta
     // FIXME: ValueObject::Cast doesn't currently work correctly, at least not
     // for scalars.
     // Turn that back on when that works.
-    if (/* DISABLES CODE */ (0) && sc.function != nullptr) {
+    if (/* DISABLES CODE */ (false) && sc.function != nullptr) {
       Type *function_type = sc.function->GetType();
       if (function_type) {
         CompilerType return_type =

Modified: lldb/trunk/source/Utility/JSON.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/JSON.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Utility/JSON.cpp (original)
+++ lldb/trunk/source/Utility/JSON.cpp Thu May 23 17:44:33 2019
@@ -238,7 +238,7 @@ JSONParser::Token JSONParser::GetToken(s
     break;
 
   case '"': {
-    while (1) {
+    while (true) {
       bool was_escaped = false;
       int escaped_ch = GetEscapedChar(was_escaped);
       if (escaped_ch == -1) {
@@ -453,7 +453,7 @@ JSONValue::SP JSONParser::ParseJSONObjec
 
   std::string value;
   std::string key;
-  while (1) {
+  while (true) {
     JSONParser::Token token = GetToken(value);
 
     if (token == JSONParser::Token::String) {
@@ -484,7 +484,7 @@ JSONValue::SP JSONParser::ParseJSONArray
 
   std::string value;
   std::string key;
-  while (1) {
+  while (true) {
     JSONValue::SP value_sp = ParseJSONValue();
     if (value_sp)
       array_up->AppendObject(value_sp);

Modified: lldb/trunk/source/Utility/SelectHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/SelectHelper.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Utility/SelectHelper.cpp (original)
+++ lldb/trunk/source/Utility/SelectHelper.cpp Thu May 23 17:44:33 2019
@@ -192,7 +192,7 @@ lldb_private::Status SelectHelper::Selec
   struct timeval *tv_ptr = nullptr;
   struct timeval tv = {0, 0};
 
-  while (1) {
+  while (true) {
     using namespace std::chrono;
     // Setup out relative timeout based on the end time if we have one
     if (m_end_time.hasValue()) {

Modified: lldb/trunk/source/Utility/StructuredData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StructuredData.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/source/Utility/StructuredData.cpp (original)
+++ lldb/trunk/source/Utility/StructuredData.cpp Thu May 23 17:44:33 2019
@@ -51,7 +51,7 @@ static StructuredData::ObjectSP ParseJSO
 
   std::string value;
   std::string key;
-  while (1) {
+  while (true) {
     JSONParser::Token token = json_parser.GetToken(value);
 
     if (token == JSONParser::Token::String) {
@@ -82,7 +82,7 @@ static StructuredData::ObjectSP ParseJSO
 
   std::string value;
   std::string key;
-  while (1) {
+  while (true) {
     StructuredData::ObjectSP value_sp = ParseJSONValue(json_parser);
     if (value_sp)
       array_up->AddItem(value_sp);

Modified: lldb/trunk/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNB.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNB.cpp Thu May 23 17:44:33 2019
@@ -141,7 +141,7 @@ void *kqueue_thread(void *arg) {
 #endif
 
   struct kevent death_event;
-  while (1) {
+  while (true) {
     int n_events = kevent(kq_id, NULL, 0, &death_event, 1, NULL);
     if (n_events == -1) {
       if (errno == EINTR)
@@ -267,7 +267,7 @@ static void *waitpid_thread(void *arg) {
 #endif
 #endif
 
-  while (1) {
+  while (true) {
     pid_t child_pid = waitpid(pid, &status, 0);
     DNBLogThreadedIf(LOG_PROCESS, "waitpid_thread (): waitpid (pid = %i, "
                                   "&status, 0) => %i, status = %i, errno = %i",

Modified: lldb/trunk/tools/debugserver/source/JSON.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/JSON.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/JSON.cpp (original)
+++ lldb/trunk/tools/debugserver/source/JSON.cpp Thu May 23 17:44:33 2019
@@ -271,7 +271,7 @@ JSONParser::Token JSONParser::GetToken(s
     break;
 
   case '"': {
-    while (1) {
+    while (true) {
       bool was_escaped = false;
       int escaped_ch = GetEscapedChar(was_escaped);
       if (escaped_ch == -1) {
@@ -483,7 +483,7 @@ JSONValue::SP JSONParser::ParseJSONObjec
 
   std::string value;
   std::string key;
-  while (1) {
+  while (true) {
     JSONParser::Token token = GetToken(value);
 
     if (token == JSONParser::Token::String) {
@@ -515,7 +515,7 @@ JSONValue::SP JSONParser::ParseJSONArray
 
   std::string value;
   std::string key;
-  while (1) {
+  while (true) {
     JSONValue::SP value_sp = ParseJSONValue();
     if (value_sp)
       array_up->AppendObject(value_sp);

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Thu May 23 17:44:33 2019
@@ -214,7 +214,7 @@ bool MachThreadList::RestoreRegisterStat
   MachThreadSP thread_sp(GetThreadByID(tid));
   if (thread_sp)
     return thread_sp->RestoreRegisterState(save_id);
-  return 0;
+  return false;
 }
 
 nub_size_t MachThreadList::NumThreads() const {

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Thu May 23 17:44:33 2019
@@ -4263,7 +4263,7 @@ rnb_err_t RNBRemote::HandlePacket_SetEna
   }
 
   if (interval_usec == 0) {
-    enable = 0;
+    enable = false;
   }
 
   DNBProcessSetEnableAsyncProfiling(pid, enable, interval_usec, scan_type);
@@ -5174,7 +5174,7 @@ bool get_array_of_ints_value_for_key_nam
         while (*c != '\0' &&
                (*c == ' ' || *c == '\t' || *c == '\n' || *c == '\r'))
           c++;
-        while (1) {
+        while (true) {
           if (!isdigit(*c)) {
             return true;
           }
@@ -6109,7 +6109,7 @@ rnb_err_t RNBRemote::HandlePacket_qProce
           cstr = data.GetCStr(&offset);
           if (cstr) {
             // Skip NULLs
-            while (1) {
+            while (true) {
               const char *p = data.PeekCStr(offset);
               if ((p == NULL) || (*p != '\0'))
                 break;

Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/debugserver.cpp (original)
+++ lldb/trunk/tools/debugserver/source/debugserver.cpp Thu May 23 17:44:33 2019
@@ -96,7 +96,7 @@ RNBRunLoopMode RNBRunLoopGetStartModeFro
                           RNBContext::event_read_thread_exiting;
 
     // Spin waiting to get the A packet.
-    while (1) {
+    while (true) {
       DNBLogThreadedIf(LOG_RNB_MAX,
                        "%s ctx.Events().WaitForSetEvents( 0x%08x ) ...",
                        __FUNCTION__, event_mask);

Modified: lldb/trunk/tools/debugserver/source/libdebugserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/libdebugserver.cpp?rev=361580&r1=361579&r2=361580&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/libdebugserver.cpp (original)
+++ lldb/trunk/tools/debugserver/source/libdebugserver.cpp Thu May 23 17:44:33 2019
@@ -69,7 +69,7 @@ RNBRunLoopMode RNBRunLoopGetStartModeFro
     uint32_t event_mask = RNBContext::event_read_packet_available;
 
     // Spin waiting to get the A packet.
-    while (1) {
+    while (true) {
       DNBLogThreadedIf(LOG_RNB_MAX,
                        "%s ctx.Events().WaitForSetEvents( 0x%08x ) ...",
                        __FUNCTION__, event_mask);




More information about the lldb-commits mailing list