1 //===-- 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/Support/MemoryBuffer.h" 10 #include "llvm/TextAPI/MachO/InterfaceFile.h" 11 #include <algorithm> 12 #include <string> 13 14 #ifndef TEXT_STUB_HELPERS_H 15 #define TEXT_STUB_HELPERS_H 16 17 namespace llvm { 18 struct ExportedSymbol { 19 llvm::MachO::SymbolKind Kind; 20 std::string Name; 21 bool WeakDefined; 22 bool ThreadLocalValue; 23 }; 24 25 using ExportedSymbolSeq = std::vector<ExportedSymbol>; 26 using UUIDs = std::vector<std::pair<llvm::MachO::Target, std::string>>; 27 28 inline bool operator<(const ExportedSymbol &LHS, const ExportedSymbol &RHS) { 29 return std::tie(LHS.Kind, LHS.Name) < std::tie(RHS.Kind, RHS.Name); 30 } 31 32 inline bool operator==(const ExportedSymbol &LHS, const ExportedSymbol &RHS) { 33 return std::tie(LHS.Kind, LHS.Name, LHS.WeakDefined, LHS.ThreadLocalValue) == 34 std::tie(RHS.Kind, RHS.Name, RHS.WeakDefined, RHS.ThreadLocalValue); 35 } 36 37 inline std::string stripWhitespace(std::string S) { 38 S.erase(std::remove_if(S.begin(), S.end(), ::isspace), S.end()); 39 return S; 40 } 41 } // namespace llvm 42 #endif 43