summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <tstellar@redhat.com>2017-06-13 01:46:44 +0000
committerTom Stellard <tstellar@redhat.com>2017-06-13 01:46:44 +0000
commit449c3ef93afc7a668eb35e67a83717453e28b25a (patch)
tree6105fab32c2e72495dbebe9f186b25884a772937
parentfcf5f77b3ec107aec5a49690a01dc2098dac8d2e (diff)
downloadllvm-release/4.x.tar.gz
------------------------------------------------------------------------ r300267 | tejohnson | 2017-04-13 17:51:49 -0400 (Thu, 13 Apr 2017) | 11 lines [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: 305264
-rw-r--r--llvm/lib/Support/Host.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index d1b40412a6fc..af19dc4ab116 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -1232,6 +1232,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,