This reverts d4b574266132e08ff585facf2e0e01995082999f, and reapplies d7f32f1fbf83da2faa4acdcaf2a4d4885a2d068c. Original commit message: - clang/StaticAnalyzer: fix static init in findKnownClass. Prior to this patch two threads running in findKnownClass could result in a race condition. - clang/Stmt: fix StmtClassNameTable array initialization: prior to this patch there was a race condition when two threads check `if(Initialized)` at the same time. - clang/ParsedAttrInfo: fix race condition in getAttributePluginInstances. Prior to this patch two threads could enter `if(empty())` check. - clang/CodeGen: correctly restore diagnostic handler in HandleTranslationUnit. Prior to this patch an early exit from HandleTranslationUnit could result in not restoring previous diagnostic handler.
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
//===- ParsedAttrInfo.cpp - Registry for attribute plugins ------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file contains the Registry of attributes added by plugins which
|
|
// derive the ParsedAttrInfo class.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "clang/Basic/ParsedAttrInfo.h"
|
|
#include "llvm/Support/ManagedStatic.h"
|
|
#include <list>
|
|
#include <memory>
|
|
|
|
using namespace clang;
|
|
|
|
LLVM_INSTANTIATE_REGISTRY(ParsedAttrInfoRegistry)
|
|
|
|
static std::list<std::unique_ptr<ParsedAttrInfo>> instantiateEntries() {
|
|
std::list<std::unique_ptr<ParsedAttrInfo>> Instances;
|
|
for (const auto &It : ParsedAttrInfoRegistry::entries())
|
|
Instances.emplace_back(It.instantiate());
|
|
return Instances;
|
|
}
|
|
|
|
const std::list<std::unique_ptr<ParsedAttrInfo>> &
|
|
clang::getAttributePluginInstances() {
|
|
static std::list<std::unique_ptr<ParsedAttrInfo>> Instances =
|
|
instantiateEntries();
|
|
return Instances;
|
|
}
|