Move an llvm::Error return value instead of copying it. (#2030)

Summary:
Fixes a small compilation error where an llvm::Error variable was being
returned by copy rather than by move. The llvm::Error copy constructor
is deleted.

Co-authored-by: ergawy <kareem.ergawy@guardsquare.com>
This commit is contained in:
Kareem Ergawy
2022-08-15 10:24:57 -07:00
committed by GitHub
co-authored by ergawy
parent f338f56502
commit d7957cc4e1
+2 -2
View File
@@ -36,7 +36,7 @@ auto SourceBuffer::CreateFromText(llvm::Twine text, llvm::StringRef filename)
std::string buffer = text.str();
auto size_check = CheckContentSize(buffer.size());
if (size_check) {
return size_check;
return std::move(size_check);
}
return SourceBuffer(filename.str(), std::move(buffer));
}
@@ -74,7 +74,7 @@ auto SourceBuffer::CreateFromFile(llvm::StringRef filename)
}
auto size_check = CheckContentSize(size);
if (size_check) {
return size_check;
return std::move(size_check);
}
errno = 0;