forked from OSchip/llvm-project
[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:
parent
78fe17131b
commit
9709e2b76d
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue