[NFC] Remove duplicate include
[llvm-project.git] / lld / Common / Memory.cpp
blob7c90ff1d799c841cdc7cb58e0029bcae81565d6f
1 //===- Memory.cpp ---------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "lld/Common/Memory.h"
10 #include "lld/Common/CommonLinkerContext.h"
12 using namespace llvm;
13 using namespace lld;
15 SpecificAllocBase *
16 lld::SpecificAllocBase::getOrCreate(void *tag, size_t size, size_t align,
17 SpecificAllocBase *(&creator)(void *)) {
18 auto &instances = context().instances;
19 auto &instance = instances[tag];
20 if (instance == nullptr) {
21 void *storage = context().bAlloc.Allocate(size, align);
22 instance = creator(storage);
24 return instance;