[cfe-dev] Looking for help on using clang

何宇轩 via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 11 06:06:24 PST 2022


Hi, I would like to use clang-tidy to analyze the inheritance relationship between classes defined in a c++ file. I was going to use
“it=CXXRecordDecl->bases_begin()---CXXRecordDecl->bases_end()
it->getBeginLoc().getRawEncoding()”
to solve the problem.
For example, for the graph below, I wanted to first get the location encoding of B, assuming it was b, and then when analyzing D, get the base location encoding of D which is also the location encoding of B, d. I originally thought that b==d,so I can identify a relation between B and D, however, this was not the case. So I would like to know if there is any other way that I can establish a relationship with its parent class when I get the cxxRecordDecl of D.

thank you very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20220111/48eef8ce/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2D37415F at F6290601.E08EDD61.png.jpg
Type: image/jpeg
Size: 5417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20220111/48eef8ce/attachment-0001.jpg>


More information about the cfe-dev mailing list