[Lldb-commits] [PATCH] D50071: Use rich mangling information in Symtab::InitNameIndexes()
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 3 03:21:02 PDT 2018
labath added inline comments.
Comment at: include/lldb/Core/RichManglingInfo.h:36
+ /// "a::b".
+ llvm::StringRef GetFunctionDeclContextName() const;
> I realized that returning `llvm::StringRef` from here may not be the best idea. To the outside it appears to be an immutable string, but internally it will be reused and even realloc'ed. I guess returning a `ConstString` is not acceptable as an alternative performance-wise, as it adds one `memcpy` per query. I will sketch something here, but it's not easy as it needs to fit both, the IPD and C++ MethodName.
That is a bit unfortunate, but I don't think things would be any better if you left this as `const char *`. AFAICT, the caller converts this to a ConstString anyway, so returning that type might not be such a bad choice, but I would be fine with just documenting that the returned string is valid until the next `GetXXX` call.
Comment at: source/Core/RichManglingInfo.cpp:93
+ case PluginCxxLanguage:
+ return get<CPlusPlusLanguage::MethodName>()->GetContext().data();
These `.data()` calls can now be removed.
Comment at: source/Symbol/Symtab.cpp:397
+ // The base name will be our entry's name.
+ entry.cstring = ConstString(base_name.data());
More information about the lldb-commits