1 //===- ArchitectureSet.cpp ------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // Implements the architecture set.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/TextAPI/MachO/ArchitectureSet.h"
18 ArchitectureSet::ArchitectureSet(const std::vector
<Architecture
> &Archs
)
20 for (auto Arch
: Archs
) {
21 if (Arch
== AK_unknown
)
27 size_t ArchitectureSet::count() const {
30 for (unsigned i
= 0; i
< sizeof(ArchSetType
) * 8; ++i
)
31 if (ArchSet
& (1U << i
))
36 ArchitectureSet::operator std::string() const {
42 for (auto arch
: *this) {
43 result
.append(getArchitectureName(arch
));
51 ArchitectureSet::operator std::vector
<Architecture
>() const {
52 std::vector
<Architecture
> archs
;
53 for (auto arch
: *this) {
54 if (arch
== AK_unknown
)
56 archs
.emplace_back(arch
);
61 void ArchitectureSet::print(raw_ostream
&os
) const { os
<< std::string(*this); }
63 raw_ostream
&operator<<(raw_ostream
&os
, ArchitectureSet set
) {
68 } // end namespace MachO.
69 } // end namespace llvm.