File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
llvm/utils/TableGen/Common/GlobalISel Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -291,18 +291,20 @@ void MatchTable::emitDeclaration(raw_ostream &OS) const {
291291 OS << " constexpr static uint8_t MatchTable" << ID << " [] = {" ;
292292 LineBreak.emit (OS, true , *this );
293293
294+ // We want to display the table index of each line in a consistent
295+ // manner. It has to appear as a column on the left side of the table.
296+ // To determine how wide the column needs to be, check how many characters
297+ // we need to fit the largest possible index in the current table.
294298 const unsigned NumColsForIdx = llvm::to_string (CurrentSize).size ();
295299
296300 unsigned CurIndex = 0 ;
297301 const auto BeginLine = [&]() {
298- OS << std::string (BaseIndent, ' ' );
299- // To keep the /* index */ column consistent, pad
300- // the string at the start so we can always fit the
301- // exact number of characters to print the largest possible index.
302+ OS.indent (BaseIndent);
302303 std::string IdxStr = llvm::to_string (CurIndex);
304+ // Pad the string with spaces to keep the size of the prefix consistent.
303305 OS << " /* " << std::string (NumColsForIdx - IdxStr.size (), ' ' ) << IdxStr
304306 << " */ " ;
305- OS << std::string (Indentation, ' ' );
307+ OS. indent (Indentation);
306308 };
307309
308310 BeginLine ();
You can’t perform that action at this time.
0 commit comments