mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user