Re: [Lldb-commits] [lldb] r282112 - Fix integer sign warning from r282105

2016-09-21 Thread Adrian McCarthy via lldb-commits
Thanks for fixing it.

On Wed, Sep 21, 2016 at 4:20 PM, Ed Maste  wrote:

> On 21 September 2016 at 21:38, Adrian McCarthy 
> wrote:
> > That fix doesn't look complete:
>
> Thanks, I've applied your fix in r282119, and sorry for being hasty
> with the original change.
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r282112 - Fix integer sign warning from r282105

2016-09-21 Thread Ed Maste via lldb-commits
On 21 September 2016 at 21:38, Adrian McCarthy  wrote:
> That fix doesn't look complete:

Thanks, I've applied your fix in r282119, and sorry for being hasty
with the original change.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r282112 - Fix integer sign warning from r282105

2016-09-21 Thread Adrian McCarthy via lldb-commits
That fix doesn't look complete:

 for (size_t i = 0; i < column - 1 && i < src_line.length(); ++i)

`column` is an unsigned integral type, so doing subtraction from it can
lead to surprising results.  It's probably best to write it as:

  for (size_t i = 0; i  + 1 < column && i < src_line.length(); ++i)

That will more gracefully handle the case where column is 0.

Adrian.

On Wed, Sep 21, 2016 at 2:14 PM, Ed Maste via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: emaste
> Date: Wed Sep 21 16:14:31 2016
> New Revision: 282112
>
> URL: http://llvm.org/viewvc/llvm-project?rev=282112&view=rev
> Log:
> Fix integer sign warning from r282105
>
> Modified:
> lldb/trunk/source/Core/SourceManager.cpp
>
> Modified: lldb/trunk/source/Core/SourceManager.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/
> Core/SourceManager.cpp?rev=282112&r1=282111&r2=282112&view=diff
> 
> ==
> --- lldb/trunk/source/Core/SourceManager.cpp (original)
> +++ lldb/trunk/source/Core/SourceManager.cpp Wed Sep 21 16:14:31 2016
> @@ -172,7 +172,7 @@ size_t SourceManager::DisplaySourceLines
>  m_last_file_sp->GetLine(line, src_line);
>  return_value += s->Printf("\t");
>  // Insert a space for every non-tab character in the source line.
> -for (int i = 0; i < column - 1 && i < src_line.length(); ++i)
> +for (size_t i = 0; i < column - 1 && i < src_line.length(); ++i)
>return_value += s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
>  // Now add the caret.
>  return_value += s->Printf("^\n");
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r282112 - Fix integer sign warning from r282105

2016-09-21 Thread Ed Maste via lldb-commits
Author: emaste
Date: Wed Sep 21 16:14:31 2016
New Revision: 282112

URL: http://llvm.org/viewvc/llvm-project?rev=282112&view=rev
Log:
Fix integer sign warning from r282105

Modified:
lldb/trunk/source/Core/SourceManager.cpp

Modified: lldb/trunk/source/Core/SourceManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SourceManager.cpp?rev=282112&r1=282111&r2=282112&view=diff
==
--- lldb/trunk/source/Core/SourceManager.cpp (original)
+++ lldb/trunk/source/Core/SourceManager.cpp Wed Sep 21 16:14:31 2016
@@ -172,7 +172,7 @@ size_t SourceManager::DisplaySourceLines
 m_last_file_sp->GetLine(line, src_line);
 return_value += s->Printf("\t");
 // Insert a space for every non-tab character in the source line.
-for (int i = 0; i < column - 1 && i < src_line.length(); ++i)
+for (size_t i = 0; i < column - 1 && i < src_line.length(); ++i)
   return_value += s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
 // Now add the caret.
 return_value += s->Printf("^\n");


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits