[lld] r191069 - Generalize errStr() function so that it can handle any type of errors.

Shankar Easwaran shankare at codeaurora.org
Fri Sep 20 08:44:32 PDT 2013


Hi Ruiu,

Can you please review the changes if code affects other flavors, this 
change now affects ELF and other platforms too.

The error message may not be always file cannot be opened.

It could also be something that you gave a unknown format too.

I would prefer it to be moved the way it was earlier.

Thanks

Shankar Easwaran

On 9/19/2013 10:18 PM, Rui Ueyama wrote:
> Author: ruiu
> Date: Thu Sep 19 22:18:58 2013
> New Revision: 191069
>
> URL: http://llvm.org/viewvc/llvm-project?rev=191069&view=rev
> Log:
> Generalize errStr() function so that it can handle any type of errors.
>
> Modified:
>      lld/trunk/include/lld/Driver/InputGraph.h
>
> Modified: lld/trunk/include/lld/Driver/InputGraph.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/InputGraph.h?rev=191069&r1=191068&r2=191069&view=diff
> ==============================================================================
> --- lld/trunk/include/lld/Driver/InputGraph.h (original)
> +++ lld/trunk/include/lld/Driver/InputGraph.h Thu Sep 19 22:18:58 2013
> @@ -227,9 +227,9 @@ public:
>   
>     /// \brief create an error string for printing purposes
>     virtual std::string errStr(llvm::error_code errc) {
> -    if (errc == llvm::errc::no_such_file_or_directory)
> -      return (Twine("Cannot open ") + _path).str();
> -    llvm_unreachable("not handling errors");
> +    std::string msg = errc.message();
> +    Twine twine = Twine("Cannot open ") + _path + ": " + msg;
> +    return twine.str();
>     }
>   
>     /// \brief Create a lld::File node from the FileNode
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation




More information about the llvm-commits mailing list