1 //===-- StreamWrapper.h -----------------------------------------*- 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 #ifndef LLVM_LIBC_UTILS_TESTUTILS_STREAMWRAPPER_H
10 #define LLVM_LIBC_UTILS_TESTUTILS_STREAMWRAPPER_H
11 
12 namespace __llvm_libc {
13 namespace testutils {
14 
15 // StreamWrapper is necessary because llvm/Support/raw_ostream.h includes
16 // standard headers so we must provide streams through indirection to not
17 // expose the system libc headers.
18 class StreamWrapper {
19   void *OS;
20 
21 public:
StreamWrapper(void * OS)22   StreamWrapper(void *OS) : OS(OS) {}
23 
24   template <typename T> StreamWrapper &operator<<(T t);
25 };
26 
27 StreamWrapper outs();
28 
29 } // namespace testutils
30 } // namespace __llvm_libc
31 
32 #endif // LLVM_LIBC_UTILS_TESTUTILS_STREAMWRAPPER_H
33