From: Argyrios Kyrtzidis Date: Mon, 28 Nov 2011 22:38:07 +0000 (+0000) Subject: [libclang] Protect against the declaration's SourceRange being invalid X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed8bef44c0545fd55a78715606f8d733f6498b21;p=clang [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 4fda8bc313..72abfa76ea 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -286,6 +286,8 @@ void CursorVisitor::visitDeclsFromFileRegion(FileID File, SmallVector::iterator DIt = Decls.begin(); for (SmallVector::iterator DE = Decls.end(); DIt != DE; ++DIt) { Decl *D = *DIt; + if (D->getSourceRange().isInvalid()) + continue; if (isInLexicalContext(D, CurDC)) continue;