blob: c33a45e87eb5e45e2e7fedbdf8bdff1d430d756c [file] [log] [blame]
Jonas Devlieghere5810ed52020-02-13 12:51:19 -08001//===-- TextStubHelpers.cpp -------------------------------------*- C++ -*-===//
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//===-----------------------------------------------------------------------===/
8
9#include "llvm/TextAPI/MachO/InterfaceFile.h"
10#include <algorithm>
11#include <string>
12
13#ifndef TEXT_STUB_HELPERS_H
14#define TEXT_STUB_HELPERS_H
15
16namespace llvm {
17struct ExportedSymbol {
18 llvm::MachO::SymbolKind Kind;
19 std::string Name;
20 bool WeakDefined;
21 bool ThreadLocalValue;
22};
23
24using ExportedSymbolSeq = std::vector<ExportedSymbol>;
25using UUIDs = std::vector<std::pair<llvm::MachO::Target, std::string>>;
26
27inline bool operator<(const ExportedSymbol &LHS, const ExportedSymbol &RHS) {
28 return std::tie(LHS.Kind, LHS.Name) < std::tie(RHS.Kind, RHS.Name);
29}
30
31inline bool operator==(const ExportedSymbol &LHS, const ExportedSymbol &RHS) {
32 return std::tie(LHS.Kind, LHS.Name, LHS.WeakDefined, LHS.ThreadLocalValue) ==
33 std::tie(RHS.Kind, RHS.Name, RHS.WeakDefined, RHS.ThreadLocalValue);
34}
35
36inline std::string stripWhitespace(std::string S) {
37 S.erase(std::remove_if(S.begin(), S.end(), ::isspace), S.end());
38 return S;
39}
40} // namespace llvm
41#endif