[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Refactor / LocalRename / BuiltinOffsetof.cpp
blob3119eeb7e524f354589a577d5e30e75759dc2ba4
1 // RUN: clang-refactor local-rename -selection=test:%s -new-name=bar %s -- | grep -v CHECK | FileCheck %s
3 struct Struct {
4 int /*range f=*/field;
5 };
7 struct Struct2 {
8 Struct /*range array=*/array[4][2];
9 };
11 void foo() {
12 (void)__builtin_offsetof(Struct, /*range f=*/field);
13 (void)__builtin_offsetof(Struct2, /*range array=*/array[1][0]./*range f=*/field);
16 #define OFFSET_OF_(X, Y) __builtin_offsetof(X, Y)
18 class SubclassOffsetof : public Struct {
19 void foo() {
20 (void)OFFSET_OF_(SubclassOffsetof, field);
24 // CHECK: 2 'array' results:
25 // CHECK: Struct /*range array=*/bar[4][2];
26 // CHECK: __builtin_offsetof(Struct2, /*range array=*/bar[1][0]./*range f=*/field);
28 // CHECK: 3 'f' results:
29 // CHECK: int /*range f=*/bar;
30 // CHECK: __builtin_offsetof(Struct, /*range f=*/bar);
31 // CHECK-NEXT: __builtin_offsetof(Struct2, /*range array=*/array[1][0]./*range f=*/bar);
32 // CHECK: OFFSET_OF_(SubclassOffsetof, bar);