[llvm-commits] [llvm] r95168 - /llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp

Chris Lattner sabre at nondot.org
Thu Mar 18 22:49:40 PDT 2010


phixed in r98939

On Mar 18, 2010, at 10:10 PM, Jeffrey Yasskin wrote:

> On Tue, Feb 2, 2010 at 5:29 PM, Chris Lattner <sabre at nondot.org> wrote:
>> Author: lattner
>> Date: Tue Feb  2 18:29:55 2010
>> New Revision: 95168
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=95168&view=rev
>> Log:
>> pass an instprinter into the AsmPrinter if it is available.
>> 
>> Modified:
>>    llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
>> 
>> Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=95168&r1=95167&r2=95168&view=diff
>> 
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Tue Feb  2 18:29:55 2010
>> @@ -126,14 +126,18 @@
>>   formatted_raw_ostream *LegacyOutput;
>>   switch (FileType) {
>>   default: return CGFT_ErrorOccurred;
>> -  case CGFT_AssemblyFile:
>> -    AsmStreamer.reset(createAsmStreamer(*Context, Out, *getMCAsmInfo(),
>> +  case CGFT_AssemblyFile: {
>> +    const MCAsmInfo &MAI = *getMCAsmInfo();
>> +    MCInstPrinter *InstPrinter =
>> +      getTarget().createMCInstPrinter(MAI.getAssemblerDialect(), MAI, Out);
>> +    AsmStreamer.reset(createAsmStreamer(*Context, Out, MAI,
>>                                         getTargetData()->isLittleEndian(),
>> -                                        getVerboseAsm(), /*instprinter*/0,
>> +                                        getVerboseAsm(), InstPrinter,
> 
> This is a memory leak. createAsmStreamer doesn't take ownership of its
> pointer arguments (and llvm-mc.cpp enforces that by deleting them).
> 
>>                                         /*codeemitter*/0));
>>     // Set the AsmPrinter's "O" to the output file.
>>     LegacyOutput = &Out;
>>     break;
>> +  }
>>   case CGFT_ObjectFile: {
>>     // Create the code emitter for the target if it exists.  If not, .o file
>>     // emission fails.
>> 
>> 
>> _______________________________________________
>> 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