diff options
| author | Teresa Johnson <tejohnson@google.com> | 2017-04-13 21:51:49 +0000 |
|---|---|---|
| committer | Teresa Johnson <tejohnson@google.com> | 2017-04-13 21:51:49 +0000 |
| commit | 9709e2b76d621f9ce2074ba07c453ce438ea8922 (patch) | |
| tree | 6a6ad6ebb45d5ae64f60178ebe9236c59060aadc /llvm | |
| parent | 78fe17131b7c926c7d347c5bbcb3bc7ca48a0b44 (diff) | |
| download | bcm5719-llvm-9709e2b76d621f9ce2074ba07c453ce438ea8922.tar.gz bcm5719-llvm-9709e2b76d621f9ce2074ba07c453ce438ea8922.zip | |
[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
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Support/Host.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp index ec51314fcbe..970ecfd7df9 100644 --- a/llvm/lib/Support/Host.cpp +++ b/llvm/lib/Support/Host.cpp @@ -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, |

