[Libreoffice-commits] dev-tools.git: clang/qa clang/rename.cxx

Miklos Vajna vmiklos at collabora.co.uk
Fri Jun 10 08:47:09 UTC 2016


 clang/qa/data/rename-cxx-const-cast-expr.cxx                |   14 ++++++++++++
 clang/qa/data/rename-cxx-const-cast-expr.cxx.expected       |   14 ++++++++++++
 clang/qa/data/rename-cxx-reinterpret-cast-expr.cxx          |   14 ++++++++++++
 clang/qa/data/rename-cxx-reinterpret-cast-expr.cxx.expected |   14 ++++++++++++
 clang/qa/test-rename.sh                                     |    8 ++++++
 clang/rename.cxx                                            |   10 ++++++++
 6 files changed, 74 insertions(+)

New commits:
commit 0ea1eb435aee9bf6c19dd77e8f78b2f3ad557a17
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jun 10 10:46:43 2016 +0200

    clang: handle remaining named cast types in rename

diff --git a/clang/qa/data/rename-cxx-const-cast-expr.cxx b/clang/qa/data/rename-cxx-const-cast-expr.cxx
new file mode 100644
index 0000000..d98a0cb
--- /dev/null
+++ b/clang/qa/data/rename-cxx-const-cast-expr.cxx
@@ -0,0 +1,14 @@
+class C
+{
+public:
+    int getValue()
+    {
+        return 0;
+    }
+};
+
+int main()
+{
+    const C* pC = new C();
+    const_cast<C*>(pC)->getValue();
+}
diff --git a/clang/qa/data/rename-cxx-const-cast-expr.cxx.expected b/clang/qa/data/rename-cxx-const-cast-expr.cxx.expected
new file mode 100644
index 0000000..eebcd48
--- /dev/null
+++ b/clang/qa/data/rename-cxx-const-cast-expr.cxx.expected
@@ -0,0 +1,14 @@
+class D
+{
+public:
+    int getValue()
+    {
+        return 0;
+    }
+};
+
+int main()
+{
+    const D* pC = new D();
+    const_cast<D*>(pC)->getValue();
+}
diff --git a/clang/qa/data/rename-cxx-reinterpret-cast-expr.cxx b/clang/qa/data/rename-cxx-reinterpret-cast-expr.cxx
new file mode 100644
index 0000000..1337359
--- /dev/null
+++ b/clang/qa/data/rename-cxx-reinterpret-cast-expr.cxx
@@ -0,0 +1,14 @@
+class C
+{
+public:
+    int getValue() const
+    {
+        return 0;
+    }
+};
+
+int main()
+{
+    void* pC = new C();
+    reinterpret_cast<const C*>(pC)->getValue();
+}
diff --git a/clang/qa/data/rename-cxx-reinterpret-cast-expr.cxx.expected b/clang/qa/data/rename-cxx-reinterpret-cast-expr.cxx.expected
new file mode 100644
index 0000000..f0510c3
--- /dev/null
+++ b/clang/qa/data/rename-cxx-reinterpret-cast-expr.cxx.expected
@@ -0,0 +1,14 @@
+class D
+{
+public:
+    int getValue() const
+    {
+        return 0;
+    }
+};
+
+int main()
+{
+    void* pC = new D();
+    reinterpret_cast<const D*>(pC)->getValue();
+}
diff --git a/clang/qa/test-rename.sh b/clang/qa/test-rename.sh
index c18fd0a..2814974 100755
--- a/clang/qa/test-rename.sh
+++ b/clang/qa/test-rename.sh
@@ -99,6 +99,14 @@ declare_rename_test "testCXXDynamicCastExpr" "rename-cxx-dynamic-cast-expr.cxx"
 bin/rename -old-name=C -new-name=D $test_input --
 test_assert_equal $test_expected $test_output
 
+declare_rename_test "testCXXReinterpretCastExpr" "rename-cxx-reinterpret-cast-expr.cxx"
+bin/rename -old-name=C -new-name=D $test_input --
+test_assert_equal $test_expected $test_output
+
+declare_rename_test "testCXXConstCastExpr" "rename-cxx-const-cast-expr.cxx"
+bin/rename -old-name=C -new-name=D $test_input --
+test_assert_equal $test_expected $test_output
+
 declare_rename_test "testCXXDestructorDecl" "rename-cxx-destructor-decl.cxx"
 bin/rename -old-name=C -new-name=D $test_input --
 test_assert_equal $test_expected $test_output
diff --git a/clang/rename.cxx b/clang/rename.cxx
index 329aacd..e661fb7 100644
--- a/clang/rename.cxx
+++ b/clang/rename.cxx
@@ -295,6 +295,16 @@ public:
     {
         return handleCXXNamedCastExpr(pExpr);
     }
+
+    bool VisitCXXReinterpretCastExpr(clang::CXXReinterpretCastExpr* pExpr)
+    {
+        return handleCXXNamedCastExpr(pExpr);
+    }
+
+    bool VisitCXXConstCastExpr(clang::CXXConstCastExpr* pExpr)
+    {
+        return handleCXXNamedCastExpr(pExpr);
+    }
 };
 
 class RenameASTConsumer : public clang::ASTConsumer


More information about the Libreoffice-commits mailing list