csmith-project / creduce

C-Reduce, a C and C++ program reducer
Other
1.47k stars 128 forks source link

[clang_delta] Fix offset in RemoveBaseClass pass #263

Closed mpflanzer closed 1 year ago

mpflanzer commented 1 year ago

Without the fix the opening brace of the base class's definition was copied to the derived class together with it's declarations. This resulted in invalid code. For instance

class B {
  int a;
};

class D : B {
  int c;
};

got transformed into

class D  {
  int c;
{
  int a;};

With the changes the result is

class D  {
  int c;

  int a;};

The same changes has also been made for C-Vise: https://github.com/marxin/cvise/blame/9f237d6619f08e85784e5356869f48f81678815f/clang_delta/RemoveBaseClass.cpp#L190

chenyang78 commented 1 year ago

LGTM. Thanks, @mpflanzer !