[Lldb-commits] [PATCH] Fix FileSpec::GetPath to return null-terminated strings
zturner at google.com
Wed Feb 11 10:06:50 PST 2015
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:
char stack_buffer[n]; // Use llvm::SmallString<n>
const char* foo; // Use llvm::StringRef foo;
strcpy, strncpy, etc // Use member functions of SmallString / StringRef
void foo(char *, int len); // Use void foo(llvm::SmallVectorImpl<char>
void foo(const char * foo); // Use void foo(llvm::StringRef foo);
sprintf, snprintf, etc // Use llvm::raw_ostream
On Wed Feb 11 2015 at 9:20:21 AM Vince Harron <vharron at google.com> wrote:
> Maybe Utility folder is better if all platforms have a conformant strncpy
> On Feb 11, 2015 9:19 AM, "Vince Harron" <vharron at google.com> wrote:
>> 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.
>> On Feb 11, 2015 7:28 AM, "Zachary Turner" <zturner at google.com> wrote:
>>> Please wait to commit this until I've had a chance to review
>>> On Wed, Feb 11, 2015 at 4:05 AM Ilia K <ki.stfu at gmail.com> wrote:
>>>> Take a look again please.
>>>> EMAIL PREFERENCES
>>> lldb-commits mailing list
>>> lldb-commits at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-commits