[PATCH] Fix crash in handling back-end warnings

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri May 8 08:28:58 PDT 2015


> On 2015 May 7, at 17:42, Diego Novillo <dnovillo at google.com> wrote:
> 
> On Thu, May 7, 2015 at 2:42 PM, Diego Novillo <dnovillo at google.com> wrote:
>> On Fri, May 1, 2015 at 3:22 PM, Geoff Berry <gberry at codeaurora.org> wrote:
>> 
>>> Index: lib/CodeGen/CodeGenAction.cpp
>>> ===================================================================
>>> --- lib/CodeGen/CodeGenAction.cpp
>>> +++ lib/CodeGen/CodeGenAction.cpp
>>> @@ -434,7 +434,13 @@
>>>   FileManager &FileMgr = SourceMgr.getFileManager();
>>>   StringRef Filename;
>>>   unsigned Line, Column;
>>> -  D.getLocation(&Filename, &Line, &Column);
>>> +  if (D.isLocationAvailable())
>>> +    D.getLocation(&Filename, &Line, &Column);
>>> +  else {
>>> +    Filename = "<unknown>";
>>> +    Line = 0;
>>> +    Column = 0;
>>> +  }
>> 
>> Odd, this code used to unavailable locations
> 
> "used to deal with unavailable..."

I probably broke this at some point when I was transitioning
to the new debug info hierarchy.  The old hierarchy's accessors
checked for NULL and give default answers, whereas the new hierarchy
just uses pointers directly.

At some point I switched the accessors to start asserting and fixed
any bugs that uncovered, but I guess there wasn't any test coverage
here so I missed it.



More information about the cfe-commits mailing list