File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -43,20 +43,11 @@ std::string LineList::str() const {
43
43
}
44
44
45
45
size_t swift::markup::measureIndentation (StringRef Text) {
46
- size_t Col = 0 ;
47
- for (size_t i = 0 , e = Text.size (); i != e; ++i) {
48
- if (Text[i] == ' ' || Text[i] == ' \v ' || Text[i] == ' \f ' ) {
49
- ++Col;
50
- continue ;
51
- }
52
-
53
- if (Text[i] == ' \t ' ) {
54
- Col += ((i + 8 ) / 8 ) * 8 ;
55
- continue ;
56
- }
57
- return i;
58
- }
59
- return Text.size ();
46
+ static constexpr llvm::StringLiteral IndentChars (" \v\f\t " );
47
+ size_t FirstNonIndentPos = Text.find_first_not_of (IndentChars);
48
+ if (FirstNonIndentPos == StringRef::npos)
49
+ return Text.size ();
50
+ return FirstNonIndentPos;
60
51
}
61
52
62
53
void LineListBuilder::addLine (llvm::StringRef Text, swift::SourceRange Range) {
You can’t perform that action at this time.
0 commit comments