• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: clang-refactor local-rename -selection=test:%s -new-name=bar %s -- | grep -v CHECK | FileCheck %s
2 
3 struct Struct {
4   int /*range f=*/field;
5 };
6 
7 struct Struct2 {
8   Struct /*range array=*/array[4][2];
9 };
10 
foo()11 void foo() {
12   (void)__builtin_offsetof(Struct, /*range f=*/field);
13   (void)__builtin_offsetof(Struct2, /*range array=*/array[1][0]./*range f=*/field);
14 }
15 
16 #define OFFSET_OF_(X, Y) __builtin_offsetof(X, Y)
17 
18 class SubclassOffsetof : public Struct {
foo()19   void foo() {
20     (void)OFFSET_OF_(SubclassOffsetof, field);
21   }
22 };
23 
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);
27 
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);
33