[cfe-dev] Question about hashing AST nodes

Kevin Sullivan via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 29 13:49:00 PST 2019


Dear Clang Community:

A colleague and I need to use AST nodes as keys in a map. For example,
having entered a few variable declaration nodes as keys, linking to
associated meta-data, and now looking at a member function application
node, with the variables as arguments, we'd like to be able to query the
map to find the associated meta-data for those variable objects.

To this end, we need to implement hash and == for AST nodes. That's what's
needed, e.g., by the C++ unordered map class.

There's little available information as far as we can tell on this topic.
Would you be so kind as to let us know the best way to do this, in your
view? Is ODRHash the key to unlocking a solution? Are there other
approaches you'd recommend?

Kevin Sullivan
University of Virginia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190129/ee09eb28/attachment-0001.html>


More information about the cfe-dev mailing list