This is an archive of the discontinued LLVM Phabricator instance.

[clang] Do not consider the template arguments of bases to be bases themselves
ClosedPublic

Authored by nridge on Aug 23 2020, 7:15 PM.

Diff Detail

Event Timeline

nridge created this revision.Aug 23 2020, 7:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2020, 7:15 PM
nridge requested review of this revision.Aug 23 2020, 7:15 PM
nridge updated this revision to Diff 287291.Aug 23 2020, 8:37 PM

Fix a typo

hokein added inline comments.Aug 24 2020, 6:52 AM
clang/lib/Index/IndexTypeSourceInfo.cpp
168

nit: this could be simplified by calling the base::TraverseTemplateSpecializationTypeLoc

clang/unittests/Index/IndexTests.cpp
337

nit: I think we need a test in clang, clang/test/Index/Core/index-source.cpp.

nridge added inline comments.Aug 24 2020, 8:28 AM
clang/lib/Index/IndexTypeSourceInfo.cpp
168

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.

hokein added inline comments.Aug 24 2020, 11:49 PM
clang/lib/Index/IndexTypeSourceInfo.cpp
168

you're right. I misthought the above 4 lines are exactly the same as the one in RAV.

175

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.

nridge updated this revision to Diff 288881.Aug 30 2020, 6:11 PM
nridge marked 4 inline comments as done.

Address review comments

nridge edited the summary of this revision. (Show Details)Aug 31 2020, 1:05 AM
hokein accepted this revision.Sep 1 2020, 7:36 AM
This revision is now accepted and ready to land.Sep 1 2020, 7:36 AM