[libclang] Protect against the declaration's SourceRange being invalid
before passing to RangeCompare.
Though no idea how this can occur with the decls returned from
findFileRegionDecls().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145301 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 4fda8bc..72abfa7 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -286,6 +286,8 @@
SmallVector<Decl *, 16>::iterator DIt = Decls.begin();
for (SmallVector<Decl *, 16>::iterator DE = Decls.end(); DIt != DE; ++DIt) {
Decl *D = *DIt;
+ if (D->getSourceRange().isInvalid())
+ continue;
if (isInLexicalContext(D, CurDC))
continue;