[llvm] r216466 - Return a std::unique_ptr from the IRReader.h functions. NFC.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Aug 26 11:15:58 PDT 2014


>> -  Result = ParseIRFile(FN, Err, Context);
>> -  if (Result) return Result;   // Load successful!
>> +  std::unique_ptr<Module> Result = parseIRFile(FN, Err, Context);
>> +  if (Result)
>
> This variable could be rolled into the if condition. Or you could
> invert it (like other functions here) and just have one return
> statement:

Done

> if (!Result)
>   Err.print(argv0, errs());
> return Result;
>
>> +    return Result;
>
> I'm not sure there's any value in it, but you lost the "// Load
> successful!" comment from the return line.

Yes, neither did I.

Cheers,
Rafael



More information about the llvm-commits mailing list