]> granicus.if.org Git - clang/commitdiff
[index] __builtin_offset's field reference is located at the end location
authorAlex Lorenz <arphaman@gmail.com>
Tue, 7 Nov 2017 18:25:36 +0000 (18:25 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Tue, 7 Nov 2017 18:25:36 +0000 (18:25 +0000)
The starting location is the location of the '.'

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

lib/Index/IndexBody.cpp
test/Index/Core/index-source.cpp

index a54d2cbb9298fa4ab730cb424445f3d14e770ecb..ac34956b24840d8a772dbb0ec8167f481cd7fc0e 100644 (file)
@@ -432,7 +432,7 @@ public:
     for (unsigned I = 0, E = S->getNumComponents(); I != E; ++I) {
       const OffsetOfNode &Component = S->getComponent(I);
       if (Component.getKind() == OffsetOfNode::Field)
-        IndexCtx.handleReference(Component.getField(), Component.getLocStart(),
+        IndexCtx.handleReference(Component.getField(), Component.getLocEnd(),
                                  Parent, ParentDC, SymbolRoleSet(), {});
       // FIXME: Try to resolve dependent field references.
     }
index cb64bd73963ba1fabbe17de113109830c5f0a46e..6ad600b35143d4ee4cfe5824fcdd23e72b1852fd 100644 (file)
@@ -543,7 +543,7 @@ void foo() {
   __builtin_offsetof(Struct2, array[1][0].field);
 // CHECK: [[@LINE-1]]:31 | field/C | array | c:@N@index_offsetof@S@Struct2@FI@array | <no-cgname> | Ref,RelCont | rel: 1
 // CHECK-NEXT: RelCont | foo | c:@N@index_offsetof@F@foo#
-// CHECK: [[@LINE-3]]:42 | field/C | field | c:@N@index_offsetof@S@Struct@FI@field | <no-cgname> | Ref,RelCont | rel: 1
+// CHECK: [[@LINE-3]]:43 | field/C | field | c:@N@index_offsetof@S@Struct@FI@field | <no-cgname> | Ref,RelCont | rel: 1
 // CHECK-NEXT: RelCont | foo | c:@N@index_offsetof@F@foo#
 }