LukasScheucher / include-what-you-use

Automatically exported from code.google.com/p/include-what-you-use
Other
0 stars 0 forks source link

Fix asserts caused by GetSpellingLoc and GetInstantiationLoc #50

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
GetSpellingLoc and GetInstantiationLoc can cause asserts in 
clang::FullSourceLoc if they are invoked with an invalid 'loc'. This can happen 
when running IWYU with --verbose=3. In the cases I saw it happening they were 
being called from GetWarningMsg(), but there may be other examples.

The attached patch resolves the issue. GetLineNumber already has some similar 
checks.

Original issue reported on code.google.com by paul.hol...@gmail.com on 16 Jul 2011 at 1:56

Attachments:

GoogleCodeExporter commented 8 years ago
So GetSpellingLoc() of an invalidLoc would just be another invalidLoc?  Seems 
fine to me.  Feel free to apply.

Original comment by csilv...@gmail.com on 18 Jul 2011 at 11:37

GoogleCodeExporter commented 8 years ago
That's right. Following the assert it would go on to return another invalidLoc 
anyway, so this just avoids the assert. I've applied it in r271.

Original comment by paul.hol...@gmail.com on 19 Jul 2011 at 8:22