mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-09 22:24:37 +00:00
Update the MemoryBuffer API to use ErrorOr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212405 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -450,13 +450,14 @@ void SampleModuleProfile::dump() {
|
||||
///
|
||||
/// \returns true if the file was loaded successfully, false otherwise.
|
||||
bool SampleModuleProfile::loadText() {
|
||||
std::unique_ptr<MemoryBuffer> Buffer;
|
||||
std::error_code EC = MemoryBuffer::getFile(Filename, Buffer);
|
||||
if (EC) {
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
|
||||
MemoryBuffer::getFile(Filename);
|
||||
if (std::error_code EC = BufferOrErr.getError()) {
|
||||
std::string Msg(EC.message());
|
||||
M.getContext().diagnose(DiagnosticInfoSampleProfile(Filename.data(), Msg));
|
||||
return false;
|
||||
}
|
||||
std::unique_ptr<MemoryBuffer> Buffer = std::move(BufferOrErr.get());
|
||||
line_iterator LineIt(*Buffer, '#');
|
||||
|
||||
// Read the profile of each function. Since each function may be
|
||||
|
Reference in New Issue
Block a user