Skip to content

Commit 9bde41a

Browse files
authored
Merge pull request #32066 from compnerd/small-change-for-small-vector
runtime: further isolate runtime from LLVMSupport
2 parents ff3eca4 + c050a26 commit 9bde41a

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

include/swift/Basic/LLVM.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ namespace llvm {
3636
template <typename T, unsigned N> class SmallPtrSet;
3737
#if !defined(swiftCore_EXPORTS)
3838
template <typename T> class SmallVectorImpl;
39-
#endif
4039
template <typename T, unsigned N> class SmallVector;
40+
#endif
4141
template <unsigned N> class SmallString;
4242
template <typename T, unsigned N> class SmallSetVector;
4343
#if !defined(swiftCore_EXPORTS)
@@ -86,8 +86,8 @@ namespace swift {
8686
using llvm::SmallPtrSetImpl;
8787
using llvm::SmallSetVector;
8888
using llvm::SmallString;
89-
using llvm::SmallVector;
9089
#if !defined(swiftCore_EXPORTS)
90+
using llvm::SmallVector;
9191
using llvm::SmallVectorImpl;
9292
#endif
9393
using llvm::StringLiteral;

include/swift/Demangling/TypeDecoder.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class TypeDecoder {
361361
if (Node->getNumChildren() < 2)
362362
return BuiltType();
363363

364-
SmallVector<BuiltType, 8> args;
364+
llvm::SmallVector<BuiltType, 8> args;
365365

366366
const auto &genericArgs = Node->getChild(1);
367367
if (genericArgs->getKind() != NodeKind::TypeList)
@@ -474,7 +474,7 @@ class TypeDecoder {
474474
return BuiltType();
475475

476476
// Find the protocol list.
477-
SmallVector<BuiltProtocolDecl, 8> Protocols;
477+
llvm::SmallVector<BuiltProtocolDecl, 8> Protocols;
478478
auto TypeList = Node->getChild(0);
479479
if (TypeList->getKind() == NodeKind::ProtocolList &&
480480
TypeList->getNumChildren() >= 1) {
@@ -576,7 +576,7 @@ class TypeDecoder {
576576
return BuiltType();
577577

578578
bool hasParamFlags = false;
579-
SmallVector<FunctionParam<BuiltType>, 8> parameters;
579+
llvm::SmallVector<FunctionParam<BuiltType>, 8> parameters;
580580
if (!decodeMangledFunctionInputType(Node->getChild(isThrow ? 1 : 0),
581581
parameters, hasParamFlags))
582582
return BuiltType();
@@ -598,9 +598,9 @@ class TypeDecoder {
598598
}
599599
case NodeKind::ImplFunctionType: {
600600
auto calleeConvention = ImplParameterConvention::Direct_Unowned;
601-
SmallVector<ImplFunctionParam<BuiltType>, 8> parameters;
602-
SmallVector<ImplFunctionResult<BuiltType>, 8> results;
603-
SmallVector<ImplFunctionResult<BuiltType>, 8> errorResults;
601+
llvm::SmallVector<ImplFunctionParam<BuiltType>, 8> parameters;
602+
llvm::SmallVector<ImplFunctionResult<BuiltType>, 8> results;
603+
llvm::SmallVector<ImplFunctionResult<BuiltType>, 8> errorResults;
604604
ImplFunctionTypeFlags flags;
605605

606606
for (unsigned i = 0; i < Node->getNumChildren(); i++) {
@@ -684,7 +684,7 @@ class TypeDecoder {
684684
return decodeMangledType(Node->getChild(0));
685685

686686
case NodeKind::Tuple: {
687-
SmallVector<BuiltType, 8> elements;
687+
llvm::SmallVector<BuiltType, 8> elements;
688688
std::string labels;
689689
bool variadic = false;
690690
for (auto &element : *Node) {

stdlib/public/Reflection/TypeRef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ class DemanglingForTypeRef
491491
break;
492492
}
493493

494-
SmallVector<std::pair<NodePointer, bool>, 8> inputs;
494+
llvm::SmallVector<std::pair<NodePointer, bool>, 8> inputs;
495495
for (const auto &param : F->getParameters()) {
496496
auto flags = param.getFlags();
497497
auto input = visit(param.getType());

stdlib/public/runtime/Demangle.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ swift::_buildDemanglingForContext(const ContextDescriptor *context,
3434
NodePointer node = nullptr;
3535

3636
// Walk up the context tree.
37-
SmallVector<const ContextDescriptor *, 8> descriptorPath;
37+
llvm::SmallVector<const ContextDescriptor *, 8> descriptorPath;
3838
{
3939
const ContextDescriptor *parent = context;
4040
while (parent) {
@@ -285,11 +285,11 @@ _buildDemanglingForNominalType(const Metadata *type, Demangle::Demangler &Dem) {
285285

286286
// Gather the complete set of generic arguments that must be written to
287287
// form this type.
288-
SmallVector<const Metadata *, 8> allGenericArgs;
288+
llvm::SmallVector<const Metadata *, 8> allGenericArgs;
289289
gatherWrittenGenericArgs(type, description, allGenericArgs, Dem);
290290

291291
// Demangle the generic arguments.
292-
SmallVector<NodePointer, 8> demangledGenerics;
292+
llvm::SmallVector<NodePointer, 8> demangledGenerics;
293293
for (auto genericArg : allGenericArgs) {
294294
// When there is no generic argument, put in a placeholder.
295295
if (!genericArg) {
@@ -470,7 +470,7 @@ swift::_swift_buildDemanglingForMetadata(const Metadata *type,
470470
break;
471471
}
472472

473-
SmallVector<std::pair<NodePointer, bool>, 8> inputs;
473+
llvm::SmallVector<std::pair<NodePointer, bool>, 8> inputs;
474474
for (unsigned i = 0, e = func->getNumParameters(); i < e; ++i) {
475475
auto param = func->getParameter(i);
476476
auto flags = func->getParameterFlags(i);

stdlib/public/runtime/MetadataLookup.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -988,8 +988,8 @@ _gatherGenericParameters(const ContextDescriptor *context,
988988
// requirements and fill in the generic arguments vector.
989989
if (!genericParamCounts.empty()) {
990990
// Compute the set of generic arguments "as written".
991-
SmallVector<const Metadata *, 8> allGenericArgs;
992-
991+
llvm::SmallVector<const Metadata *, 8> allGenericArgs;
992+
993993
// If we have a parent, gather it's generic arguments "as written".
994994
if (parent) {
995995
gatherWrittenGenericArgs(parent, parent->getTypeContextDescriptor(),
@@ -1183,16 +1183,16 @@ class DecodedMetadataBuilder {
11831183
if (!descriptor)
11841184
return BuiltType();
11851185
auto outerContext = descriptor->Parent.get();
1186-
1187-
SmallVector<BuiltType, 8> allGenericArgs;
1186+
1187+
llvm::SmallVector<BuiltType, 8> allGenericArgs;
11881188
for (auto argSet : genericArgs) {
11891189
allGenericArgs.append(argSet.begin(), argSet.end());
11901190
}
11911191

11921192
// Gather the generic parameters we need to parameterize the opaque decl.
1193-
SmallVector<unsigned, 8> genericParamCounts;
1194-
SmallVector<const void *, 8> allGenericArgsVec;
1195-
1193+
llvm::SmallVector<unsigned, 8> genericParamCounts;
1194+
llvm::SmallVector<const void *, 8> allGenericArgsVec;
1195+
11961196
if (!_gatherGenericParameters(outerContext,
11971197
allGenericArgs,
11981198
BuiltType(), /* no parent */
@@ -1291,8 +1291,8 @@ class DecodedMetadataBuilder {
12911291

12921292
// Figure out the various levels of generic parameters we have in
12931293
// this type.
1294-
SmallVector<unsigned, 8> genericParamCounts;
1295-
SmallVector<const void *, 8> allGenericArgsVec;
1294+
llvm::SmallVector<unsigned, 8> genericParamCounts;
1295+
llvm::SmallVector<const void *, 8> allGenericArgsVec;
12961296

12971297
if (!_gatherGenericParameters(typeDecl,
12981298
genericArgs,
@@ -1366,8 +1366,8 @@ class DecodedMetadataBuilder {
13661366
BuiltType
13671367
createFunctionType(llvm::ArrayRef<Demangle::FunctionParam<BuiltType>> params,
13681368
BuiltType result, FunctionTypeFlags flags) const {
1369-
SmallVector<BuiltType, 8> paramTypes;
1370-
SmallVector<uint32_t, 8> paramFlags;
1369+
llvm::SmallVector<BuiltType, 8> paramTypes;
1370+
llvm::SmallVector<uint32_t, 8> paramFlags;
13711371

13721372
// Fill in the parameters.
13731373
paramTypes.reserve(params.size());
@@ -2032,7 +2032,7 @@ void swift::gatherWrittenGenericArgs(
20322032
// canonicalized away. Use same-type requirements to reconstitute them.
20332033

20342034
// Retrieve the mapping information needed for depth/index -> flat index.
2035-
SmallVector<unsigned, 8> genericParamCounts;
2035+
llvm::SmallVector<unsigned, 8> genericParamCounts;
20362036
(void)_gatherGenericParameterCounts(description, genericParamCounts,
20372037
BorrowFrom);
20382038

stdlib/public/runtime/ProtocolConformance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ template<>
162162
const WitnessTable *
163163
ProtocolConformanceDescriptor::getWitnessTable(const Metadata *type) const {
164164
// If needed, check the conditional requirements.
165-
SmallVector<const void *, 8> conditionalArgs;
165+
llvm::SmallVector<const void *, 8> conditionalArgs;
166166
if (hasConditionalRequirements()) {
167167
SubstGenericParametersFromMetadata substitutions(type);
168168
bool failed =

0 commit comments

Comments
 (0)