[llvm] r201190 - Reapply r201180 with an additional error path.

Adrian Prantl aprantl at apple.com
Wed Feb 26 10:15:49 PST 2014



On Feb 25, 2014, at 18:11, Eric Christopher <echristo at gmail.com> wrote:

> Looks good. I'm not sure about the handling errors change, but I also
> don't have any better ideas :)
> 
> On Tue, Feb 11, 2014 at 2:22 PM, Adrian Prantl <aprantl at apple.com> wrote:
>> diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmP
>> index c0f3686..32cf67f 100644
>> --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
>> +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
>> @@ -884,6 +884,11 @@ void AsmPrinter::EmitDwarfRegOp(const MachineLocation &MLoc
>>   // FIXME: We have no reasonable way of handling errors in here. The
>>   // caller might be in the middle of an dwarf expression. We should
>>   // probably assert that Reg >= 0 once debug info generation is more mature.
>> +  if (Reg < 0) {
>> +    OutStreamer.AddComment("nop (invalid dwarf register number)");
>> +    EmitInt8(dwarf::DW_OP_nop);
>> +    return;
>> +  }
>> 
>>   if (MLoc.isIndirect() || Indirect) {
>>     if (Reg < 32) {

At least it’s an improvement over what we previously did (silently emitting a negative register number). Now at least we have an warning message. In the assembler output. People sure will look there, right? ;-)

-- adrian



More information about the llvm-commits mailing list