Re-apply r103581 with updated tests. It turns out we were computing bogus locations for
many things.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103583 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index d24652b..7f227a0 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1794,7 +1794,7 @@
return cxloc::translateSourceLocation(getCursorContext(C), L);
}
- if (!getCursorDecl(C))
+ if (C.kind < CXCursor_FirstDecl || C.kind > CXCursor_LastDecl)
return clang_getNullLocation();
Decl *D = getCursorDecl(C);
@@ -1860,7 +1860,7 @@
return cxloc::translateSourceRange(getCursorContext(C), R);
}
- if (!getCursorDecl(C))
+ if (C.kind < CXCursor_FirstDecl || C.kind > CXCursor_LastDecl)
return clang_getNullRange();
Decl *D = getCursorDecl(C);