Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do you handle access specifier? #50

Open
marehr opened this issue Mar 15, 2021 · 3 comments
Open

Do you handle access specifier? #50

marehr opened this issue Mar 15, 2021 · 3 comments

Comments

@marehr
Copy link

marehr commented Mar 15, 2021

I see in reductions that code like

class test : private bar
{
public:
  statement1;
  statement2;
};

will often be collapsed to

class test : private bar
{
public: statement1;
statement2;
};

The problem is that the statement1 line could be removed, but will trigger a build error because statement2 isn't accessible any more.

I would expect that all access specifier will be removed at a pretty early stage as they most often shouldn't matter.

That means class should be replaced by struct and any access specifier should be removed from a class.

/*class*/ struct test : /*private*/ public bar
{
/*public:*/ statement1;
statement2;
};
@marxin
Copy link
Owner

marxin commented Mar 15, 2021

Thank you for the report.
I'm pretty sure there are passes that remove tokens (or group of tokens) and these should handle the removal of public:.
About the replacement of class with struct, that's really not supported. I see it as a minor enhancement.

@marehr
Copy link
Author

marehr commented Mar 24, 2021

Interesting this is a transformation that I quite often have to do manually and is at least in our code basis (declaring non-pod types as class as described in the google style guide) a pretty common occurrence.

It is true that the token reduction step will remove those tokens eventually, but only if it has no "effect" on the "visibility". If a public: token is removed, it will most certainly change the visibility in our code basis and in the end will not be removed.

I also have some other common problems with C++20 and concepts where cvise is stuck at some point. But, if those things are only minor enhancement, I'm not sure if you are interested in them. I just wanted to let you know, that it would help me greatly if those steps would be automatic, too. As I pretty regularly use cvise :)

@marxin
Copy link
Owner

marxin commented Mar 24, 2021

Interesting this is a transformation that I quite often have to do manually and is at least in our code basis (declaring non-pod types as class as described in the google style guide) a pretty common occurrence.

It is true that the token reduction step will remove those tokens eventually, but only if it has no "effect" on the "visibility". If a public: token is removed, it will most certainly change the visibility in our code basis and in the end will not be removed.

All right, I can take a look at what can be done. I would appreciate an example of an interestingness test and a test-case for it.

I also have some other common problems with C++20 and concepts where cvise is stuck at some point. But, if those things are only minor enhancement, I'm not sure if you are interested in them.

I'm definitely interested in these issues. Please show me some examples where it's stuck.

I just wanted to let you know, that it would help me greatly if those steps would be automatic, too. As I pretty regularly use cvise :)

Appreciate that, I'm happy for daily users of the tool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants