Skip to content

Commit 3acb3d5

Browse files
authored
bodgy: inline FillRow in FillTextBuffer to work around DD-2413379 (#18971)
Something about FillRow tickles the compiler and causes it to ICE during LTCG. See DD-2413379 for more. DevCom: https://developercommunity.visualstudio.com/t/VS-2022-1714-p11-cannot-complete-a-bui/10864784
1 parent c594fcc commit 3acb3d5

File tree

1 file changed

+37
-48
lines changed

1 file changed

+37
-48
lines changed

src/inc/test/CommonState.hpp

Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,43 @@ class CommonState
216216
for (til::CoordType iRow = 0; iRow < cRowsToFill; iRow++)
217217
{
218218
ROW& row = textBuffer.GetMutableRowByOffset(iRow);
219-
FillRow(&row, iRow & 1);
219+
220+
// fill a row
221+
// - Each row is populated with L"AB\u304bC\u304dDE "
222+
// - 7 characters, 6 spaces. 13 total
223+
// - The characters take up first 9 columns. (The wide glyphs take up 2 columns each)
224+
// - か = \x304b, き = \x304d
225+
226+
uint16_t column = 0;
227+
for (const auto& ch : std::wstring_view{ L"AB\u304bC\u304dDE " })
228+
{
229+
const uint16_t width = ch >= 0x80 ? 2 : 1;
230+
row.ReplaceCharacters(column, width, { &ch, 1 });
231+
column += width;
232+
}
233+
234+
// A = bright red on dark gray
235+
// This string starts at index 0
236+
auto Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY);
237+
row.SetAttrToEnd(0, Attr);
238+
239+
// BかC = dark gold on bright blue
240+
// This string starts at index 1
241+
Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY);
242+
row.SetAttrToEnd(1, Attr);
243+
244+
// き = bright white on dark purple
245+
// This string starts at index 5
246+
Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_BLUE);
247+
row.SetAttrToEnd(5, Attr);
248+
249+
// DE = black on dark green
250+
// This string starts at index 7
251+
Attr = TextAttribute(BACKGROUND_GREEN);
252+
row.SetAttrToEnd(7, Attr);
253+
254+
// odd rows forced a wrap
255+
row.SetWrapForced(iRow & 1);
220256
}
221257

222258
textBuffer.GetCursor().SetYPosition(cRowsToFill);
@@ -233,51 +269,4 @@ class CommonState
233269
FontInfo m_pFontInfo;
234270
std::unique_ptr<TextBuffer> m_backupTextBufferInfo;
235271
std::unique_ptr<INPUT_READ_HANDLE_DATA> m_readHandle;
236-
237-
void FillRow(ROW* pRow, bool wrapForced)
238-
{
239-
// fill a row
240-
// - Each row is populated with L"AB\u304bC\u304dDE "
241-
// - 7 characters, 6 spaces. 13 total
242-
// - The characters take up first 9 columns. (The wide glyphs take up 2 columns each)
243-
// - か = \x304b, き = \x304d
244-
245-
uint16_t column = 0;
246-
for (const auto& ch : std::wstring_view{ L"AB\u304bC\u304dDE " })
247-
{
248-
const uint16_t width = ch >= 0x80 ? 2 : 1;
249-
pRow->ReplaceCharacters(column, width, { &ch, 1 });
250-
column += width;
251-
}
252-
253-
// A = bright red on dark gray
254-
// This string starts at index 0
255-
auto Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY);
256-
pRow->SetAttrToEnd(0, Attr);
257-
258-
// BかC = dark gold on bright blue
259-
// This string starts at index 1
260-
Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY);
261-
pRow->SetAttrToEnd(1, Attr);
262-
263-
// き = bright white on dark purple
264-
// This string starts at index 5
265-
Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_BLUE);
266-
pRow->SetAttrToEnd(5, Attr);
267-
268-
// DE = black on dark green
269-
// This string starts at index 7
270-
Attr = TextAttribute(BACKGROUND_GREEN);
271-
pRow->SetAttrToEnd(7, Attr);
272-
273-
// odd rows forced a wrap
274-
if (wrapForced)
275-
{
276-
pRow->SetWrapForced(true);
277-
}
278-
else
279-
{
280-
pRow->SetWrapForced(false);
281-
}
282-
}
283272
};

0 commit comments

Comments
 (0)