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

Re-visit re-writing variable declarations with a typedefed type #49

Closed
secure-sw-dev-bot opened this issue Jan 16, 2022 · 1 comment
Closed
Labels

Comments

@secure-sw-dev-bot
Copy link

This issue was copied from checkedc/checkedc-clang#49


Let's say you have a typedef that looks like this:

typedef struct _A { 
  int a;
  int b;
} A, *PA;

There are two variable declarations somewhere in the program:

PA p1 = foo();

and

PA p2 = bar(); 

In one scenario, both foo and bar are unconstrained and can be PTR. The re-writer could make one edit, in the typedef, to change the definition of PA to be ptr<struct _A> PA. Then this will just work.

However, let's say that the return value of foo is PTR but bar is constrained to not PTR. So one of these will be re-written to ptr and another won't. Can we do better? One option is to create a new typedef, but there are questions to be answered. What is this typedef called? How do we disambiguate it from the old one? And so on.

Come up with a spectrum of answers to this question and implement them.

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

No branches or pull requests

1 participant