diff options
Diffstat (limited to 'clang-tools-extra/test/clang-rename/DynamicCastExpr.cpp')
| -rw-r--r-- | clang-tools-extra/test/clang-rename/DynamicCastExpr.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-rename/DynamicCastExpr.cpp b/clang-tools-extra/test/clang-rename/DynamicCastExpr.cpp new file mode 100644 index 00000000000..91d4f25ab07 --- /dev/null +++ b/clang-tools-extra/test/clang-rename/DynamicCastExpr.cpp @@ -0,0 +1,25 @@ +// RUN: cat %s > %t.cpp +// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i -- +// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s +class Base { + virtual int getValue() const = 0; +}; + +class Derived : public Base { +public: + int getValue() const { + return 0; + } +}; + +int main() { + Derived D; + const Base &Reference = D; + const Base *Pointer = &D; + + dynamic_cast<const Derived &>(Reference).getValue(); // CHECK: dynamic_cast<const X &> + dynamic_cast<const Derived *>(Pointer)->getValue(); // CHECK: dynamic_cast<const X *> +} + +// Use grep -FUbo 'Derived' <file> to get the correct offset of foo when changing +// this file. |

