[PATCH] D51311: (WIP) Type hierarchy

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 27 20:22:22 PDT 2018

kadircet added inline comments.

Comment at: clangd/Protocol.h:889
+  // Does this node implement the method targeted by the request?
+  bool DeclaresMethod;
I think comment and the name is in contradiction here, do you mean DefinesMethod?

Comment at: clangd/XRefs.cpp:669
+                          const CXXMethodDecl *Candidate) {
+  // FIXME: How do I determine if Method overrides Candidate?

you can check this sample, which simply traverses all base classes and gets methods with the same name, then checks whether one is overload of the other. If it they are not overloads then one in the base classes gets overriden by the other.

Another approach could be to search for one method in others overriden_methods.

But they are both inefficient, I would suggest calling these functions only when one of them is defined in the base class of other then you can just check for name equality and not being an overload.

Comment at: clangd/XRefs.cpp:693
+    std::cerr << " >>> A parent is " << ParentDecl->getName().str()
+              << std::endl;
If you plan to keep it for later debugging info, consider using {d,v}log

Comment at: unittests/clangd/XRefsTests.cpp:1075
+$ParentDef^struct Parent
+  int a;
NIT: Maybe format test code as well.

  rCTE Clang Tools Extra


More information about the cfe-commits mailing list