aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-28 22:38:07 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-28 22:38:07 +0000
commited8bef44c0545fd55a78715606f8d733f6498b21 (patch)
treeeb0bfee3ce9b63cbded719c2d9ad473c60dc558f
parent21480b76382b296f35ada977e0b877faab44e381 (diff)
[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
-rw-r--r--tools/libclang/CIndex.cpp2
1 files changed, 2 insertions, 0 deletions
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<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;