File tree 1 file changed +8
-10
lines changed
1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -807,10 +807,16 @@ class HTMLCodePrinter : public IRVisitor {
807
807
std::istringstream ss (str);
808
808
809
809
for (std::string line; std::getline (ss, line);) {
810
- if (line.empty ()) {
810
+ if (line.empty () || line == " \t " ) {
811
811
stream << " <span class='line'></span>\n " ;
812
812
continue ;
813
813
}
814
+ bool indent = false ;
815
+ if (line[0 ] == ' \t ' ) {
816
+ // Replace first tab with four spaces.
817
+ line = line.substr (1 );
818
+ indent = true ;
819
+ }
814
820
line = escape_html (line);
815
821
816
822
bool should_print_open_indent = false ;
@@ -844,14 +850,6 @@ class HTMLCodePrinter : public IRVisitor {
844
850
scope.pop (current_kernel);
845
851
}
846
852
847
- bool indent = false ;
848
-
849
- if (line[0 ] == ' \t ' ) {
850
- // Replace first tab with four spaces.
851
- line = line.substr (1 );
852
- indent = true ;
853
- }
854
-
855
853
line = replace_all (line, " .f32" , " .<span class='OpF32'>f32</span>" );
856
854
line = replace_all (line, " .f64" , " .<span class='OpF64'>f64</span>" );
857
855
@@ -883,7 +881,7 @@ class HTMLCodePrinter : public IRVisitor {
883
881
}
884
882
885
883
// Predicated instructions
886
- if (line.front () == ' @' && indent) {
884
+ if (!line. empty () && line.front () == ' @' && indent) {
887
885
idx = line.find (' ' );
888
886
std::string pred = line.substr (1 , idx - 1 );
889
887
line = " <span class='Pred'>@" + variable (pred, Bool ()) + " </span>" + line.substr (idx);
You can’t perform that action at this time.
0 commit comments