[cfe-dev] Getting the unique ID for a clang::Decl
Mikhail Ramalho via cfe-dev
cfe-dev at lists.llvm.org
Fri Aug 12 15:29:54 PDT 2016
+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_cast<std::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.
2016-08-12 17:29 GMT+01:00 Raboudi Amel via cfe-dev <cfe-dev at lists.llvm.org>
> Hi All,
> I am using clang C++ API's to parse a source code and then generates its
> I need for that to find a way to uniquely identify my AST declarations.
> refering to this Doxygen Documentation: http://clang.llvm.org/
> the getGlobalID() function must do the task, but, it returns nothing.
> Can anyone helps me to find this unique ID in clang's C++ APIs?
> Thank you !
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev