Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363244 - Generate Getters and Setters expands macro with typedef and breaks formatting
Summary: Generate Getters and Setters expands macro with typedef and breaks formatting
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: 8.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.1.0   Edit
Assignee: Sergey Prigogin CLA
QA Contact: Sergey Prigogin CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-08 19:36 EST by Marc-André Laperle CLA
Modified: 2012-02-23 11:33 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc-André Laperle CLA 2011-11-08 19:36:55 EST
Using CDT 8.1.0.201111072207

Example:

#define Typedef \
    typedef int Int

class Test
{
public:
    Typedef;

    void     Foo();
    Test();

    int test;
};


Use Generate Getters and Setters on 'test' field. Result: formatting changes
and 'Typedef;' is expanded to 'typedef intTypedef'.
Comment 1 Sergey Prigogin CLA 2011-12-13 22:47:46 EST
The issue was fixed by minimizing areas of code affected by the refactoring changes. This minimization had a huge ripple effect.
Comment 2 CDT Genie CLA 2011-12-13 23:23:02 EST
*** cdt git genie on behalf of Sergey Prigogin ***

    Bug 363244 - Generate Getters and Setters expands macro with typedef and
    breaks formatting. The bug was fixed by minimizing areas of code
    affected by the refactoring changes. This minimization had a huge ripple
    effect.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=c521604dd1dde08dfd55e8e08fae1de4ad6a2e21
Comment 3 Marc-André Laperle CLA 2011-12-21 02:32:49 EST
Thank you. With this change, I can finally use Generate Getters and Setters in my code base! I saw a case of a method definition being reformatted just below where a declaration was inserted but I didn't take note of where and now can't reproduce it. I'll open a new bug if I can get it to happen again.
Comment 4 Sergey Prigogin CLA 2011-12-22 23:00:56 EST
(In reply to comment #3)
> I saw a case of a method definition being reformatted just below
> where a declaration was inserted but I didn't take note of where and now can't
> reproduce it.

I've found and fixed the bug that was causing this.
Comment 5 Marc-André Laperle CLA 2011-12-23 00:49:52 EST
(In reply to comment #4)
> (In reply to comment #3)
> > I saw a case of a method definition being reformatted just below
> > where a declaration was inserted but I didn't take note of where and now can't
> > reproduce it.
> 
> I've found and fixed the bug that was causing this.

Thanks. Do you have a test case locally for this? I'd like to confirm that it was something similar to what I was seeing in my code base.
Comment 6 Sergey Prigogin CLA 2011-12-23 14:16:54 EST
(In reply to comment #5)
> Thanks. Do you have a test case locally for this? I'd like to confirm that it
> was something similar to what I was seeing in my code base.

I saw it in a situation like:

test.h
------
namespace ns {

class A {
public:
  void m();
  int getX() const { return x; }

private:
  int x;
};

}

test.cc
-------
#include "test.h"

namespace ns {

void A::m() {
}

}

Generate setter with implementation in the test.cc.
Comment 7 Sergey Prigogin CLA 2011-12-23 14:18:45 EST
(In reply to comment #5)

Forgot to mention that you also need some arbitrary code after the closing namespace brace in test.cc.