diff options
author | David L. Jones <dlj@google.com> | 2017-11-15 01:40:05 +0000 |
---|---|---|
committer | David L. Jones <dlj@google.com> | 2017-11-15 01:40:05 +0000 |
commit | fdfce82b87b73e18577d493e84bdabe2585b95d0 (patch) | |
tree | e8d9290e273dba03920bf15a8c7742fcf5ed0b87 /test/Index/Core/index-source.cpp | |
parent | 41af1698c520ea38edf83e7c91f1e519d34f20c1 (diff) | |
parent | a7540887e8b5cb34ee28c12bef863bad85c65b6f (diff) | |
download | clang-google/testing.tar.gz |
Creating branches/google/testing and tags/google/testing/2017-11-14 from r317716google/testing
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/testing@318248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/Core/index-source.cpp')
-rw-r--r-- | test/Index/Core/index-source.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Index/Core/index-source.cpp b/test/Index/Core/index-source.cpp index f9c88d5ea6..6ad600b351 100644 --- a/test/Index/Core/index-source.cpp +++ b/test/Index/Core/index-source.cpp @@ -525,3 +525,36 @@ struct rd33122110::Outer::Nested<int>; // CHECK-NEXT: RelCont | Nested | c:@N@rd33122110@S@Outer@S@Nested>#I // CHECK: [[@LINE-3]]:20 | struct/C++ | Outer | c:@N@rd33122110@S@Outer | <no-cgname> | Ref,RelCont | rel: 1 // CHECK-NEXT: RelCont | Nested | c:@N@rd33122110@S@Outer@S@Nested>#I + +namespace index_offsetof { + +struct Struct { + int field; +}; + +struct Struct2 { + Struct array[4][2]; +}; + +void foo() { + __builtin_offsetof(Struct, field); +// CHECK: [[@LINE-1]]:30 | 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# + __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]]: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# +} + +#define OFFSET_OF_(X, Y) __builtin_offsetof(X, Y) + +class SubclassOffsetof : public Struct { + void foo() { + OFFSET_OF_(SubclassOffsetof, field); +// CHECK: [[@LINE-1]]:34 | 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@S@SubclassOffsetof@F@foo# + } +}; + +} |