Fix compilation issues on clang (#5683)

ErrorOr has a implicit constructor. A move is required for construct an
ErrorOr object. Then it's returned by the function. Write the
construction explicit to fix the compilation on clang, and reduce the
confusion.
This commit is contained in:
Minmin Gong 2023-09-19 08:45:55 -07:00 коммит произвёл GitHub
Родитель 37ed613864
Коммит c22d103059
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -372,8 +372,10 @@ getOpenFileImpl(int FD, const Twine &Filename, uint64_t FileSize,
std::unique_ptr<MemoryBuffer> Result(
new (NamedBufferAlloc(Filename))
MemoryBufferMMapFile(RequiresNullTerminator, FD, MapSize, Offset, EC));
if (!EC)
return Result; // HLSL Change - Fix redundant move warning.
if (!EC) {
return ErrorOr(
std::move(Result)); // HLSL Change - Fix redundant move warning.
}
}
std::unique_ptr<MemoryBuffer> Buf =
@ -413,7 +415,7 @@ getOpenFileImpl(int FD, const Twine &Filename, uint64_t FileSize,
BufPtr += NumRead;
}
return Buf; // HLSL Change - Fix redundant move warning.
return ErrorOr(std::move(Buf)); // HLSL Change - Fix redundant move warning.
}
ErrorOr<std::unique_ptr<MemoryBuffer>>