Let's not convert from UINT32_MAX to the std::numeric_limits version.
authorJim Ingham <jingham@apple.com>
Sat, 12 Mar 2016 03:33:36 +0000 (03:33 +0000)
committerJim Ingham <jingham@apple.com>
Sat, 12 Mar 2016 03:33:36 +0000 (03:33 +0000)
llvm-svn: 263333

lldb/source/Core/DataEncoder.cpp
lldb/source/Core/Disassembler.cpp
lldb/source/Core/FileSpecList.cpp
lldb/source/Core/SearchFilter.cpp

index cd85385..1595577 100644 (file)
@@ -233,7 +233,7 @@ DataEncoder::PutU8 (uint32_t offset, uint8_t value)
         m_start[offset] = value;
         return offset + 1;
     }
-    return std::numeric_limits<uint32_t>::max();
+    return UINT32_MAX;
 }
 
 uint32_t
@@ -248,7 +248,7 @@ DataEncoder::PutU16 (uint32_t offset, uint16_t value)
 
         return offset + sizeof (value);
     }
-    return std::numeric_limits<uint32_t>::max();
+    return UINT32_MAX;
 }
 
 uint32_t
@@ -263,7 +263,7 @@ DataEncoder::PutU32 (uint32_t offset, uint32_t value)
         
         return offset + sizeof (value);
     }
-    return std::numeric_limits<uint32_t>::max();
+    return UINT32_MAX;
 }
 
 uint32_t
@@ -278,7 +278,7 @@ DataEncoder::PutU64 (uint32_t offset, uint64_t value)
         
         return offset + sizeof (value);
     }
-    return std::numeric_limits<uint32_t>::max();
+    return UINT32_MAX;
 }
 
 //----------------------------------------------------------------------
@@ -304,7 +304,7 @@ DataEncoder::PutMaxU64 (uint32_t offset, uint32_t byte_size, uint64_t value)
         assert(!"GetMax64 unhandled case!");
         break;
     }
-    return std::numeric_limits<uint32_t>::max();
+    return UINT32_MAX;
 }
 
 uint32_t
@@ -318,7 +318,7 @@ DataEncoder::PutData (uint32_t offset, const void *src, uint32_t src_len)
         memcpy (m_start + offset, src, src_len);
         return offset + src_len;
     }
-    return std::numeric_limits<uint32_t>::max();
+    return UINT32_MAX;
 }
 
 uint32_t
@@ -332,5 +332,5 @@ DataEncoder::PutCString (uint32_t offset, const char *cstr)
 {
     if (cstr != nullptr)
         return PutData (offset, cstr, strlen(cstr) + 1);
-    return std::numeric_limits<uint32_t>::max();
+    return UINT32_MAX;
 }
index 7a51f7e..2d456f5 100644 (file)
@@ -1036,7 +1036,7 @@ InstructionList::GetIndexOfNextBranchInstruction(uint32_t start, Target &target)
 {
     size_t num_instructions = m_instructions.size();
     
-    uint32_t next_branch = std::numeric_limits<uint32_t>::max();
+    uint32_t next_branch = UINT32_MAX;
     size_t i;
     for (i = start; i < num_instructions; i++)
     {
@@ -1053,7 +1053,7 @@ InstructionList::GetIndexOfNextBranchInstruction(uint32_t start, Target &target)
     if (target.GetArchitecture().GetTriple().getArch() == llvm::Triple::hexagon)
     {
         // If we didn't find a branch, find the last packet start.
-        if (next_branch == std::numeric_limits<uint32_t>::max())
+        if (next_branch == UINT32_MAX)
         {
             i = num_instructions - 1;
         }
@@ -1086,7 +1086,7 @@ InstructionList::GetIndexOfNextBranchInstruction(uint32_t start, Target &target)
             }
         }
 
-        if (next_branch == std::numeric_limits<uint32_t>::max())
+        if (next_branch == UINT32_MAX)
         {
             // We couldn't find the previous packet, so return start
             next_branch = start;
@@ -1099,7 +1099,7 @@ uint32_t
 InstructionList::GetIndexOfInstructionAtAddress (const Address &address)
 {
     size_t num_instructions = m_instructions.size();
-    uint32_t index = std::numeric_limits<uint32_t>::max();
+    uint32_t index = UINT32_MAX;
     for (size_t i = 0; i < num_instructions; i++)
     {
         if (m_instructions[i]->GetAddress() == address)
@@ -1152,7 +1152,7 @@ Disassembler::ParseInstructions (const ExecutionContext *exe_ctx,
                                 m_arch.GetByteOrder(),
                                 m_arch.GetAddressByteSize());
             const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS;
-            return DecodeInstructions(range.GetBaseAddress(), data, 0, std::numeric_limits<uint32_t>::max(), false,
+            return DecodeInstructions(range.GetBaseAddress(), data, 0, UINT32_MAX, false,
                                       data_from_file);
         }
         else if (error_strm_ptr)
index 6887eeb..56e6455 100644 (file)
@@ -125,7 +125,7 @@ FileSpecList::FindFileIndex (size_t start_idx, const FileSpec &file_spec, bool f
     }
 
     // We didn't find the file, return an invalid index
-    return std::numeric_limits<uint32_t>::max();
+    return UINT32_MAX;
 }
 
 //------------------------------------------------------------------
index da6d7cc..9541a02 100644 (file)
@@ -266,7 +266,10 @@ SearchFilter::DoFunctionIteration (Function *function, const SymbolContext &cont
 bool
 SearchFilterForUnconstrainedSearches::ModulePasses (const FileSpec &module_spec)
 {
-    return (!m_target_sp->ModuleIsExcludedForUnconstrainedSearches(module_spec));
+    if (m_target_sp->ModuleIsExcludedForUnconstrainedSearches (module_spec))
+        return false;
+    else
+        return true;
 }
 
 bool
@@ -445,7 +448,7 @@ SearchFilterByModuleList::ModulePasses (const ModuleSP &module_sp)
         return true;
         
     if (module_sp &&
-        m_module_spec_list.FindFileIndex(0, module_sp->GetFileSpec(), false) != std::numeric_limits<uint32_t>::max())
+        m_module_spec_list.FindFileIndex(0, module_sp->GetFileSpec(), false) != UINT32_MAX)
         return true;
     else
         return false;
@@ -457,7 +460,7 @@ SearchFilterByModuleList::ModulePasses (const FileSpec &spec)
     if (m_module_spec_list.GetSize() == 0)
         return true;
         
-    if (m_module_spec_list.FindFileIndex(0, spec, true) != std::numeric_limits<uint32_t>::max())
+    if (m_module_spec_list.FindFileIndex(0, spec, true) != UINT32_MAX)
         return true;
     else
         return false;
@@ -506,7 +509,7 @@ SearchFilterByModuleList::Search (Searcher &searcher)
     for (size_t i = 0; i < num_modules; i++)
     {
         Module* module = target_modules.GetModulePointerAtIndexUnlocked(i);
-        if (m_module_spec_list.FindFileIndex(0, module->GetFileSpec(), false) != std::numeric_limits<uint32_t>::max())
+        if (m_module_spec_list.FindFileIndex(0, module->GetFileSpec(), false) != UINT32_MAX)
         {
             SymbolContext matchingContext(m_target_sp, module->shared_from_this());
             Searcher::CallbackReturn shouldContinue;
@@ -613,13 +616,13 @@ SearchFilterByModuleListAndCU::AddressPasses (Address &address)
 bool
 SearchFilterByModuleListAndCU::CompUnitPasses (FileSpec &fileSpec)
 {
-    return m_cu_spec_list.FindFileIndex(0, fileSpec, false) != std::numeric_limits<uint32_t>::max();
+    return m_cu_spec_list.FindFileIndex(0, fileSpec, false) != UINT32_MAX;
 }
 
 bool
 SearchFilterByModuleListAndCU::CompUnitPasses (CompileUnit &compUnit)
 {
-    bool in_cu_list = m_cu_spec_list.FindFileIndex(0, compUnit, false) != std::numeric_limits<uint32_t>::max();
+    bool in_cu_list = m_cu_spec_list.FindFileIndex(0, compUnit, false) != UINT32_MAX;
     if (in_cu_list)
     {
         ModuleSP module_sp(compUnit.GetModule());
@@ -662,7 +665,7 @@ SearchFilterByModuleListAndCU::Search (Searcher &searcher)
     {
         lldb::ModuleSP module_sp = target_images.GetModuleAtIndexUnlocked(i);
         if (no_modules_in_filter ||
-            m_module_spec_list.FindFileIndex(0, module_sp->GetFileSpec(), false) != std::numeric_limits<uint32_t>::max())
+            m_module_spec_list.FindFileIndex(0, module_sp->GetFileSpec(), false) != UINT32_MAX)
         {
             SymbolContext matchingContext(m_target_sp, module_sp);
             Searcher::CallbackReturn shouldContinue;
@@ -682,8 +685,7 @@ SearchFilterByModuleListAndCU::Search (Searcher &searcher)
                     matchingContext.comp_unit = cu_sp.get();
                     if (matchingContext.comp_unit)
                     {
-                        if (m_cu_spec_list.FindFileIndex(0, *matchingContext.comp_unit, false) !=
-                            std::numeric_limits<uint32_t>::max())
+                        if (m_cu_spec_list.FindFileIndex(0, *matchingContext.comp_unit, false) != UINT32_MAX)
                         {
                             shouldContinue = DoCUIteration(module_sp, matchingContext, searcher);
                             if (shouldContinue == Searcher::eCallbackReturnStop)