diff options
| author | Adam Nemet <anemet@apple.com> | 2017-11-14 04:48:18 +0000 |
|---|---|---|
| committer | Adam Nemet <anemet@apple.com> | 2017-11-14 04:48:18 +0000 |
| commit | 5bc61c002808f7bf1abbd40ad4f90bb11ee03de9 (patch) | |
| tree | 016a2a5d385ebe803d010640bf0092fa17a5fb07 /llvm/tools | |
| parent | edfc8691516f6204212f1259ec1bae293642fb83 (diff) | |
| download | bcm5719-llvm-5bc61c002808f7bf1abbd40ad4f90bb11ee03de9.tar.gz bcm5719-llvm-5bc61c002808f7bf1abbd40ad4f90bb11ee03de9.zip | |
[opt-viewer] Truncate long remark text in source view
The table is changed to fixed layout[1] and the lines use ellipses if they
would overflow their cell.
[1] https://css-tricks.com/fixing-tables-long-strings/
llvm-svn: 318136
Diffstat (limited to 'llvm/tools')
| -rwxr-xr-x | llvm/tools/opt-viewer/opt-viewer.py | 18 | ||||
| -rw-r--r-- | llvm/tools/opt-viewer/style.css | 10 |
2 files changed, 21 insertions, 7 deletions
diff --git a/llvm/tools/opt-viewer/opt-viewer.py b/llvm/tools/opt-viewer/opt-viewer.py index bdf21bb03c9..5af78b062e6 100755 --- a/llvm/tools/opt-viewer/opt-viewer.py +++ b/llvm/tools/opt-viewer/opt-viewer.py @@ -119,17 +119,21 @@ class SourceFileRenderer: </head> <body> <div class="centered"> -<table> +<table class="source"> +<thead> <tr> -<td>Line</td> -<td>Hotness</td> -<td>Optimization</td> -<td>Source</td> -<td>Inline Context</td> -</tr>''', file=self.stream) +<th style="width: 2%">Line</td> +<th style="width: 3%">Hotness</td> +<th style="width: 10%">Optimization</td> +<th style="width: 70%">Source</td> +<th style="width: 15%">Inline Context</td> +</tr> +</thead> +<tbody>''', file=self.stream) self.render_source_lines(self.source_stream, line_remarks) print(''' +</tbody> </table> </body> </html>''', file=self.stream) diff --git a/llvm/tools/opt-viewer/style.css b/llvm/tools/opt-viewer/style.css index 595c3e46847..0d3347c1578 100644 --- a/llvm/tools/opt-viewer/style.css +++ b/llvm/tools/opt-viewer/style.css @@ -1,3 +1,13 @@ +.source { + table-layout: fixed; + width: 100%; + white-space: nowrap; +} +.source td { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} .red { background-color: #ffd0d0; } |

