[PATCH] Fix crash in handling back-end warnings

Geoff Berry gberry at codeaurora.org
Fri May 8 08:12:29 PDT 2015


Hi Diego,

Thanks for looking at this.  I've uploaded a new version that hopefully incorporates your feedback.  

http://reviews.llvm.org/D9449

--
Geoff Berry
Employee of Qualcomm Innovation Center, Inc.
 Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

-----Original Message-----
From: Diego Novillo [mailto:dnovillo at google.com] 
Sent: Thursday, May 07, 2015 5:42 PM
To: reviews+D9449+public+904931d5e5bc6215 at reviews.llvm.org
Cc: gberry at codeaurora.org; cfe commits
Subject: Re: [PATCH] Fix crash in handling back-end warnings

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 (a few lines below your new guard). I suppose something changed in getLocation() that's now causing it to fail. In that case, could you just fold the new test in the code below?

  // If a location isn't available, try to approximate it using the associated
  // function definition. We use the definition's right brace to differentiate
  // from diagnostics that genuinely relate to the function itself.
  FullSourceLoc Loc(DILoc, SourceMgr);
  if (Loc.isInvalid())
[ ... ]


Diego.





More information about the cfe-commits mailing list