This is an archive of the discontinued LLVM Phabricator instance.

Fix memleak in VarTemplateSpecializationDecl
AbandonedPublic

Authored by MitalAshok on Jun 2 2022, 7:18 PM.

Details

Summary

Replace TemplateArgumentListInfo with ASTTemplateArgumentListInfo
and convert between them in some places

Diff Detail

Event Timeline

MitalAshok created this revision.Jun 2 2022, 7:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2022, 7:18 PM
MitalAshok published this revision for review.Jun 2 2022, 7:28 PM
MitalAshok added a project: Restricted Project.

VarTemplateSpecializationDecl held a TemplateArgumentListInfo which holds a SmallVector<TemplateArgumentLoc, 8>, so in this test case https://github.com/llvm/llvm-project/blob/ee1cf1f64519c815025d962bdf9c9bb3d09d7699/clang/test/SemaCXX/has_unique_object_reps_bitint.cpp#L27 where there was a variable template with more than 8 template arguments, it leaked

Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2022, 7:28 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MitalAshok added inline comments.Jun 2 2022, 7:33 PM
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
5561

The type of VarSpec->getTemplateArgsInfo() changed to ASTTemplateArgumentListInfo which is why the type of VisitVarTemplateSpecializationDecl needed to change

MitalAshok planned changes to this revision.Jun 2 2022, 9:54 PM

Appears that more things need to be changed, I'll get that done soon

I was also looking into fixing this: https://reviews.llvm.org/D126944

I'm not yet sure if my changes are correct.

I was also looking into fixing this: https://reviews.llvm.org/D126944

I'm not yet sure if my changes are correct.

I did a review on https://reviews.llvm.org/D126944, but I'll let the two of you decide which review to move forward with rather than review them both in tandem. :-)

I was also looking into fixing this: https://reviews.llvm.org/D126944

I'm not yet sure if my changes are correct.

I did a review on https://reviews.llvm.org/D126944, but I'll let the two of you decide which review to move forward with rather than review them both in tandem. :-)

FYI, I've accepted that other review (we needed to get the leak fixed ASAP).

MitalAshok abandoned this revision.Jul 22 2023, 2:35 PM