summaryrefslogtreecommitdiffstats
path: root/tools/libclang
diff options
context:
space:
mode:
authorMandeep Singh Grang <mgrang@codeaurora.org>2017-11-29 20:55:13 +0000
committerMandeep Singh Grang <mgrang@codeaurora.org>2017-11-29 20:55:13 +0000
commit25c021962d9747fe4fde8ed3cf52da01c7e67348 (patch)
treef8990db28f72818831bd05dd18eb25acb68998c0 /tools/libclang
parent6432d59ab0dde62126b7e55c35b6a2f88490334f (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang')
-rw-r--r--tools/libclang/CIndex.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 98532fe525..455151f0fc 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1025,8 +1025,9 @@ bool CursorVisitor::VisitObjCContainerDecl(ObjCContainerDecl *D) {
[&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.