[PATCH] PR23175 (unit test) - Infinite loop iterating Objective-C method declarations in categories when the AST was deserialized from an .ast file

Tom Honermann thonermann at coverity.com
Mon Apr 20 13:59:33 PDT 2015


Hi klimek,

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:

1) The patch was produced based on r234313.
2) This adds a new unittests/Serialization directory and unit test to exercise AST matching on an AST that has been serialized and deserialized.
3) 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.
4) 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.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9126

Files:
  include/clang/ASTMatchers/ASTMatchers.h
  include/clang/Tooling/Tooling.h
  lib/Tooling/Tooling.cpp
  unittests/CMakeLists.txt
  unittests/Makefile
  unittests/Serialization/CMakeLists.txt
  unittests/Serialization/Makefile
  unittests/Serialization/Reserialization.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9126.24060.patch
Type: text/x-patch
Size: 9089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150420/d296027b/attachment.bin>


More information about the cfe-commits mailing list