This patch adds a unit test demonstrating an error in Objective-C method declaration enumeration that occurs when an AST is deserialized from an .ast file.
A few notes about the unit test:
- The patch was produced based on r234313.
- This adds a new unittests/Serialization directory and unit test to exercise AST matching on an AST that has been serialized and deserialized.
- I'm not proficient with the AST matchers. There may be a better way to handle this. I added a declarationCountIs() AST matcher at one point, but I lacked convenient infrastructure like that available in unittests/ASTMatchers to validate the matches.
- This adds an additional parameter with default argument to buildASTFromCode() and buildASTFromCodeWithArgs() that is used to indicate whether the code should be serialized and deserialized prior to returning the AST.
The test currently fails, but without going into an infinite loop (iteration is terminated if more than the expected number of declarations are enumerated). Passing 'true' for 'Reserialize' to buildASTFromCode() in the new test suffices to make the test pass, thus demonstrating that the issue is related to AST serialization and deserialization.
I don't think this is the right choice.
It seems like we could provide two functions serialize and deserialize so that Reserialize=true becomes
deserialize(serialize(buildASTFromCode(...))
?