swift-api-digester: initialize vector with a reasonable capacity.

In Jenkins bot, we've seen "exception std::length_error: vector" for
api-digester tests. Tentatively, this patch initializes a major vector with a
reasonably large size, which may avoid its wild capacity growth.
This commit is contained in:
Xi Ge
2016-12-09 16:44:30 -08:00
parent bf1af19a83
commit e6dcd443eb
3 changed files with 2 additions and 2 deletions

View File

@@ -166,10 +166,12 @@ typedef std::map<NodePtr, NodePtr> ParentMap;
typedef std::vector<NodePtr> NodeVector;
class SDKContext {
unsigned SIZE = 1024 * 1024;
llvm::StringSet<> TextData;
std::vector<std::unique_ptr<SDKNode>> OwnedNodes;
public:
SDKContext() : OwnedNodes(SIZE) {}
SDKNode* own(SDKNode *Node) {
assert(Node);
OwnedNodes.emplace_back(Node);