xref: /llvm-project/clang/lib/Basic/ParsedAttrInfo.cpp (revision 18a3d9e5b318133611ebc88bbe82ca9a2ca56f1d)
1383cfeeeSAnders Waldenborg //===- ParsedAttrInfo.cpp - Registry for attribute plugins ------*- C++ -*-===//
2383cfeeeSAnders Waldenborg //
3383cfeeeSAnders Waldenborg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4383cfeeeSAnders Waldenborg // See https://llvm.org/LICENSE.txt for license information.
5383cfeeeSAnders Waldenborg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6383cfeeeSAnders Waldenborg //
7383cfeeeSAnders Waldenborg //===----------------------------------------------------------------------===//
8383cfeeeSAnders Waldenborg //
9383cfeeeSAnders Waldenborg // This file contains the Registry of attributes added by plugins which
10383cfeeeSAnders Waldenborg // derive the ParsedAttrInfo class.
11383cfeeeSAnders Waldenborg //
12383cfeeeSAnders Waldenborg //===----------------------------------------------------------------------===//
13383cfeeeSAnders Waldenborg 
14383cfeeeSAnders Waldenborg #include "clang/Basic/ParsedAttrInfo.h"
15f5f1813dSAnders Waldenborg #include "llvm/Support/ManagedStatic.h"
16f5f1813dSAnders Waldenborg #include <list>
17f5f1813dSAnders Waldenborg #include <memory>
18383cfeeeSAnders Waldenborg 
19383cfeeeSAnders Waldenborg using namespace clang;
20383cfeeeSAnders Waldenborg 
LLVM_INSTANTIATE_REGISTRY(ParsedAttrInfoRegistry) const21383cfeeeSAnders Waldenborg LLVM_INSTANTIATE_REGISTRY(ParsedAttrInfoRegistry)
22f5f1813dSAnders Waldenborg 
23f5f1813dSAnders Waldenborg const std::list<std::unique_ptr<ParsedAttrInfo>> &
24f5f1813dSAnders Waldenborg clang::getAttributePluginInstances() {
25f5f1813dSAnders Waldenborg   static llvm::ManagedStatic<std::list<std::unique_ptr<ParsedAttrInfo>>>
26f5f1813dSAnders Waldenborg       PluginAttrInstances;
27f5f1813dSAnders Waldenborg   if (PluginAttrInstances->empty())
28*18a3d9e5SManna, Soumi     for (const auto &It : ParsedAttrInfoRegistry::entries())
29f5f1813dSAnders Waldenborg       PluginAttrInstances->emplace_back(It.instantiate());
30f5f1813dSAnders Waldenborg 
31f5f1813dSAnders Waldenborg   return *PluginAttrInstances;
32f5f1813dSAnders Waldenborg }
33