+1 to that.
Sometime ago, I tried to get an unique ID generated by clang but couldn’t find any .get_whatever() to solve the problem.
I ended up using the pointer’s address as an ID, as it seems to be unique.
const clang::TagDecl &tag;
std::size_t address = reinterpret_caststd::size_t(tag.getFirstDecl());
It’s basically the same code for all decls. I use getFirstDecl to avoid having different IDs for the same decl.
If there is a better way to do that, I would like to know too.