@@ -112,17 +112,21 @@ void RenderDiagnosticDetails(Stream &stream,
112
112
// Print a line with caret indicator(s) below the lldb prompt + command.
113
113
const size_t padding = *offset_in_command;
114
114
stream << std::string (padding, ' ' );
115
- size_t offset = 1 ;
116
- for (const DiagnosticDetail &detail : remaining_details) {
117
- auto &loc = *detail.source_location ;
118
-
119
- if (offset > loc.column )
120
- continue ;
121
-
122
- stream << std::string (loc.column - offset, ' ' ) << cursor;
123
- for (unsigned i = 0 ; i + 1 < loc.length ; ++i)
124
- stream << underline ;
125
- offset = loc.column + 1 ;
115
+ {
116
+ size_t x_pos = 1 ;
117
+ for (const DiagnosticDetail &detail : remaining_details) {
118
+ auto &loc = *detail.source_location ;
119
+
120
+ if (x_pos > loc.column )
121
+ continue ;
122
+
123
+ stream << std::string (loc.column - x_pos, ' ' ) << cursor;
124
+ ++x_pos;
125
+ for (unsigned i = 0 ; i + 1 < loc.length ; ++i) {
126
+ stream << underline ;
127
+ ++x_pos;
128
+ }
129
+ }
126
130
}
127
131
stream << ' \n ' ;
128
132
@@ -134,19 +138,19 @@ void RenderDiagnosticDetails(Stream &stream,
134
138
// Get the information to print this detail and remove it from the stack.
135
139
// Print all the lines for all the other messages first.
136
140
stream << std::string (padding, ' ' );
137
- size_t offset = 1 ;
141
+ size_t x_pos = 1 ;
138
142
for (auto &remaining_detail :
139
143
llvm::ArrayRef (remaining_details).drop_back (1 )) {
140
144
uint16_t column = remaining_detail.source_location ->column ;
141
- if (offset <= column)
142
- stream << std::string (column - offset , ' ' ) << vbar;
143
- offset = column + 1 ;
145
+ if (x_pos <= column)
146
+ stream << std::string (column - x_pos , ' ' ) << vbar;
147
+ x_pos = column + 1 ;
144
148
}
145
149
146
150
// Print the line connecting the ^ with the error message.
147
151
uint16_t column = detail->source_location ->column ;
148
- if (offset <= column)
149
- stream << std::string (column - offset , ' ' ) << joint << hbar << spacer;
152
+ if (x_pos <= column)
153
+ stream << std::string (column - x_pos , ' ' ) << joint << hbar << spacer;
150
154
151
155
// Print a colorized string based on the message's severity type.
152
156
PrintSeverity (stream, detail->severity );
0 commit comments