@@ -127,7 +127,7 @@ MlirAttribute mlirLLVMDIExpressionElemAttrGet(MlirContext ctx,
127
127
128
128
MlirAttribute mlirLLVMDIExpressionAttrGet (MlirContext ctx, intptr_t nOperations,
129
129
MlirAttribute const *operations) {
130
- SmallVector<Attribute, 2 > attrStorage;
130
+ SmallVector<Attribute> attrStorage;
131
131
attrStorage.reserve (nOperations);
132
132
133
133
return wrap (DIExpressionAttr::get (
@@ -154,24 +154,16 @@ MlirAttribute mlirLLVMDICompositeTypeAttrGet(
154
154
uint32_t line, MlirAttribute scope, MlirAttribute baseType, int64_t flags,
155
155
uint64_t sizeInBits, uint64_t alignInBits, intptr_t nElements,
156
156
MlirAttribute const *elements) {
157
- SmallVector<Attribute, 2 > elementsStorage;
157
+ SmallVector<Attribute> elementsStorage;
158
158
elementsStorage.reserve (nElements);
159
159
160
- ArrayRef<Attribute> tempList =
161
- unwrapList (nElements, elements, elementsStorage);
162
-
163
- SmallVector<DINodeAttr, 2 > diNodesStorage;
164
- diNodesStorage.reserve (tempList.size ());
165
-
166
- for (auto attr : tempList) {
167
- diNodesStorage.push_back (attr.cast <DINodeAttr>());
168
- }
169
-
170
160
return wrap (DICompositeTypeAttr::get (
171
161
unwrap (ctx), tag, cast<StringAttr>(unwrap (name)),
172
162
cast<DIFileAttr>(unwrap (file)), line, cast<DIScopeAttr>(unwrap (scope)),
173
163
cast<DITypeAttr>(unwrap (baseType)), DIFlags (flags), sizeInBits,
174
- alignInBits, diNodesStorage));
164
+ alignInBits,
165
+ llvm::map_to_vector (unwrapList (nElements, elements, elementsStorage),
166
+ [](Attribute a) { return a.cast <DINodeAttr>(); })));
175
167
}
176
168
177
169
MlirAttribute mlirLLVMDIDerivedTypeAttrGet (MlirContext ctx, unsigned int tag,
@@ -259,7 +251,7 @@ MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx,
259
251
unsigned int callingConvention,
260
252
intptr_t nTypes,
261
253
MlirAttribute const *types) {
262
- SmallVector<Attribute, 2 > attrStorage;
254
+ SmallVector<Attribute> attrStorage;
263
255
attrStorage.reserve (nTypes);
264
256
265
257
return wrap (DISubroutineTypeAttr::get (
0 commit comments