[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / utils / unittest / googletest / include / gtest / internal / custom / gtest-printers.h
blobd4ae08341006d053f39f36502bd4a8daf0adcbc3
1 // Copyright 2015, Google Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 // * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 // This file provides an injection point for custom printers in a local
31 // installation of gTest.
32 // It will be included from gtest-printers.h and the overrides in this file
33 // will be visible to everyone.
34 // See documentation at gtest/gtest-printers.h for details on how to define a
35 // custom printer.
37 // ** Custom implementation starts here **
39 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
40 #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
42 #if !GTEST_NO_LLVM_SUPPORT
43 #include "llvm/ADT/SmallString.h"
44 #include "llvm/ADT/StringRef.h"
45 #include <ostream>
46 // Printing of llvm String types.
47 // gtest sees these as containers of char (they have nested iterator types),
48 // so their operator<< is never considered unless we provide PrintTo().
49 // PrintStringTo provides quotes and escaping, at the cost of a copy.
50 namespace llvm {
51 inline void PrintTo(llvm::StringRef S, std::ostream *OS) {
52 *OS << ::testing::PrintToString(S.str());
54 // We need both SmallString<N> and SmallVectorImpl<char> overloads:
55 // - the SmallString<N> template is needed as overload resolution will
56 // instantiate generic PrintTo<T> rather than do derived-to-base conversion
57 // - but SmallVectorImpl<char> is sometimes the actual static type, in code
58 // that erases the small size
59 template <unsigned N>
60 inline void PrintTo(const SmallString<N> &S, std::ostream *OS) {
61 *OS << ::testing::PrintToString(std::string(S.data(), S.size()));
63 inline void PrintTo(const SmallVectorImpl<char> &S, std::ostream *OS) {
64 *OS << ::testing::PrintToString(std::string(S.data(), S.size()));
66 } // namespace llvm
67 #endif // !GTEST_NO_LLVM_SUPPORT
69 #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_