[llvm] r250704 - Convert gold-plugin unnecessary unique_ptr into local (NFC)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 10:22:09 PDT 2015


On Mon, Oct 19, 2015 at 9:57 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
> On Mon, Oct 19, 2015 at 8:23 AM, Teresa Johnson via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: tejohnson
>> Date: Mon Oct 19 10:23:03 2015
>> New Revision: 250704
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=250704&view=rev
>> Log:
>> Convert gold-plugin unnecessary unique_ptr into local (NFC)
>>
>> Modified:
>>     llvm/trunk/tools/gold/gold-plugin.cpp
>>
>> Modified: llvm/trunk/tools/gold/gold-plugin.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=250704&r1=250703&r2=250704&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/tools/gold/gold-plugin.cpp (original)
>> +++ llvm/trunk/tools/gold/gold-plugin.cpp Mon Oct 19 10:23:03 2015
>> @@ -896,7 +896,7 @@ static ld_plugin_status allSymbolsReadHo
>>    // function index/summary and emit it. We don't need to parse the
>> modules
>>    // and link them in this case.
>>    if (options::thinlto) {
>> -    std::unique_ptr<FunctionInfoIndex> CombinedIndex(new
>> FunctionInfoIndex());
>> +    FunctionInfoIndex CombinedIndex;
>>      uint64_t NextModuleId = 0;
>>      for (claimed_file &F : Modules) {
>>        ld_plugin_input_file File;
>> @@ -905,7 +905,7 @@ static ld_plugin_status allSymbolsReadHo
>>
>>        std::unique_ptr<FunctionInfoIndex> Index =
>>            getFunctionIndexForFile(Context, F, File);
>> -      CombinedIndex->mergeFrom(std::move(Index), ++NextModuleId);
>> +      CombinedIndex.mergeFrom(std::move(Index), ++NextModuleId);
>>      }
>>
>>      std::error_code EC;
>> @@ -914,7 +914,7 @@ static ld_plugin_status allSymbolsReadHo
>>      if (EC)
>>        message(LDPL_FATAL, "Unable to open %s.thinlto.bc for writing: %s",
>>                output_name.data(), EC.message().c_str());
>> -    WriteFunctionSummaryToFile(CombinedIndex.get(), OS);
>> +    WriteFunctionSummaryToFile(&CombinedIndex, OS);
>
>
> ^ should this function take a parameter by ref, rather than by pointer? (if
> it can't be null)

Good idea. Will change this and the callees of
WriteFunctionSummaryToFile that take the Index (and expect it to be
non-null) accordingly.

Thanks,
Teresa

>
>>
>>      OS.close();
>>
>>      cleanup_hook();
>>
>>
>> _______________________________________________
>> 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


More information about the llvm-commits mailing list