summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2017-11-14 04:48:18 +0000
committerAdam Nemet <anemet@apple.com>2017-11-14 04:48:18 +0000
commit5bc61c002808f7bf1abbd40ad4f90bb11ee03de9 (patch)
tree016a2a5d385ebe803d010640bf0092fa17a5fb07 /llvm/tools
parentedfc8691516f6204212f1259ec1bae293642fb83 (diff)
downloadbcm5719-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-xllvm/tools/opt-viewer/opt-viewer.py18
-rw-r--r--llvm/tools/opt-viewer/style.css10
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;
}
OpenPOWER on IntegriCloud