Commit a385a91
[Support] Fix color handling in formatted_raw_ostream (#86700)
The color methods in formatted_raw_ostream were forwarding directly to
the underlying stream without considering existing buffered output. This
would cause incorrect colored output for buffered uses of
formatted_raw_ostream.
Fix this issue by applying the color to the formatted_raw_ostream itself
and temporarily disabling scanning of any color related output so as not
to affect the position tracking.
This fix means that workarounds that forced formatted_raw_ostream
buffering to be disabled can be removed. In the case of llvm-objdump,
this can improve disassembly performance when redirecting to a file by
more than an order of magnitude on both Windows and Linux. This
improvement restores the disassembly performance when redirecting to a
file to a level similar to before color support was added.
(cherry picked from commit c9db031)1 parent 0cd4bab commit a385a91
File tree
4 files changed
+47
-19
lines changed- llvm
- include/llvm/Support
- lib/Support
- tools
- llvm-mc
- llvm-objdump
4 files changed
+47
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
| |||
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| 96 | + | |
| 97 | + | |
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
95 | 123 | | |
96 | 124 | | |
97 | 125 | | |
| |||
104 | 132 | | |
105 | 133 | | |
106 | 134 | | |
107 | | - | |
| 135 | + | |
108 | 136 | | |
109 | 137 | | |
110 | | - | |
111 | | - | |
112 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
113 | 141 | | |
114 | 142 | | |
115 | 143 | | |
| |||
136 | 164 | | |
137 | 165 | | |
138 | 166 | | |
139 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
140 | 171 | | |
141 | 172 | | |
142 | 173 | | |
143 | 174 | | |
144 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
145 | 179 | | |
146 | 180 | | |
147 | 181 | | |
148 | 182 | | |
149 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
150 | 187 | | |
151 | 188 | | |
152 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | 550 | | |
556 | 551 | | |
557 | 552 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2032 | 2032 | | |
2033 | 2033 | | |
2034 | 2034 | | |
2035 | | - | |
2036 | | - | |
2037 | | - | |
2038 | | - | |
2039 | | - | |
2040 | | - | |
2041 | | - | |
2042 | 2035 | | |
2043 | 2036 | | |
2044 | 2037 | | |
| |||
0 commit comments