This revision was automatically updated to reflect the committed changes. Closed by commit rC319357: [SourceLocations] Use stronger sort predicate to remove non-deterministic… (authored by mgrang).
Repository: rC Clang https://reviews.llvm.org/D40618 Files: tools/libclang/CIndex.cpp Index: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1025,8 +1025,9 @@ [&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.
Index: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1025,8 +1025,9 @@ [&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.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits