[llvm] r300267 - [Support] Fix ErrorOr assertion when /proc/cpuinfo doesn't exist.

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 16:16:37 PDT 2017


Hi Tom,

I'd like to propose that we merge this fix into 4.0.1 (for PR33008). Would
it be ok for me to merge it onto the branch?

Thanks,
Teresa

On Thu, Apr 13, 2017 at 2:51 PM, Teresa Johnson via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: tejohnson
> Date: Thu Apr 13 16:51:49 2017
> New Revision: 300267
>
> URL: http://llvm.org/viewvc/llvm-project?rev=300267&view=rev
> Log:
> [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
>
> Modified:
>     llvm/trunk/lib/Support/Host.cpp
>
> Modified: llvm/trunk/lib/Support/Host.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/H
> ost.cpp?rev=300267&r1=300266&r2=300267&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Support/Host.cpp (original)
> +++ llvm/trunk/lib/Support/Host.cpp Thu Apr 13 16:51:49 2017
> @@ -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,
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>



-- 
Teresa Johnson |  Software Engineer |  tejohnson at google.com |  408-460-2413
<(408)%20460-2413>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170511/7dfaa3a7/attachment.html>


More information about the llvm-commits mailing list