]> granicus.if.org Git - clang/commitdiff
[libclang] A MemberRefExpr cursor for a property dot syntax should have as
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 30 Mar 2012 00:19:13 +0000 (00:19 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 30 Mar 2012 00:19:13 +0000 (00:19 +0000)
its location the location of the property.

Part of rdar://11113120

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153708 91177308-0d34-0410-b5e6-96231b3b80d8

test/Index/get-cursor.m
tools/libclang/CIndex.cpp

index 830f9828b9243ef7512eba255602eb3804ddf5e2..d343e66a0035d47cff3acea7bdb8bbe1d33069de 100644 (file)
@@ -36,6 +36,8 @@ struct S { int x; };
 -(void)mm:(struct S*)s {
   rdar10902015 *i = 0;
   s->x = 0;
+  Test1 *test1;
+  test1.name = 0;
 }
 @end
 
@@ -54,3 +56,4 @@ struct S { int x; };
 
 // RUN: c-index-test -cursor-at=%s:38:6 -cursor-at=%s:40:11 %s | FileCheck -check-prefix=CHECK-MEMBERREF %s
 // CHECK-MEMBERREF: 38:6 MemberRefExpr=x:34:16 SingleRefName=[38:6 - 38:7] RefName=[38:6 - 38:7] Extent=[38:3 - 38:7]
+// CHECK-MEMBERREF: 40:9 MemberRefExpr=name:23:21 Extent=[40:3 - 40:13] Spelling=name
index e8acfd9df2f18cbc9aefe335e958856fd244eec8..972beaf9e75ace83980efaa337151b7ed4a6e119 100644 (file)
@@ -2944,6 +2944,8 @@ static SourceLocation getLocationFromExpr(Expr *E) {
     return Ivar->getLocation();
   if (SizeOfPackExpr *SizeOfPack = dyn_cast<SizeOfPackExpr>(E))
     return SizeOfPack->getPackLoc();
+  if (ObjCPropertyRefExpr *PropRef = dyn_cast<ObjCPropertyRefExpr>(E))
+    return PropRef->getLocation();
   
   return E->getLocStart();
 }