[Libreoffice-commits] dev-tools.git: 2 commits - clang/rename.cxx clang/test.hxx

Miklos Vajna vmiklos at collabora.co.uk
Fri Sep 4 08:32:43 PDT 2015


 clang/rename.cxx |    5 +++++
 clang/test.hxx   |    6 ++++++
 2 files changed, 11 insertions(+)

New commits:
commit 0a83feb268bd33e40c78cb050c2f33a06ef24fb0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Sep 4 17:28:11 2015 +0200

    clang rename: ignore implicit initializers
    
    Implicit initializers have no source code location, so the generated
    code was like:
    
    ----
    C::m_aA)
        : nX(0),
          nY(0),
          nZ(0),
          pX(0)
    {
    }
    ----

diff --git a/clang/rename.cxx b/clang/rename.cxx
index 6ca0823..0ef8886 100644
--- a/clang/rename.cxx
+++ b/clang/rename.cxx
@@ -92,6 +92,11 @@ public:
         for (clang::CXXConstructorDecl::init_const_iterator itInit = pDecl->init_begin(); itInit != pDecl->init_end(); ++itInit)
         {
             const clang::CXXCtorInitializer* pInitializer = *itInit;
+
+            // Ignore implicit initializers.
+            if (pInitializer->getSourceOrder() == -1)
+                continue;
+
             if (const clang::FieldDecl* pFieldDecl = pInitializer->getAnyMember())
             {
                 std::string aName = pFieldDecl->getQualifiedNameAsString();
commit 756180b87bf0827c3907e11cf1e8e574a89ba484
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Sep 4 17:27:48 2015 +0200

    clang rename: add implicit initializer testcase

diff --git a/clang/test.hxx b/clang/test.hxx
index 8f98f72..6b3d9c4 100644
--- a/clang/test.hxx
+++ b/clang/test.hxx
@@ -1,9 +1,15 @@
+class A
+{
+};
+
 class C
 {
 public:
     int nX, nY, nZ;
     int* pX;
     static const int aS[];
+    // This is intentionally not initialized explicitly in C::C().
+    A aA;
     C();
     ~C();
 


More information about the Libreoffice-commits mailing list