-
Notifications
You must be signed in to change notification settings - Fork 79
Statistics printing and typedef changes #47
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
Conversation
pointers that use typedefed structures.
…y to only consider the outer-most constraint variable for the Decl. That is not the case though.
…on't need to tear them apart for pointers.
|
||
NewTyp *NT = NewTyp::mkTypForConstrainedType(J, K, Info, &Context); | ||
rewriteThese.insert(NT); | ||
if(NT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a space.
infrastructure should be replaced with a visitor.
I found it hard to understand the invariant for what NewTyp::mkTypForConstrainedType is computing. It is rewriting pointer types and rewriting typedefs that are pointer types. It is leaving other types and other typedefs along. This takes care of not desugaring typedefs involving other types (such as typedefs to structs or primitive types). Could you add a comment describing this? I think that loop in MkTypForConstrainedType needs to be rewritten to walk over types structurally at a finer-grain and create structurally analogous NewTyp's. The use of desugaring causes it to lose type qualifiers and parenthesize for example. Could you file a GitHub issue for this? Could you also file a GitHub issue for revisiting the handling of typedefs involving pointers to types. In the case where all uses of the typedef'ed type can be rewritten to the same Checked C type, we should rewrite the typedef. There are a few choices when different uses would end up with different type. We could do nothing (which would be very conservative), create multiple type-defs (better if there are only a few), or desugar occurrences where types differ. |
tools/checked-c-convert/NewTyp.cpp
Outdated
while (!TL.isNull()) { | ||
// What should the current type be qualified as? This can be answered by | ||
// looking the constraint up for the current variable. | ||
// We step through each level of the type. If the type if a pointer type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: if -> is
LGTM. |
wchar_t
gets re-written asunsigned short
but there is still a more elegant fix waiting to be implemented.+=
.