Skip to content

Add AST Serialization/Deserialization Tests #102

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

Merged
merged 6 commits into from
Jan 12, 2017
Merged

Conversation

lenary
Copy link
Collaborator

@lenary lenary commented Jan 12, 2017

This is making sure that we don't break pre-compiled headers at any point.

Not only do we include new PCH tests, but in order to get them to pass, I had to fix the following bugs:

  • One of the initializers of PositionalParameterExpr (specifically the Empty one) had a copy/paste bug, which meant it was initializing the wrong kind of expression.
  • We were not writing the sub-expressions within bounds expressions correctly. Now they are written in the same way that the visitor writes other sub-expressions of other expression types.
  • We were not saving the "type as written" information for the InteropTypeBoundsAnnotationExpr, which meant that we couldn't deserialize it. It is now saved and re-read correctly.

The test compiles a header and source file together, then tests compiling the header separately into a PCH, and then compiling the source file using the PCH. They should have the same set of errors. We use -verify and diagnostic annotations as tests. Currently we ignore diagnostic notes, as there seems to be an issue with putting expectations in the header to be compiled into the PCH.

Currently most of the tests are testing that everything works, rather than testing that certain things fail. This could be improved later.

This should help us with #3.

@msftclas
Copy link

Hi @lenary, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Samuel Hemsley Elliott). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

Copy link
Member

@dtarditi dtarditi left a comment

Choose a reason for hiding this comment

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

The changes look good and are approved for commit, with one requested change. Please modify the comments for pch.c to describe the purpose of the test (something along the lines of "This file tests pre-compiled headers that use the Checked C extension.").

As a follow up item, could you add additional tests for Ptr types, function pointer types, checked arrays, and structures with checked members that have bounds declarations? I would like to test that those types are serialized properly.

@lenary lenary merged commit ee83760 into checkedc:master Jan 12, 2017
@lenary lenary deleted the issue3 branch February 10, 2017 22:00
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