Skip to content

Conversation

awruef
Copy link
Collaborator

@awruef awruef commented Sep 9, 2016

  • Only de-sugar typedefs if the immediate value is a pointer value, and then, only perform one "step" of de-sugaring. This reduces cases where wchar_t gets re-written as unsigned short but there is still a more elegant fix waiting to be implemented.
  • Started adding documentation
  • Fixed a bug where we would only ever constrain the top-most constraint variable in a Decl. Added test cases.
  • Constrain compound assignment of pointers via +=.


NewTyp *NT = NewTyp::mkTypForConstrainedType(J, K, Info, &Context);
rewriteThese.insert(NT);
if(NT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a space.

Andrew Ruef added 2 commits September 9, 2016 14:13
@dtarditi
Copy link
Member

dtarditi commented Sep 9, 2016

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.

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: if -> is

@dtarditi
Copy link
Member

dtarditi commented Sep 9, 2016

LGTM.

@awruef
Copy link
Collaborator Author

awruef commented Sep 9, 2016

I opened issues #48 and #49.

@awruef awruef merged commit 9f2a3d0 into master Sep 9, 2016
@awruef awruef deleted the awr_15 branch September 9, 2016 22:30
dopelsunce pushed a commit to dopelsunce/checkedc-clang that referenced this pull request Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants