From ed8bef44c0545fd55a78715606f8d733f6498b21 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 28 Nov 2011 22:38:07 +0000 Subject: [PATCH] [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 --- tools/libclang/CIndex.cpp | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.40.0