HomePhabricator

[DWARF] Refactor DWARF classes to use unified error reporting. NFC.

Authored by vleschuk on Aug 20 2018, 2:59 AM.

Description

[DWARF] Refactor DWARF classes to use unified error reporting. NFC.

DWARF-related classes in lib/DebugInfo/DWARF contained
duplicating code for creating StringError instances, like:

template <typename... Ts>
static Error createError(char const *Fmt, const Ts &... Vals) {

std::string Buffer;
raw_string_ostream Stream(Buffer);
Stream << format(Fmt, Vals...);
return make_error<StringError>(Stream.str(), inconvertibleErrorCode());

}

Similar function was placed in Support lib in https://reviews.llvm.org/D49824

This revision makes DWARF classes use this function
instead of their local implementation of it.

Reviewers: aprantl, dblaikie, probinson, wolfgangp, JDevlieghere, jhenderson

Reviewed By: JDevlieghere, jhenderson

Differential Revision: https://reviews.llvm.org/D49964

llvm-svn: 340163