jingham added inline comments.

================
Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp:439
   if (uid != UINT32_MAX) {
-    std::string name;
-    if (HostInfo::LookupUserName(uid, name)) {
+    if (auto name = HostInfo::GetUserIDResolver().GetUserName(uid)) {
       StreamString response;
----------------
labath wrote:
> jingham wrote:
> > Do we need auto here?  Since we have a bunch of API's returning StringRef's 
> > now when I see strings returned I get paranoid about their lifespan.  auto 
> > hides the fact that I don't need to worry...
> I've removed the auto, though I am not sure if that alleviates your fears, as 
> the returned type is StringRef. There is still nothing to worry about though, 
> as the backing storage is held by the resolver object.
So how do I reason about the lifespan of this StringRef, then?  Now I have to 
know that GetUserIDResolver doesn't make a temporary UserIDResolver, but a 
reference to one that persists - for how long again?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58167/new/

https://reviews.llvm.org/D58167



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

Reply via email to