This revision was automatically updated to reflect the committed changes. Closed by commit rL272574: clang-rename: implement handling of remaining named casts (authored by vmiklos).
Changed prior to commit: http://reviews.llvm.org/D21270?vs=60479&id=60572#toc Repository: rL LLVM http://reviews.llvm.org/D21270 Files: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp clang-tools-extra/trunk/test/clang-rename/ConstCastExpr.cpp clang-tools-extra/trunk/test/clang-rename/ReinterpretCastExpr.cpp Index: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp =================================================================== --- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp +++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp @@ -131,6 +131,14 @@ return handleCXXNamedCastExpr(Expr); } + bool VisitCXXReinterpretCastExpr(clang::CXXReinterpretCastExpr *Expr) { + return handleCXXNamedCastExpr(Expr); + } + + bool VisitCXXConstCastExpr(clang::CXXConstCastExpr *Expr) { + return handleCXXNamedCastExpr(Expr); + } + // Non-visitors: // \brief Returns a list of unique locations. Duplicate or overlapping Index: clang-tools-extra/trunk/test/clang-rename/ConstCastExpr.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-rename/ConstCastExpr.cpp +++ clang-tools-extra/trunk/test/clang-rename/ConstCastExpr.cpp @@ -0,0 +1,17 @@ +// RUN: cat %s > %t.cpp +// RUN: clang-rename -offset=133 -new-name=X %t.cpp -i -- +// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s +class Cla { +public: + int getValue() { + return 0; + } +}; + +int main() { + const Cla *C = new Cla(); + const_cast<Cla *>(C)->getValue(); // CHECK: const_cast<X *> +} + +// Use grep -FUbo 'Cla' <file> to get the correct offset of foo when changing +// this file. Index: clang-tools-extra/trunk/test/clang-rename/ReinterpretCastExpr.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-rename/ReinterpretCastExpr.cpp +++ clang-tools-extra/trunk/test/clang-rename/ReinterpretCastExpr.cpp @@ -0,0 +1,17 @@ +// RUN: cat %s > %t.cpp +// RUN: clang-rename -offset=133 -new-name=X %t.cpp -i -- +// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s +class Cla { +public: + int getValue() const { + return 0; + } +}; + +int main() { + void *C = new Cla(); + reinterpret_cast<const Cla *>(C)->getValue(); // CHECK: reinterpret_cast<const X *> +} + +// Use grep -FUbo 'Cla' <file> to get the correct offset of foo when changing +// this file.
Index: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp =================================================================== --- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp +++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp @@ -131,6 +131,14 @@ return handleCXXNamedCastExpr(Expr); } + bool VisitCXXReinterpretCastExpr(clang::CXXReinterpretCastExpr *Expr) { + return handleCXXNamedCastExpr(Expr); + } + + bool VisitCXXConstCastExpr(clang::CXXConstCastExpr *Expr) { + return handleCXXNamedCastExpr(Expr); + } + // Non-visitors: // \brief Returns a list of unique locations. Duplicate or overlapping Index: clang-tools-extra/trunk/test/clang-rename/ConstCastExpr.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-rename/ConstCastExpr.cpp +++ clang-tools-extra/trunk/test/clang-rename/ConstCastExpr.cpp @@ -0,0 +1,17 @@ +// RUN: cat %s > %t.cpp +// RUN: clang-rename -offset=133 -new-name=X %t.cpp -i -- +// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s +class Cla { +public: + int getValue() { + return 0; + } +}; + +int main() { + const Cla *C = new Cla(); + const_cast<Cla *>(C)->getValue(); // CHECK: const_cast<X *> +} + +// Use grep -FUbo 'Cla' <file> to get the correct offset of foo when changing +// this file. Index: clang-tools-extra/trunk/test/clang-rename/ReinterpretCastExpr.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-rename/ReinterpretCastExpr.cpp +++ clang-tools-extra/trunk/test/clang-rename/ReinterpretCastExpr.cpp @@ -0,0 +1,17 @@ +// RUN: cat %s > %t.cpp +// RUN: clang-rename -offset=133 -new-name=X %t.cpp -i -- +// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s +class Cla { +public: + int getValue() const { + return 0; + } +}; + +int main() { + void *C = new Cla(); + reinterpret_cast<const Cla *>(C)->getValue(); // CHECK: reinterpret_cast<const X *> +} + +// Use grep -FUbo 'Cla' <file> to get the correct offset of foo when changing +// this file.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits