diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-06-27 19:42:23 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-06-27 19:42:23 +0000 |
commit | 064c44b8a17d4c426b87ad1c58de81d76a13fca3 (patch) | |
tree | 9222a9f1b0d955d0a98b5f2be24529f6e4f465f8 /test/Index/get-cursor.cpp | |
parent | 5517b89953e3c9276f161ce29831de388bb2573d (diff) |
[libclang] Avoid having the cursor of an expression replace the declaration cursor
when the expression source range overlaps the declaration range.
This can happen for C++ constructor expressions whose range generally
include the variable declaration, e.g.:
MyCXXClass foo; // Make sure pointing at 'foo' returns a VarDecl cursor.
rdar://9124499.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133930 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/get-cursor.cpp')
-rw-r--r-- | test/Index/get-cursor.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/Index/get-cursor.cpp b/test/Index/get-cursor.cpp index f26d9825a1..2aa76c4725 100644 --- a/test/Index/get-cursor.cpp +++ b/test/Index/get-cursor.cpp @@ -31,6 +31,10 @@ struct YDerived : Y { X getAnotherX() { return member; } }; +void test() { + X foo; +} + // RUN: c-index-test -cursor-at=%s:12:20 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s // RUN: c-index-test -cursor-at=%s:13:21 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s // RUN: c-index-test -cursor-at=%s:13:28 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s @@ -61,3 +65,6 @@ struct YDerived : Y { // RUN: c-index-test -cursor-at=%s:27:10 %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s // RUN: c-index-test -cursor-at=%s:31:28 %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s // CHECK-IMPLICIT-MEMREF: MemberRefExpr=member:21:7 + +// RUN: c-index-test -cursor-at=%s:35:5 %s | FileCheck -check-prefix=CHECK-DECL %s +// CHECK-DECL: VarDecl=foo:35:5 |