Mercurial > hg > CbC > CbC_llvm
comparison include/llvm/Support/ScopedPrinter.h @ 148:63bd29f05246
merged
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 14 Aug 2019 19:46:37 +0900 |
parents | c2174574ed3a |
children |
comparison
equal
deleted
inserted
replaced
146:3fc4d5c3e21e | 148:63bd29f05246 |
---|---|
1 //===-- ScopedPrinter.h ---------------------------------------------------===// | 1 //===-- ScopedPrinter.h ----------------------------------------*- C++ -*--===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 // | 4 // See https://llvm.org/LICENSE.txt for license information. |
5 // This file is distributed under the University of Illinois Open Source | 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 // License. See LICENSE.TXT for details. | |
7 // | 6 // |
8 //===----------------------------------------------------------------------===// | 7 //===----------------------------------------------------------------------===// |
9 | 8 |
10 #ifndef LLVM_SUPPORT_SCOPEDPRINTER_H | 9 #ifndef LLVM_SUPPORT_SCOPEDPRINTER_H |
11 #define LLVM_SUPPORT_SCOPEDPRINTER_H | 10 #define LLVM_SUPPORT_SCOPEDPRINTER_H |
78 IndentLevel = std::max(0, IndentLevel - Levels); | 77 IndentLevel = std::max(0, IndentLevel - Levels); |
79 } | 78 } |
80 | 79 |
81 void resetIndent() { IndentLevel = 0; } | 80 void resetIndent() { IndentLevel = 0; } |
82 | 81 |
82 int getIndentLevel() { return IndentLevel; } | |
83 | |
83 void setPrefix(StringRef P) { Prefix = P; } | 84 void setPrefix(StringRef P) { Prefix = P; } |
84 | 85 |
85 void printIndent() { | 86 void printIndent() { |
86 OS << Prefix; | 87 OS << Prefix; |
87 for (int i = 0; i < IndentLevel; ++i) | 88 for (int i = 0; i < IndentLevel; ++i) |
134 (IsEnum && (Value & EnumMask) == Flag.Value)) { | 135 (IsEnum && (Value & EnumMask) == Flag.Value)) { |
135 SetFlags.push_back(Flag); | 136 SetFlags.push_back(Flag); |
136 } | 137 } |
137 } | 138 } |
138 | 139 |
139 std::sort(SetFlags.begin(), SetFlags.end(), &flagName<TFlag>); | 140 llvm::sort(SetFlags, &flagName<TFlag>); |
140 | 141 |
141 startLine() << Label << " [ (" << hex(Value) << ")\n"; | 142 startLine() << Label << " [ (" << hex(Value) << ")\n"; |
142 for (const auto &Flag : SetFlags) { | 143 for (const auto &Flag : SetFlags) { |
143 startLine() << " " << Flag.Name << " (" << hex(Flag.Value) << ")\n"; | 144 startLine() << " " << Flag.Name << " (" << hex(Flag.Value) << ")\n"; |
144 } | 145 } |