Files
swift-mirror/include/swift/Basic/SmallBitVector.h
Michael Gottesman 5bd2725c23 [basic] Add an operator<<(llvm::raw_ostream &os, const SmallBitVector &) implementation.
For some reason LLVM doesn't provide this. I have written a few versions of this
in the Swift codebase. Makes sense to factor it out before I make another one.
2023-01-06 20:57:39 -08:00

31 lines
940 B
C++

//===--- SmallBitVector.h -------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_BASIC_SMALLBITVECTOR_H
#define SWIFT_BASIC_SMALLBITVECTOR_H
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
const SmallBitVector &bv) {
for (unsigned i = 0, e = bv.size(); i != e; ++i)
os << (bv[i] ? '1' : '0');
return os;
}
} // namespace llvm
#endif