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/ArchitectureSet.h"
14 #include "llvm/Support/raw_ostream.h"
19 ArchitectureSet::ArchitectureSet(const std::vector
<Architecture
> &Archs
)
21 for (auto Arch
: Archs
) {
22 if (Arch
== AK_unknown
)
28 size_t ArchitectureSet::count() const {
31 for (unsigned i
= 0; i
< sizeof(ArchSetType
) * 8; ++i
)
32 if (ArchSet
& (1U << i
))
37 ArchitectureSet::operator std::string() const {
43 for (auto arch
: *this) {
44 result
.append(std::string(getArchitectureName(arch
)));
52 ArchitectureSet::operator std::vector
<Architecture
>() const {
53 std::vector
<Architecture
> archs
;
54 for (auto arch
: *this) {
55 if (arch
== AK_unknown
)
57 archs
.emplace_back(arch
);
62 void ArchitectureSet::print(raw_ostream
&os
) const { os
<< std::string(*this); }
64 raw_ostream
&operator<<(raw_ostream
&os
, ArchitectureSet set
) {
69 } // end namespace MachO.
70 } // end namespace llvm.