<div dir="ltr">To be honest I would like to ban the use of raw cstring functions.  LLVM has a wealth of classes to help with formatting strings, that I imagine will cover 99% or more of use cases.  LLDB doesn't use them enough. I consider these bugs in LLDB that should be fixed.  In cases where we really do need a function for it, I think we should add it to LLVM, not to LLDB.  A quick summary of replacements is:<div><br></div><div>char stack_buffer[n];   // Use llvm::SmallString<n></div><div>const char* foo;          // Use llvm::StringRef foo;</div><div>strcpy, strncpy, etc     // Use member functions of SmallString / StringRef</div><div>void foo(char *, int len);   // Use void foo(llvm::SmallVectorImpl<char> &buf);</div><div>void foo(const char * foo);     // Use void foo(llvm::StringRef foo);</div><div>sprintf, snprintf, etc       // Use llvm::raw_ostream<br><br><div class="gmail_quote">On Wed Feb 11 2015 at 9:20:21 AM Vince Harron <<a href="mailto:vharron@google.com">vharron@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Maybe Utility folder is better if all platforms have a conformant strncpy</p>
<div class="gmail_quote">On Feb 11, 2015 9:19 AM, "Vince Harron" <<a href="mailto:vharron@google.com" target="_blank">vharron@google.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">This might be overkill, but since we've seen this in more than one place, it might make sense to add a Host function StrncpyTeminated that does this.</p>
<div class="gmail_quote">On Feb 11, 2015 7:28 AM, "Zachary Turner" <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Please wait to commit this until I've had a chance to review <br><div class="gmail_quote">On Wed, Feb 11, 2015 at 4:05 AM Ilia K <<a href="mailto:ki.stfu@gmail.com" target="_blank">ki.stfu@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">@abidh,<br>
<br>
Take a look again please.<br>
<br>
<br>
<a href="http://reviews.llvm.org/D7553" target="_blank">http://reviews.llvm.org/D7553</a><br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/<u></u>settings/panel/<u></u>emailpreferences/</a><br>
<br>
<br>
</blockquote></div>
<br>_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
<br></blockquote></div>
</blockquote></div>
</blockquote></div></div></div>