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 <[email protected]>
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
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to