[Support] Fix ErrorOr assertion when /proc/cpuinfo doesn't exist.

The ErrorOr should not be dereferenced on the error path.

Patch by Jacob Young

Reviewers: tejohnson

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D32032

llvm-svn: 300267
This commit is contained in:
Teresa Johnson 2017-04-13 21:51:49 +00:00
parent 78fe17131b
commit 9709e2b76d
1 changed files with 1 additions and 0 deletions

View File

@ -1245,6 +1245,7 @@ static int computeHostNumPhysicalCores() {
if (std::error_code EC = Text.getError()) {
llvm::errs() << "Can't read "
<< "/proc/cpuinfo: " << EC.message() << "\n";
return -1;
}
SmallVector<StringRef, 8> strs;
(*Text)->getBuffer().split(strs, "\n", /*MaxSplit=*/-1,