On May 24, 2013, at 4:36 PM, Jordan Rose <[email protected]> wrote:

> 
> On May 24, 2013, at 16:35 , Argyrios Kyrtzidis <[email protected]> wrote:
> 
>> On May 24, 2013, at 3:40 PM, Jordan Rose <[email protected]> wrote:
>> 
>>> I see that we're fixing crashes, but why isn't it just part of the 
>>> precondition for this function that it is never called with an invalid 
>>> FileID?
>> 
>> It's not checking the parameters, the source locations it received may be 
>> fine, but then getDecomposedLoc() may return an invalid FileID because, for 
>> example, the location was in a PCH and the file it referred to was removed 
>> from the file system *after* we fully loaded the PCH.
>> 
>>> 
>>> Also, you can't change isBeforeInTranslationUnit that way; the sort's not 
>>> consistent. Invalid locs should be always before or always after valid 
>>> locs, or you should assert that this doesn't happen.
>> 
>> You are right that the return value becomes meaningless; maybe add an 
>> optional "bool *Invalid" parameter and allow callers to check that ?
> 
> This function is used as a comparator for std::sort and such. I think you can 
> just make an ordering by fiat and it won't hurt anyone.

Good point, see in r182695; thanks!

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to