It's not correct...std::sort comparators are like <, so equivalent elements should compare false.
I'll get it at some point. On May 24, 2013, at 17:48 , Argyrios Kyrtzidis <[email protected]> wrote: > On May 24, 2013, at 5:03 PM, Jordan Rose <[email protected]> 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 <[email protected]> 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 >>> [email protected] >>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >> > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
