[llvm] r203990 - SampleProfile.cpp: Quick fix to r203976 about abuse of Twine. The life of Twine was too short.

NAKAMURA Takumi geek4civic at gmail.com
Fri Mar 14 19:04:47 PDT 2014


I rolled back the latter in r203996. It was not the issue in Twine.

I know my fixes are not real fixes.

2014-03-15 10:11 GMT+09:00 David Blaikie <dblaikie at gmail.com>:
> On Fri, Mar 14, 2014 at 5:10 PM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
>> Author: chapuni
>> Date: Fri Mar 14 19:10:12 2014
>> New Revision: 203990
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=203990&view=rev
>> Log:
>> SampleProfile.cpp: Quick fix to r203976 about abuse of Twine. The life of Twine was too short.
>>
>> FIXME: DiagnosticInfoSampleProfile should not hold Twine&.
>>
>> Modified:
>>     llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp
>>
>> Modified: llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp?rev=203990&r1=203989&r2=203990&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp Fri Mar 14 19:10:12 2014
>> @@ -454,8 +454,7 @@ bool SampleModuleProfile::loadText() {
>>    error_code EC = MemoryBuffer::getFile(Filename, Buffer);
>>    if (EC) {
>>      std::string Msg(EC.message());
>> -    DiagnosticInfoSampleProfile Diag(Filename.data(), Msg);
>> -    M.getContext().diagnose(Diag);
>> +    M.getContext().diagnose(DiagnosticInfoSampleProfile(Filename.data(), Msg));
>>      return false;
>>    }
>>    line_iterator LineIt(*Buffer, '#');
>> @@ -973,9 +972,8 @@ unsigned SampleFunctionProfile::getFunct
>>      }
>>    }
>>
>> -  DiagnosticInfoSampleProfile Diag("No debug information found in function " +
>> -                                   F.getName());
>> -  F.getContext().diagnose(Diag);
>> +  Twine Msg = "No debug information found in function " + F.getName();
>
> Temporary Twines are no good... Since you've rolled the Diag in as a
> temporary, you can just roll the + expression back into the statement
> below and it'll be fine..
>
>> +  F.getContext().diagnose(DiagnosticInfoSampleProfile(Msg));
>>    return 0;
>>  }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list