r229434 - InstrProf: Update for LLVM API change

Nico Weber thakis at chromium.org
Sun Apr 5 21:20:29 PDT 2015


This introduced a crash that I just fixed in r234141. Maybe auto shouldn't
be used for ErrorOr, to make it more difficult to make this type of mistake?

On Mon, Feb 16, 2015 at 1:29 PM, Justin Bogner <mail at justinbogner.com>
wrote:

> Author: bogner
> Date: Mon Feb 16 15:29:05 2015
> New Revision: 229434
>
> URL: http://llvm.org/viewvc/llvm-project?rev=229434&view=rev
> Log:
> InstrProf: Update for LLVM API change
>
> Update for the API change in r229433
>
> Modified:
>     cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=229434&r1=229433&r2=229434&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Feb 16 15:29:05 2015
> @@ -140,12 +140,14 @@ CodeGenModule::CodeGenModule(ASTContext
>    RRData = new RREntrypoints();
>
>    if (!CodeGenOpts.InstrProfileInput.empty()) {
> -    if (std::error_code EC = llvm::IndexedInstrProfReader::create(
> -            CodeGenOpts.InstrProfileInput, PGOReader)) {
> +    auto ReaderOrErr =
> +
> llvm::IndexedInstrProfReader::create(CodeGenOpts.InstrProfileInput);
> +    if (std::error_code EC = ReaderOrErr.getError()) {
>        unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
>                                                "Could not read profile:
> %0");
>        getDiags().Report(DiagID) << EC.message();
>      }
> +    PGOReader = std::move(ReaderOrErr.get());
>    }
>
>    // If coverage mapping generation is enabled, create the
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150405/9838b67b/attachment.html>


More information about the cfe-commits mailing list