[NFC] Fix a mem-sanitizer found issue in AutoType
authorErich Keane <erich.keane@intel.com>
Fri, 28 Apr 2023 16:54:28 +0000 (09:54 -0700)
committerErich Keane <erich.keane@intel.com>
Fri, 28 Apr 2023 17:09:26 +0000 (10:09 -0700)
commit15f0491d3963d91202aef659acc20f59aa83fae7
treec596b72f2ed8840d392b759e0927f213d5797251
parent92b2a266e99066a085aa9c371efe9ea13b0755cd
[NFC] Fix a mem-sanitizer found issue in AutoType

We only need the list of constriant template arguments when we have a
valid constraint.  We give up on merging the auto-type constraints if
the template arguments don't match, but neglected to clear the
collection of template arguments.  The result was we had an AutoType
where we initialized the number of template arguments, but never
initialized the template arguments themselves.

This patch adds an assert to catch this in the future, plus ensures we
clear out the vector so we don't try to create the AutoType incorrectly.
clang/lib/AST/ASTContext.cpp
clang/lib/AST/Type.cpp