r182695 - Make isBeforeInTranslationUnit consistent in the face of failures to get a valid FileID.

Jordan Rose jordan_rose at apple.com
Fri May 24 18:07:04 PDT 2013


Thank you!

On May 24, 2013, at 18:06 , Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:

> On May 24, 2013, at 5:49 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
>> It's not correct...std::sort comparators are like <, so equivalent elements should compare false.
> 
> Oops, you're right that is not correct, see r182698.
> 
>> 
>> I'll get it at some point.
>> 
>> 
>> On May 24, 2013, at 17:48 , Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
>> 
>>> On May 24, 2013, at 5:03 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>>> 
>>>> Being fully pedantic, this still isn't correct if both offsets are invalid.
>>> 
>>> It is "correct" if you consider invalid offsets as equivalent.
>>> 
>>> I don't have a strong opinion though, feel free to change it if you'd like.
>>> 
>>>> 
>>>> 
>>>> On May 24, 2013, at 16:47 , Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
>>>> 
>>>>> Author: akirtzidis
>>>>> Date: Fri May 24 18:47:43 2013
>>>>> New Revision: 182695
>>>>> 
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=182695&view=rev
>>>>> Log:
>>>>> Make isBeforeInTranslationUnit consistent in the face of failures to get a valid FileID.
>>>>> 
>>>>> Suggested by Jordan.
>>>>> 
>>>>> Modified:
>>>>>    cfe/trunk/lib/Basic/SourceManager.cpp
>>>>> 
>>>>> Modified: cfe/trunk/lib/Basic/SourceManager.cpp
>>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=182695&r1=182694&r2=182695&view=diff
>>>>> ==============================================================================
>>>>> --- cfe/trunk/lib/Basic/SourceManager.cpp (original)
>>>>> +++ cfe/trunk/lib/Basic/SourceManager.cpp Fri May 24 18:47:43 2013
>>>>> @@ -2039,8 +2039,11 @@ bool SourceManager::isBeforeInTranslatio
>>>>>   std::pair<FileID, unsigned> LOffs = getDecomposedLoc(LHS);
>>>>>   std::pair<FileID, unsigned> ROffs = getDecomposedLoc(RHS);
>>>>> 
>>>>> +  // getDecomposedLoc may have failed to return a valid FileID because, e.g. it
>>>>> +  // is a serialized one referring to a file that was removed after we loaded
>>>>> +  // the PCH.
>>>>>   if (LOffs.first.isInvalid() || ROffs.first.isInvalid())
>>>>> -    return false;
>>>>> +    return LOffs.first.isInvalid();
>>>>> 
>>>>>   // If the source locations are in the same file, just compare offsets.
>>>>>   if (LOffs.first == ROffs.first)
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> cfe-commits mailing list
>>>>> cfe-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130524/ccdd2b8b/attachment.html>


More information about the cfe-commits mailing list