[PATCH] D63521: Teach the symbolizer lib symbolize objects directly.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 03:03:39 PDT 2019


MaskRay added inline comments.


================
Comment at: llvm/lib/DebugInfo/Symbolize/Symbolize.cpp:92
+  }
+
+  return symbolizeCodeCommon(Info, ModuleOffset);
----------------
grimar wrote:
> I'd simplify.
> 
> ```
>   const auto &I = Modules.find(ModuleName);
>   if (I != Modules.end())
>     return symbolizeCodeCommon(I->second.get(), ModuleOffset);
> 
>   Expected<SymbolizableModule *> InfoOrErr =
>                       createModuleInfo(&Obj, std::move(Context), ModuleName);
>   if (!InfoOrErr)
>     return InfoOrErr.takeError();
>   return symbolizeCodeCommon(InfoOrErr.get(), ModuleOffset);
> ```
> 
Let's avoid the lifetime extension:

`auto I = Modules.find(ModuleName);`

`const auto &I` is a const reference to a temporary iterator. It is odd.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63521





More information about the llvm-commits mailing list