summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-rename/StaticCastExpr.cpp
blob: b75102ab17ee33c2136835cefa8481024b88f105 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// RUN: cat %s > %t.cpp
// RUN: clang-rename -offset=152 -new-name=Bar %t.cpp -i --
// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s

class Baz {
};

class Foo : public Baz {                          // CHECK: class Bar : public Baz {
public:
  int getValue() const {
    return 0;
  }
};

int main() {
  Foo foo;                                        // FIXME: Bar foo;
  const Baz &Reference = foo;
  const Baz *Pointer = &foo;

  static_cast<const Foo &>(Reference).getValue(); // CHECK: static_cast<const Bar &>(Reference).getValue();
  static_cast<const Foo *>(Pointer)->getValue();  // CHECK: static_cast<const Bar *>(Pointer)->getValue();
}

// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
// this file.
OpenPOWER on IntegriCloud