[cfe-dev] [RFC] cHash: Integration of AST hashing

Christian Dietrich via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 1 08:32:59 PST 2017


Hi,

so I made some progress in integrating the CHash AST Hashing mechanism
into CLang: https://reviews.llvm.org/D40731
I cleaned up the mess in our repository and based the implementation on
StmtDataCollectors.


Christian Dietrich <dietrich at sra.uni-hannover.de> writes:

> As I see, you have done a lot of work on the StmtDataCollectors and used
> TableGen to generate the DataCollector. So my idea would be the following:
>
> - Extend the StmtDataCollectors.td to handle all possible nodes/types in
>   the clang AST. Invoking this operator once, we get the hash value for
>   one node.

Currently the change D40731 is still incomplete, but some important
parts were already implemented:

- I have extended the StmtDataCollectors.td file (and added tablegen
  files for Decl, Attr, Type).

- Provide a CHashVisitor, based on RecursiveASTVisitor, that captures
  our idea of a AST Hash (Semantic, stable across invocations).

- Make it all work with the cHash test suite.

- Start to add a (condensed) unit-test suite to validate CHashVisitor.
  Integrating the useful parts of our internal test suite here is still
  to be done.

> - Derive an recursive AST hashing visitor from RecursiveASTVisitor. This
>   recursive AST visitor then has our desired flags:
>
>   - semantic_hash vs syntactic_hash
>   - Hash mechanism as a template parameter
>   - Include debug flags

Including these flags for the CHashVisitor is still to be done.

At this point I would appreciate some comments on the current state of
the implementation. My next steps would be to integrate larger parts of
our test suite.

chris
-- 
Christian Dietrich, M.Sc. (Scientific Staff)
Institute for Systems Engineering (Systems and Computerarchitecture)
Leibniz Universität Hannover
Appelstraße 4
30167 Hannover, Germany

Tel:    +49 511 762-19737
Fax:    +49 511 762-19733
eMail:  dietrich at sra.uni-hannover.de
WWW:    https://www.sra.uni-hannover.de



More information about the cfe-dev mailing list