aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-08-25 22:24:47 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-08-25 22:24:47 +0000
commit6f155de99c59af890817146ec8526bafb6560f1f (patch)
treecfcb61f65632aba8a3af17656e865b8b124eae8f /tools/libclang/CIndex.cpp
parent46c03c3e7482660fcc0c9f461ca4e40da2cda01b (diff)
[libclang] Fix getting a cursor that points inside tag definition that is part
of a type specifier. e.g. for: typedef struct _MyS { int foo; } MyS; pointing at field 'foo' would give a cursor for the typedef declaration 'MyS' instead of the field. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndex.cpp')
-rw-r--r--tools/libclang/CIndex.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 2ab02795ec..f1f2cb10ad 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1445,6 +1445,9 @@ bool CursorVisitor::VisitUnresolvedUsingTypeLoc(UnresolvedUsingTypeLoc TL) {
}
bool CursorVisitor::VisitTagTypeLoc(TagTypeLoc TL) {
+ if (TL.isDefinition())
+ return Visit(MakeCXCursor(TL.getDecl(), TU));
+
return Visit(MakeCursorTypeRef(TL.getDecl(), TL.getNameLoc(), TU));
}