[lldb-dev] LLDB Evolution - Final Form

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Wed Sep 21 14:20:45 PDT 2016


> On Sep 21, 2016, at 1:55 PM, Zachary Turner <zturner at google.com> wrote:
> 
> :-/  The same thing happens if you write Foo &f = *nullptr;   It's a reference.

I might be a good idea to add an overloaded constructor for nullptr and void * and delete them so that we can't implicitly create a StringRef from nullptr or NULL and cause as crash as it wouldn't compile in the first place.

> 
> Did you try StringRef::withNullAsEmpty()?

I am still catching code conversion issues with things like:

if (name == nullptr)

For normal string ref construction we can cut over to using withNullAsEmpty.

> 
> BTW what code are you converting?  I'm working on some of the options code as we speak.

Its the cut over to using the DWARF parser in LLVM. There are many functions that were missing and I have added them and other things we had in our DWARF parser. Any DWARF attribute that is a "const char *" will now be returned as a llvm::StringRef. That has wide implications in all of the existing DWARF parsing code that was using "const char *" for things like names and mangled names and also the ClangASTContext functions, like say to create a RecordDecl, it now takes an llvm::StringRef as an argument.



More information about the lldb-dev mailing list