aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/CIndex/CIndex.cpp6
-rw-r--r--tools/c-index-test/c-index-test.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index eff602ff8e..fb6dd5608f 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -655,7 +655,8 @@ static enum CXCursorKind TranslateKind(Decl *D) {
// CXCursor Operations.
//
CXCursor clang_getCursor(CXTranslationUnit CTUnit, const char *source_name,
- unsigned line, unsigned column)
+ unsigned line, unsigned column,
+ CXDecl RelativeToDecl)
{
assert(CTUnit && "Passed null CXTranslationUnit");
ASTUnit *CXXUnit = static_cast<ASTUnit *>(CTUnit);
@@ -670,7 +671,8 @@ CXCursor clang_getCursor(CXTranslationUnit CTUnit, const char *source_name,
SourceLocation SLoc =
CXXUnit->getSourceManager().getLocation(File, line, column);
- ASTLocation ALoc = ResolveLocationInAST(CXXUnit->getASTContext(), SLoc);
+ ASTLocation ALoc = ResolveLocationInAST(CXXUnit->getASTContext(), SLoc,
+ static_cast<NamedDecl *>(RelativeToDecl));
Decl *Dcl = ALoc.getParentDecl();
if (ALoc.isNamedRef())
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 83d3d3f313..b458216f70 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -53,7 +53,7 @@ static void TranslationUnitVisitor(CXTranslationUnit Unit, CXCursor Cursor,
unsigned curLine = startLine, curColumn = startColumn;
CXCursor Ref;
- while (startBuf <= endBuf) {
+ while (startBuf < endBuf) {
if (*startBuf == '\n') {
startBuf++;
curLine++;
@@ -62,7 +62,7 @@ static void TranslationUnitVisitor(CXTranslationUnit Unit, CXCursor Cursor,
curColumn++;
Ref = clang_getCursor(Unit, clang_getCursorSource(Cursor),
- curLine, curColumn);
+ curLine, curColumn, Cursor.decl);
if (Ref.kind == CXCursor_NoDeclFound) {
/* Nothing found here; that's fine. */
} else if (Ref.kind != CXCursor_FunctionDecl) {