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
[&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.