Assertion in BugReport::getLocation()?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Assertion in BugReport::getLocation()?

Kristof Beyls via cfe-dev

Hello,

 

We have a checker that we plan to open source, but it crashes upon a strange assertion. We create a non-fatal `BugReport` which we try to emit. Before emitting the code tries to check whether its location is valid using `getLocation(…).isValid()`, to prevent assertion in `emit()`, however `getLocation()` itself already asserts that the location is valid. This makes the `isValid()` function useless because we cannot get the location to check whether its is valid because it crashes with assertion if it is not. Of course the location should be valid in a non-fatal error node (probably this is the root problem), but there is no way to check it. What is the reason for this assertion in `getLocation()`? How to check its validity? What can make the location of a non-fatal `BugReport` invalid? Thanks for the answers in advance!

 

Regards,

 

Ádám

 


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Assertion in BugReport::getLocation()?

Kristof Beyls via cfe-dev
I'm confused.

This assertion applies only to path-insensitive reports into which you supply the PathDiagnosticLocation manually. For such reports you can check the location for validity before you put it into the report.

For path-sensitive reports the location is computed dynamically based on the error node's ProgramPoint and it's not immediately checked for validity. In the old code (before https://reviews.llvm.org/D66572) the stored location was asserted to be *in*valid because the information was already present in the error node; after said patch path sensitive reports don't store the location at all.

One of the reasons why a path-sensitive report may have invalid path diagnostic location is that the underlying source location may be invalid, eg. comes from a BodyFarm.

On 9/30/19 6:25 AM, Ádám Balogh via cfe-dev wrote:

Hello,

 

We have a checker that we plan to open source, but it crashes upon a strange assertion. We create a non-fatal `BugReport` which we try to emit. Before emitting the code tries to check whether its location is valid using `getLocation(…).isValid()`, to prevent assertion in `emit()`, however `getLocation()` itself already asserts that the location is valid. This makes the `isValid()` function useless because we cannot get the location to check whether its is valid because it crashes with assertion if it is not. Of course the location should be valid in a non-fatal error node (probably this is the root problem), but there is no way to check it. What is the reason for this assertion in `getLocation()`? How to check its validity? What can make the location of a non-fatal `BugReport` invalid? Thanks for the answers in advance!

 

Regards,

 

Ádám

 


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev