[cfe-dev] Clang Static Analyzer: reporting a TypeLoc as error location?

Jordan Rose jordan_rose at apple.com
Tue Sep 3 09:13:05 PDT 2013


Hi, Gabor. The simplest thing to do here is to add ranges to the BugReport once it's been created. (See the addRange() method.) If you want to put the effort in, we'd probably take a refactoring of PathDiagnosticLocation to include TypeLocs as well.

Jordan


On Sep 2, 2013, at 9:36 , Gábor Kozár <kozargabor at gmail.com> wrote:

> Hi,
>  
> I have some (AST-based) checkers that detect type bugs, i.e. cases where a specific type is incorrect. Unfortunately, I cannot find any way to make the Clang Static Analyzer accept a TypeLoc as the error location, since PathDiagnosticLocation only has overloads for Stmt and Decl. It also has one accepting a SourceLocation, but I want to highlight the entire range. So I'd need either an overload accepting a SourceRange, or two SourceLocations.
>  
> Currently I'm just displaying the variable/parameter definition as the error location, which is all right, I guess, but not ideal. Is there any way to achieve the above? The ability to report any SourceRange as error location would be very useful, I believe.
>  
> Thanks!
>  
> Gabor
>  
> --
> Gábor Kozár
> kozargabor at gmail.com
>  
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list