[PATCH] D32032: [Support] ErrorOr assertion when /proc/cpuinfo doesn't exist.

Jacob Young via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 10:35:03 PDT 2017


jacobly created this revision.

The ErrorOr should not be dereferenced on the error path.


https://reviews.llvm.org/D32032

Files:
  lib/Support/Host.cpp


Index: lib/Support/Host.cpp
===================================================================
--- lib/Support/Host.cpp
+++ lib/Support/Host.cpp
@@ -1245,6 +1245,7 @@
   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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32032.95158.patch
Type: text/x-patch
Size: 429 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170413/465945a1/attachment.bin>


More information about the llvm-commits mailing list