[lldb] Redesign Target::GetUtilityFunctionForLanguage API

Authored by JDevlieghere on Oct 23 2020, 9:26 AM.


[lldb] Redesign Target::GetUtilityFunctionForLanguage API

This patch redesigns the Target::GetUtilityFunctionForLanguage API:

  • Use a unique_ptr instead of a raw pointer for the return type.
  • Wrap the result in an llvm::Expected instead of using a Status object as an I/O parameter.
  • Combine the action of "getting" and "installing" the UtilityFunction as they always get called together.
  • Pass std::strings instead of const char* and std::move them where appropriate.

There's more room for improvement but I think this tackles the most
prevalent issues with the current API.

Differential revision: https://reviews.llvm.org/D90011