r319357 - [SourceLocations] Use stronger sort predicate to remove non-deterministic ordering
Mandeep Singh Grang via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 29 12:55:13 PST 2017
Author: mgrang
Date: Wed Nov 29 12:55:13 2017
New Revision: 319357
URL: http://llvm.org/viewvc/llvm-project?rev=319357&view=rev
Log:
[SourceLocations] Use stronger sort predicate to remove non-deterministic ordering
Summary:
This fixes the following failure uncovered by D39245:
Clang :: Index/getcursor-preamble.m
Reviewers: gbenyei, akyrtzi, bkramer, arphaman
Reviewed By: arphaman
Subscribers: arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D40618
Modified:
cfe/trunk/tools/libclang/CIndex.cpp
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=319357&r1=319356&r2=319357&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed Nov 29 12:55:13 2017
@@ -1025,8 +1025,9 @@ bool CursorVisitor::VisitObjCContainerDe
[&SM](Decl *A, Decl *B) {
SourceLocation L_A = A->getLocStart();
SourceLocation L_B = B->getLocStart();
- assert(L_A.isValid() && L_B.isValid());
- return SM.isBeforeInTranslationUnit(L_A, L_B);
+ return L_A != L_B ?
+ SM.isBeforeInTranslationUnit(L_A, L_B) :
+ SM.isBeforeInTranslationUnit(A->getLocEnd(), B->getLocEnd());
});
// Now visit the decls.
More information about the cfe-commits
mailing list