[libc] Make more of the libc unit testing llvm independent

(WIP, hopefully I'll add more to this patch before submitting)

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D91665
This commit is contained in:
Michael Jones
2020-11-17 23:47:19 +00:00
parent 3e18fb3390
commit 8a4ee3550b
5 changed files with 30 additions and 20 deletions

View File

@@ -7,19 +7,19 @@
//===----------------------------------------------------------------------===//
#include "StreamWrapper.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <iostream>
#include <memory>
#include <string>
namespace __llvm_libc {
namespace testutils {
StreamWrapper outs() { return {std::addressof(llvm::outs())}; }
StreamWrapper outs() { return {std::addressof(std::cout)}; }
template <typename T> StreamWrapper &StreamWrapper::operator<<(T t) {
assert(OS);
llvm::raw_ostream &Stream = *reinterpret_cast<llvm::raw_ostream *>(OS);
std::ostream &Stream = *reinterpret_cast<std::ostream *>(OS);
Stream << t;
return *this;
}