22
22
#include " clang/AST/TypeLocVisitor.h"
23
23
#include " clang/Basic/SourceLocation.h"
24
24
#include " clang/Basic/Specifiers.h"
25
+ #include " llvm/ADT/SmallVector.h"
25
26
#include " llvm/Support/ErrorHandling.h"
26
27
#include " llvm/Support/MathExtras.h"
27
28
#include < algorithm>
@@ -652,9 +653,9 @@ static ConceptReference *createTrivialConceptReference(ASTContext &Context,
652
653
DeclarationNameInfo (AT->getTypeConstraintConcept ()->getDeclName (), Loc,
653
654
AT->getTypeConstraintConcept ()->getDeclName ());
654
655
unsigned size = AT->getTypeConstraintArguments ().size ();
655
- TemplateArgumentLocInfo *TALI = new TemplateArgumentLocInfo[ size] ;
656
+ llvm::SmallVector< TemplateArgumentLocInfo, 8 > TALI ( size) ;
656
657
TemplateSpecializationTypeLoc::initializeArgLocs (
657
- Context, AT->getTypeConstraintArguments (), TALI, Loc);
658
+ Context, AT->getTypeConstraintArguments (), TALI. data () , Loc);
658
659
TemplateArgumentListInfo TAListI;
659
660
for (unsigned i = 0 ; i < size; ++i) {
660
661
TAListI.addArgument (
@@ -666,7 +667,6 @@ static ConceptReference *createTrivialConceptReference(ASTContext &Context,
666
667
Context, NestedNameSpecifierLoc{}, Loc, DNI, nullptr ,
667
668
AT->getTypeConstraintConcept (),
668
669
ASTTemplateArgumentListInfo::Create (Context, TAListI));
669
- delete[] TALI;
670
670
return ConceptRef;
671
671
}
672
672
0 commit comments