[PATCH] D86424: [clang] Do not consider the template arguments of bases to be bases themselves

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 24 23:49:35 PDT 2020


hokein added inline comments.


================
Comment at: clang/lib/Index/IndexTypeSourceInfo.cpp:167
+    if (!TraverseTemplateName(TL.getTypePtr()->getTemplateName()))
+      return false;
+
----------------
nridge wrote:
> hokein wrote:
> > nit: this could be simplified by calling the `base::TraverseTemplateSpecializationTypeLoc`
> I don't see how, given that `WalkUpFromTemplateSpecializationTypeLoc()`needs to be called with `Relations` containing `RelationIsBaseOf`, while `TraverseTemplateArgumentLoc()` needs to be called with `Relations` empty.
you're right. I misthought the above 4 lines are exactly the same as the one in RAV.




================
Comment at: clang/lib/Index/IndexTypeSourceInfo.cpp:174
+    for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
+      if (!TraverseTemplateArgumentLoc(TL.getArgLoc(I)))
+        return false;
----------------
if something bad happens (TraverseTemplateArgumentLoc returns false), we will not restore the Relations, I think we need a RAII pattern (`llvm::make_scope_exit`) to restore the `Relations`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86424/new/

https://reviews.llvm.org/D86424



More information about the cfe-commits mailing list