[PATCH] D21675: New ODR checker for modules

Richard Trieu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 29 16:49:32 PST 2016


rtrieu updated this revision to Diff 82702.
rtrieu added a comment.
Herald added a subscriber: mgorny.

This is a redesign of the ODR checker which was discovered to have several shortcomings when run over test cases.  The old version mainly used depth-first processing of AST nodes to gather the information to be hashed.  In some instances, a recursive loop developed preventing the termination of the hashing function.

This version of the ODR checker will queue Type and Decl pointers into a vector.  When the hashing function needs to refer to the pointers, it will use the index of the pointers' location in the vector instead.  After any in progress hashing is finished, unprocessed pointers in the vector will be processed.  Other AST nodes, such as Stmt's and TemplateArgument's are processed when received.

The design change also necessitated creation of an ODRHash class to manage the queued nodes.  This is in ODRHash.{cpp,h} and most of the hashing logic is also moved into those files.  Only the hashing for Stmt is left in StmtProfile.h since it shares code with Stmt::Profile.


https://reviews.llvm.org/D21675

Files:
  include/clang/AST/DeclCXX.h
  include/clang/AST/ODRHash.h
  include/clang/AST/Stmt.h
  include/clang/Basic/DiagnosticSerializationKinds.td
  lib/AST/CMakeLists.txt
  lib/AST/DeclCXX.cpp
  lib/AST/ODRHash.cpp
  lib/AST/StmtProfile.cpp
  lib/Sema/SemaDecl.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  test/Modules/merge-using-decls.cpp
  test/Modules/odr_hash.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21675.82702.patch
Type: text/x-patch
Size: 103991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161230/4677e143/attachment-0001.bin>


More information about the cfe-commits mailing list