llvm.org GIT mirror llvm / 687f752
[opt-viewer] Add javascript to expand/hide full message for multiline remarks. This patch adds support for displaying remarks with multiple lines. For such remarks, it creates a hidden div containing the message's lines except the first one in a <pre> tag. It also prepends a link (with '+' as text) to the regular remark line. This link can be used to show/hide the div containing the full remark. In combination with D57159, this allows for better displaying of multiline remarks in the html pages generated by opt-viewer. The Javascript is very simple and should be supported by any recent major browser. Reviewers: hfinkel, anemet, thegameg, serge-sans-paille Reviewed By: anemet Differential Revision: https://reviews.llvm.org/D57167 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352223 91177308-0d34-0410-b5e6-96231b3b80d8 Florian Hahn 6 months ago
8 changed file(s) with 202 addition(s) and 61 deletion(s). Raw diff Collapse all Expand all
224224 - InterleaveCount: '2'
225225 - String: ')'
226226 ...
227 --- !Passed
228 Pass: multiline
229 Name: ShowMultiLine
230 DebugLoc: { File: basic/or.c, Line: 10, Column: 3 }
231 Function: Test
232 Args:
233 - String: |
234 This is a remark with
235 multiple
236 lines
237 ...
33
44
55
6
623
724
825
105122
106123
107124
125
126
127 multiline
128
  
+ This is a remark with 
129
130
  
131
multiple

                  
                
132 lines
133
134
135 Test
136
137
138
108139 11
109140
110141
33
44
55
6
623
724
825
2828
2929
3030
31 basic/or.c:14:3
31 basic/or.c:10:3
3232
3333 Test
34 multiline
35
36
37
38 basic/or.c:14:3
39
40 Test
3441 loop-unroll
42
43
44
45 basic/or.c:18:3
46
47 Test
48 inline
3549
3650
3751
3852 basic/or.c:18:3
3953
4054 Test
55 inline
56
57
58
59 basic/or.c:20:3
60
61 Test
4162 inline
4263
4364
4465
45 basic/or.c:18:3
66 basic/or.c:20:3
67
68 Test
69 inline
70
71
72
73 basic/or.c:20:10
74
75 Test
76 inline
77
78
79
80 basic/or.c:20:17
81
82 Test
83 inline
84
85
86
87 basic/or.c:20:17
4688
4789 Test
4890 inline
4991
5092
5193
52 basic/or.c:20:3
94 basic/or.h:5:3
5395
54 Test
55 inline
56
57
58
59 basic/or.c:20:3
60
61 Test
62 inline
63
64
65
66 basic/or.c:20:10
67
68 Test
69 inline
70
71
72
73 basic/or.c:20:17
74
75 Test
76 inline
77
78
79
80 basic/or.c:20:17
81
82 Test
83 inline
84
85
86
87 basic/or.h:5:3
88
89 TestH
96 TestH
9097 loop-vectorize
9198
9299
93100
94 basic/or.h:9:3
101 basic/or.h:9:3
102
103 TestH
104 loop-unroll
105
106
107
108 basic/or.h:13:3
95109
96110 TestH
97 loop-unroll
111 inline
98112
99113
100114
101115 basic/or.h:13:3
102116
103117 TestH
104 inline
118 inline
105119
106120
107121
108 basic/or.h:13:3
122 basic/or.h:15:3
109123
110124 TestH
111 inline
125 inline
112126
113127
114128
115129 basic/or.h:15:3
116130
117131 TestH
118 inline
119
120
121
122 basic/or.h:15:3
123
124 TestH
125132 inline
126133
127134
128135
129 basic/or.h:15:10
136 basic/or.h:15:10
137
138 TestH
139 inline
140
141
142
143 basic/or.h:15:17
130144
131145 TestH
132 inline
146 inline
133147
134148
135149
136150 basic/or.h:15:17
137151
138152 TestH
139 inline
140
141
142
143 basic/or.h:15:17
144
145 TestH
146153 inline
147154
148155
33
44
55
6
623
724
825
33
44
55
6
623
724
825
'''.format(**locals()), file=self.stream)
119119 indent = line[:max(r.Column, 1) - 1]
120120 indent = re.sub('\S', ' ', indent)
121121
122 # Create expanded message and link if we have a multiline message.
123 lines = r.message.split('\n')
124 if len(lines) > 1:
125 expand_link = '+'
126 message = lines[0]
127 expand_message = u'''
128
129
{}
130
{}
131 '''.format(indent, '\n'.join(lines[1:]))
132 else:
133 expand_link = ''
134 expand_message = ''
135 message = r.message
122136 print(u'''
123137
124138
125139 {r.RelativeHotness}
126140 {r.PassWithDiffPrefix}
127
{indent}
{r.message} 
141
{indent}
{expand_link} {message} {expand_message}
128142 {inlining_context}
129143
130144
138152
139153
140154
155
141172
142173
143174
137137 }
138138 td:last-child {
139139 border-right: none;
140 }
141 .expanded {
142 background-color: #f2f2f2;
143 padding-top: 5px;
144 padding-left: 5px;
145 }
146 .col-left {
147 float: left;
148 margin-bottom: -99999px;
149 padding-bottom: 99999px;
140150 }
141151
142152 /* Generated with pygmentize -S colorful -f html >> style.css */