]> granicus.if.org Git - llvm/commitdiff
Merging r300267: release_40 origin/release_40
authorTom Stellard <tstellar@redhat.com>
Tue, 13 Jun 2017 01:46:44 +0000 (01:46 +0000)
committerTom Stellard <tstellar@redhat.com>
Tue, 13 Jun 2017 01:46:44 +0000 (01:46 +0000)
------------------------------------------------------------------------
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
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_40@305264 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Host.cpp

index d1b40412a6fc64e73559b509698e48c0e965d671..af19dc4ab11699bc9a1973b1f06b8f1a1789df0c 100644 (file)
@@ -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,