summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/SpecialCaseList.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SpecialCaseList.cpp b/llvm/lib/Transforms/Utils/SpecialCaseList.cpp
index 45a2b618a71..3d76a17abd9 100644
--- a/llvm/lib/Transforms/Utils/SpecialCaseList.cpp
+++ b/llvm/lib/Transforms/Utils/SpecialCaseList.cpp
@@ -54,12 +54,13 @@ SpecialCaseList *SpecialCaseList::create(
const StringRef Path, std::string &Error) {
if (Path.empty())
return new SpecialCaseList();
- std::unique_ptr<MemoryBuffer> File;
- if (std::error_code EC = MemoryBuffer::getFile(Path, File)) {
+ ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
+ MemoryBuffer::getFile(Path);
+ if (std::error_code EC = FileOrErr.getError()) {
Error = (Twine("Can't open file '") + Path + "': " + EC.message()).str();
return nullptr;
}
- return create(File.get(), Error);
+ return create(FileOrErr.get().get(), Error);
}
SpecialCaseList *SpecialCaseList::create(
OpenPOWER on IntegriCloud