1*06c3fb27SDimitry Andric //===- ParsedAttrInfo.cpp - Registry for attribute plugins ------*- C++ -*-===// 2*06c3fb27SDimitry Andric // 3*06c3fb27SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*06c3fb27SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*06c3fb27SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*06c3fb27SDimitry Andric // 7*06c3fb27SDimitry Andric //===----------------------------------------------------------------------===// 8*06c3fb27SDimitry Andric // 9*06c3fb27SDimitry Andric // This file contains the Registry of attributes added by plugins which 10*06c3fb27SDimitry Andric // derive the ParsedAttrInfo class. 11*06c3fb27SDimitry Andric // 12*06c3fb27SDimitry Andric //===----------------------------------------------------------------------===// 13*06c3fb27SDimitry Andric 14*06c3fb27SDimitry Andric #include "clang/Basic/ParsedAttrInfo.h" 15*06c3fb27SDimitry Andric #include "llvm/Support/ManagedStatic.h" 16*06c3fb27SDimitry Andric #include <list> 17*06c3fb27SDimitry Andric #include <memory> 18*06c3fb27SDimitry Andric 19*06c3fb27SDimitry Andric using namespace clang; 20*06c3fb27SDimitry Andric LLVM_INSTANTIATE_REGISTRY(ParsedAttrInfoRegistry) const21*06c3fb27SDimitry AndricLLVM_INSTANTIATE_REGISTRY(ParsedAttrInfoRegistry) 22*06c3fb27SDimitry Andric 23*06c3fb27SDimitry Andric const std::list<std::unique_ptr<ParsedAttrInfo>> & 24*06c3fb27SDimitry Andric clang::getAttributePluginInstances() { 25*06c3fb27SDimitry Andric static llvm::ManagedStatic<std::list<std::unique_ptr<ParsedAttrInfo>>> 26*06c3fb27SDimitry Andric PluginAttrInstances; 27*06c3fb27SDimitry Andric if (PluginAttrInstances->empty()) 28*06c3fb27SDimitry Andric for (const auto &It : ParsedAttrInfoRegistry::entries()) 29*06c3fb27SDimitry Andric PluginAttrInstances->emplace_back(It.instantiate()); 30*06c3fb27SDimitry Andric 31*06c3fb27SDimitry Andric return *PluginAttrInstances; 32*06c3fb27SDimitry Andric } 33