opnsense-src/contrib/llvm-project/llvm/lib/TextAPI/SymbolSet.cpp
Dimitry Andric fe013be447 Merge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-17-init-19304-gd0b54bb50e51, the
last commit before the upstream release/17.x branch was created.

PR:		273753
MFC after:	1 month

(cherry picked from commit 06c3fb2749)
2024-01-07 18:46:17 +01:00

36 lines
1.2 KiB
C++

//===- lib/TextAPI/SymbolSet.cpp - TAPI Symbol Set ------------*- 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
//
//===----------------------------------------------------------------------===//
#include "llvm/TextAPI/SymbolSet.h"
using namespace llvm;
using namespace llvm::MachO;
Symbol *SymbolSet::addGlobalImpl(SymbolKind Kind, StringRef Name,
SymbolFlags Flags) {
Name = copyString(Name);
auto Result = Symbols.try_emplace(SymbolsMapKey{Kind, Name}, nullptr);
if (Result.second)
Result.first->second =
new (Allocator) Symbol{Kind, Name, TargetList(), Flags};
return Result.first->second;
}
Symbol *SymbolSet::addGlobal(SymbolKind Kind, StringRef Name, SymbolFlags Flags,
const Target &Targ) {
auto *Sym = addGlobalImpl(Kind, Name, Flags);
Sym->addTarget(Targ);
return Sym;
}
const Symbol *SymbolSet::findSymbol(SymbolKind Kind, StringRef Name) const {
auto It = Symbols.find({Kind, Name});
if (It != Symbols.end())
return It->second;
return nullptr;
}