File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -22,28 +22,35 @@ namespace markup {
22
22
// FIXME: copied from Clang's
23
23
// CommentASTToXMLConverter::appendToResultWithXMLEscaping
24
24
static inline void appendWithXMLEscaping (raw_ostream &OS, StringRef S) {
25
- for (const char C : S) {
26
- switch (C) {
25
+ auto Start = S.begin (), Cursor = Start, End = S.end ();
26
+ for (; Cursor != End; ++Cursor) {
27
+ switch (*Cursor) {
27
28
case ' &' :
29
+ OS.write (Start, Cursor - Start);
28
30
OS << " &" ;
29
31
break ;
30
32
case ' <' :
33
+ OS.write (Start, Cursor - Start);
31
34
OS << " <" ;
32
35
break ;
33
36
case ' >' :
37
+ OS.write (Start, Cursor - Start);
34
38
OS << " >" ;
35
39
break ;
36
40
case ' "' :
41
+ OS.write (Start, Cursor - Start);
37
42
OS << " "" ;
38
43
break ;
39
44
case ' \' ' :
45
+ OS.write (Start, Cursor - Start);
40
46
OS << " '" ;
41
47
break ;
42
48
default :
43
- OS << C;
44
- break ;
49
+ continue ;
45
50
}
51
+ Start = Cursor + 1 ;
46
52
}
53
+ OS.write (Start, Cursor - Start);
47
54
}
48
55
49
56
// FIXME: copied from Clang's
You can’t perform that action at this time.
0 commit comments