| 423 | } |
| 424 | |
| 425 | static void printSourceLine(raw_ostream &S, StringRef LineContents) { |
| 426 | // Print out the source line one character at a time, so we can expand tabs. |
| 427 | for (unsigned i = 0, e = LineContents.size(), OutCol = 0; i != e; ++i) { |
| 428 | size_t NextTab = LineContents.find('\t', i); |
| 429 | // If there were no tabs left, print the rest, we are done. |
| 430 | if (NextTab == StringRef::npos) { |
| 431 | S << LineContents.drop_front(i); |
| 432 | break; |
| 433 | } |
| 434 | |
| 435 | // Otherwise, print from i to NextTab. |
| 436 | S << LineContents.slice(i, NextTab); |
| 437 | OutCol += NextTab - i; |
| 438 | i = NextTab; |
| 439 | |
| 440 | // If we have a tab, emit at least one space, then round up to 8 columns. |
| 441 | do { |
| 442 | S << ' '; |
| 443 | ++OutCol; |
| 444 | } while ((OutCol % TabStop) != 0); |
| 445 | } |
| 446 | S << '\n'; |
| 447 | } |
| 448 | |
| 449 | static bool isNonASCII(char c) { return c & 0x80; } |
| 450 |
no test coverage detected