llvm.org GIT mirror llvm / 6c826ef
Add opt-viewer testing Detects whether we have the Python modules (pygments, yaml) required by opt-viewer and hooks this up to REQUIRES. This fixes https://bugs.llvm.org/show_bug.cgi?id=34129 (the lack of opt-viewer testing). It's also related to https://github.com/apple/swift/pull/12938 and the idea is to expose LLVM_HAVE_OPT_VIEWER_MODULES to the Swift cmake. Differential Revision: https://reviews.llvm.org/D40202 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319188 91177308-0d34-0410-b5e6-96231b3b80d8 Adam Nemet 1 year, 8 months ago
13 changed file(s) with 1163 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
627627 endif()
628628
629629 string(REPLACE " " ";" LLVM_BINDINGS_LIST "${LLVM_BINDINGS}")
630
631 function(find_python_module module)
632 string(TOUPPER ${module} module_upper)
633 set(FOUND_VAR PY_${module_upper}_FOUND)
634
635 execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import ${module}"
636 RESULT_VARIABLE status
637 ERROR_QUIET)
638
639 if(status)
640 set(${FOUND_VAR} 0 PARENT_SCOPE)
641 message(STATUS "Could NOT find Python module ${module}")
642 else()
643 set(${FOUND_VAR} 1 PARENT_SCOPE)
644 message(STATUS "Found Python module ${module}")
645 endif()
646 endfunction()
647
648 set (PYTHON_MODULES
649 pygments
650 yaml
651 )
652 foreach(module ${PYTHON_MODULES})
653 find_python_module(${module})
654 endforeach()
655
656 if(PY_PYGMENTS_FOUND AND PY_YAML_FOUND)
657 set (LLVM_HAVE_OPT_VIEWER_MODULES 1)
658 else()
659 set (LLVM_HAVE_OPT_VIEWER_MODULES 0)
660 endif()
122122 ocamlopt_command = '%s ocamlopt -cclib -L%s -cclib -Wl,-rpath,%s %s' % (
123123 config.ocamlfind_executable, config.llvm_lib_dir, config.llvm_lib_dir, config.ocaml_flags)
124124
125 opt_viewer_cmd = '%s %s/tools/opt-viewer/opt-viewer.py' % (sys.executable, config.llvm_src_root)
125126
126127 tools = [
127128 ToolSubst('%lli', FindTool('lli'), post='.', extra_args=lli_args),
131132 ToolSubst('%ld64', ld64_cmd, unresolved='ignore'),
132133 ToolSubst('%ocamlc', ocamlc_command, unresolved='ignore'),
133134 ToolSubst('%ocamlopt', ocamlopt_command, unresolved='ignore'),
135 ToolSubst('%opt-viewer', opt_viewer_cmd),
134136 ]
135137
136138 # FIXME: Why do we have both `lli` and `%lli` that do slightly different things?
285287
286288 if config.llvm_libxml2_enabled == '1':
287289 config.available_features.add('libxml2')
290
291 if config.have_opt_viewer_modules:
292 config.available_features.add('have_opt_viewer_modules')
4242 config.llvm_libxml2_enabled = "@LLVM_LIBXML2_ENABLED@"
4343 config.llvm_host_triple = '@LLVM_HOST_TRIPLE@'
4444 config.host_arch = "@HOST_ARCH@"
45 config.have_opt_viewer_modules = @LLVM_HAVE_OPT_VIEWER_MODULES@
4546
4647 # Support substitution of the tools_dir with user parameters. This is
4748 # used when we can't determine the tool dir at configuration time.
0 void bar();
1 void foo() { bar(); }
2
3 #include "or.h"
4
5 void Test(int *res, int *c, int *d, int *p, int n) {
6 int i;
7
8 #pragma clang loop vectorize(assume_safety)
9 for (i = 0; i < 1600; i++) {
10 res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
11 }
12
13 for (i = 0; i < 16; i++) {
14 res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
15 }
16
17 foo();
18
19 foo(); bar(); foo();
20 }
0 void TestH(int *res, int *c, int *d, int *p, int n) {
1 int i;
2
3 #pragma clang loop vectorize(assume_safety)
4 for (i = 0; i < 1600; i++) {
5 res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
6 }
7
8 for (i = 0; i < 16; i++) {
9 res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
10 }
11
12 foo();
13
14 foo(); bar(); foo();
15 }
0 --- !Missed
1 Pass: inline
2 Name: NoDefinition
3 DebugLoc: { File: basic/or.c, Line: 2, Column: 14 }
4 Function: foo
5 Args:
6 - Callee: bar
7 - String: ' will not be inlined into '
8 - Caller: foo
9 - String: ' because its definition is unavailable'
10 ...
11 --- !Missed
12 Pass: inline
13 Name: NoDefinition
14 DebugLoc: { File: basic/or.h, Line: 15, Column: 10 }
15 Function: TestH
16 Args:
17 - Callee: bar
18 - String: ' will not be inlined into '
19 - Caller: TestH
20 - String: ' because its definition is unavailable'
21 ...
22 --- !Analysis
23 Pass: inline
24 Name: CanBeInlined
25 DebugLoc: { File: basic/or.h, Line: 13, Column: 3 }
26 Function: TestH
27 Args:
28 - Callee: foo
29 - String: ' can be inlined into '
30 - Caller: TestH
31 - String: ' with cost='
32 - Cost: '30'
33 - String: ' (threshold='
34 - Threshold: '412'
35 - String: ')'
36 ...
37 --- !Passed
38 Pass: inline
39 Name: Inlined
40 DebugLoc: { File: basic/or.h, Line: 13, Column: 3 }
41 Function: TestH
42 Args:
43 - Callee: foo
44 - String: ' inlined into '
45 - Caller: TestH
46 ...
47 --- !Analysis
48 Pass: inline
49 Name: CanBeInlined
50 DebugLoc: { File: basic/or.h, Line: 15, Column: 3 }
51 Function: TestH
52 Args:
53 - Callee: foo
54 - String: ' can be inlined into '
55 - Caller: TestH
56 - String: ' with cost='
57 - Cost: '30'
58 - String: ' (threshold='
59 - Threshold: '412'
60 - String: ')'
61 ...
62 --- !Passed
63 Pass: inline
64 Name: Inlined
65 DebugLoc: { File: basic/or.h, Line: 15, Column: 3 }
66 Function: TestH
67 Args:
68 - Callee: foo
69 - String: ' inlined into '
70 - Caller: TestH
71 ...
72 --- !Analysis
73 Pass: inline
74 Name: CanBeInlined
75 DebugLoc: { File: basic/or.h, Line: 15, Column: 17 }
76 Function: TestH
77 Args:
78 - Callee: foo
79 - String: ' can be inlined into '
80 - Caller: TestH
81 - String: ' with cost='
82 - Cost: '30'
83 - String: ' (threshold='
84 - Threshold: '412'
85 - String: ')'
86 ...
87 --- !Passed
88 Pass: inline
89 Name: Inlined
90 DebugLoc: { File: basic/or.h, Line: 15, Column: 17 }
91 Function: TestH
92 Args:
93 - Callee: foo
94 - String: ' inlined into '
95 - Caller: TestH
96 ...
97 --- !Passed
98 Pass: loop-unroll
99 Name: FullyUnrolled
100 DebugLoc: { File: basic/or.h, Line: 9, Column: 3 }
101 Function: TestH
102 Args:
103 - String: 'completely unrolled loop with '
104 - UnrollCount: '16'
105 - String: ' iterations'
106 ...
107 --- !Missed
108 Pass: inline
109 Name: NoDefinition
110 DebugLoc: { File: basic/or.c, Line: 20, Column: 10 }
111 Function: Test
112 Args:
113 - Callee: bar
114 - String: ' will not be inlined into '
115 - Caller: Test
116 - String: ' because its definition is unavailable'
117 ...
118 --- !Analysis
119 Pass: inline
120 Name: CanBeInlined
121 DebugLoc: { File: basic/or.c, Line: 18, Column: 3 }
122 Function: Test
123 Args:
124 - Callee: foo
125 - String: ' can be inlined into '
126 - Caller: Test
127 - String: ' with cost='
128 - Cost: '30'
129 - String: ' (threshold='
130 - Threshold: '412'
131 - String: ')'
132 ...
133 --- !Passed
134 Pass: inline
135 Name: Inlined
136 DebugLoc: { File: basic/or.c, Line: 18, Column: 3 }
137 Function: Test
138 Args:
139 - Callee: foo
140 - String: ' inlined into '
141 - Caller: Test
142 ...
143 --- !Analysis
144 Pass: inline
145 Name: CanBeInlined
146 DebugLoc: { File: basic/or.c, Line: 20, Column: 3 }
147 Function: Test
148 Args:
149 - Callee: foo
150 - String: ' can be inlined into '
151 - Caller: Test
152 - String: ' with cost='
153 - Cost: '30'
154 - String: ' (threshold='
155 - Threshold: '412'
156 - String: ')'
157 ...
158 --- !Passed
159 Pass: inline
160 Name: Inlined
161 DebugLoc: { File: basic/or.c, Line: 20, Column: 3 }
162 Function: Test
163 Args:
164 - Callee: foo
165 - String: ' inlined into '
166 - Caller: Test
167 ...
168 --- !Analysis
169 Pass: inline
170 Name: CanBeInlined
171 DebugLoc: { File: basic/or.c, Line: 20, Column: 17 }
172 Function: Test
173 Args:
174 - Callee: foo
175 - String: ' can be inlined into '
176 - Caller: Test
177 - String: ' with cost='
178 - Cost: '30'
179 - String: ' (threshold='
180 - Threshold: '412'
181 - String: ')'
182 ...
183 --- !Passed
184 Pass: inline
185 Name: Inlined
186 DebugLoc: { File: basic/or.c, Line: 20, Column: 17 }
187 Function: Test
188 Args:
189 - Callee: foo
190 - String: ' inlined into '
191 - Caller: Test
192 ...
193 --- !Passed
194 Pass: loop-unroll
195 Name: FullyUnrolled
196 DebugLoc: { File: basic/or.c, Line: 14, Column: 3 }
197 Function: Test
198 Args:
199 - String: 'completely unrolled loop with '
200 - UnrollCount: '16'
201 - String: ' iterations'
202 ...
203 --- !Passed
204 Pass: loop-vectorize
205 Name: Vectorized
206 DebugLoc: { File: basic/or.h, Line: 5, Column: 3 }
207 Function: TestH
208 Args:
209 - String: 'vectorized loop (vectorization width: '
210 - VectorizationFactor: '4'
211 - String: ', interleaved count: '
212 - InterleaveCount: '2'
213 - String: ')'
214 ...
215 --- !Passed
216 Pass: loop-vectorize
217 Name: Vectorized
218 DebugLoc: { File: basic/or.c, Line: 10, Column: 3 }
219 Function: Test
220 Args:
221 - String: 'vectorized loop (vectorization width: '
222 - VectorizationFactor: '4'
223 - String: ', interleaved count: '
224 - InterleaveCount: '2'
225 - String: ')'
226 ...
0
1
2
3
4
5
6
7
8
9
10 Line
11 Hotness
12 Optimization
13 Source
14 Inline Context
15
16
17
18
19
20 1
21
22
23
void bar();
24
25
26
27 2
28
29
30
void foo() { bar(); }
31
32
33
34
35
36 inline
37
             
bar will not be inlined into foo because its definition is unavailable 
38 foo
39
40
41
42 3
43
44
45
46
47
48
49 4
50
51
52
#include "or.h"
53
54
55
56 5
57
58
59
60
61
62
63 6
64
65
66
void Test(int *res, int *c, int *d, int *p, int n) {
67
68
69
70 7
71
72
73
  int i;
74
75
76
77 8
78
79
80
81
82
83
84 9
85
86
87
#pragma clang loop vectorize(assume_safety)
88
89
90
91 10
92
93
94
  for (i = 0; i < 1600; i++) {
95
96
97
98
99
100 loop-vectorize
101
  
vectorized loop (vectorization width: 4, interleaved count: 2) 
102 Test
103
104
105
106 11
107
108
109
    res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
110
111
112
113 12
114
115
116
  }
117
118
119
120 13
121
122
123
124
125
126
127 14
128
129
130
  for (i = 0; i < 16; i++) {
131
132
133
134
135
136 loop-unroll
137
  
completely unrolled loop with 16 iterations 
138 Test
139
140
141
142 15
143
144
145
    res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
146
147
148
149 16
150
151
152
  }
153
154
155
156 17
157
158
159
160
161
162
163 18
164
165
166
  foo();
167
168
169
170
171
172 inline
173
  
foo can be inlined into Test with cost=30 (threshold=412) 
174 Test
175
176
177
178
179
180 inline
181
  
foo inlined into Test 
182 Test
183
184
185
186 19
187
188
189
190
191
192
193 20
194
195
196
  foo(); bar(); foo();
197
198
199
200
201
202 inline
203
         
bar will not be inlined into Test because its definition is unavailable 
204 Test
205
206
207
208
209
210 inline
211
  
foo can be inlined into Test with cost=30 (threshold=412) 
212 Test
213
214
215
216
217
218 inline
219
  
foo inlined into Test 
220 Test
221
222
223
224
225
226 inline
227
                
foo can be inlined into Test with cost=30 (threshold=412) 
228 Test
229
230
231
232
233
234 inline
235
                
foo inlined into Test 
236 Test
237
238
239
240 21
241
242
243
}
244
245
246
247 22
248
249
250
251
252
253
254
255
256
0
1
2
3
4
5
6
7
8
9
10 Line
11 Hotness
12 Optimization
13 Source
14 Inline Context
15
16
17
18
19
20 1
21
22
23
void TestH(int *res, int *c, int *d, int *p, int n) {
24
25
26
27 2
28
29
30
  int i;
31
32
33
34 3
35
36
37
38
39
40
41 4
42
43
44
#pragma clang loop vectorize(assume_safety)
45
46
47
48 5
49
50
51
  for (i = 0; i < 1600; i++) {
52
53
54
55
56
57 loop-vectorize
58
  
vectorized loop (vectorization width: 4, interleaved count: 2) 
59 TestH
60
61
62
63 6
64
65
66
    res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
67
68
69
70 7
71
72
73
  }
74
75
76
77 8
78
79
80
81
82
83
84 9
85
86
87
  for (i = 0; i < 16; i++) {
88
89
90
91
92
93 loop-unroll
94
  
completely unrolled loop with 16 iterations 
95 TestH
96
97
98
99 10
100
101
102
    res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
103
104
105
106 11
107
108
109
  }
110
111
112
113 12
114
115
116
117
118
119
120 13
121
122
123
  foo();
124
125
126
127
128
129 inline
130
  
foo can be inlined into TestH with cost=30 (threshold=412) 
131 TestH
132
133
134
135
136
137 inline
138
  
foo inlined into TestH 
139 TestH
140
141
142
143 14
144
145
146
147
148
149
150 15
151
152
153
  foo(); bar(); foo();
154
155
156
157
158
159 inline
160
         
bar will not be inlined into TestH because its definition is unavailable 
161 TestH
162
163
164
165
166
167 inline
168
  
foo can be inlined into TestH with cost=30 (threshold=412) 
169 TestH
170
171
172
173
174
175 inline
176
  
foo inlined into TestH 
177 TestH
178
179
180
181
182
183 inline
184
                
foo can be inlined into TestH with cost=30 (threshold=412) 
185 TestH
186
187
188
189
190
191 inline
192
                
foo inlined into TestH 
193 TestH
194
195
196
197 16
198
199
200
}
201
202
203
204 17
205
206
207
208
209
210
211
212
213
0
1
2
3
4
5
6
7
8
9 Source Location
10 Hotness
11 Function
12 Pass
13
14
15
16 basic/or.c:2:14
17
18 foo
19 inline
20
21
22
23 basic/or.c:10:3
24
25 Test
26 loop-vectorize
27
28
29
30 basic/or.c:14:3
31
32 Test
33 loop-unroll
34
35
36
37 basic/or.c:18:3
38
39 Test
40 inline
41
42
43
44 basic/or.c:18:3
45
46 Test
47 inline
48
49
50
51 basic/or.c:20:3
52
53 Test
54 inline
55
56
57
58 basic/or.c:20:3
59
60 Test
61 inline
62
63
64
65 basic/or.c:20:10
66
67 Test
68 inline
69
70
71
72 basic/or.c:20:17
73
74 Test
75 inline
76
77
78
79 basic/or.c:20:17
80
81 Test
82 inline
83
84
85
86 basic/or.h:5:3
87
88 TestH
89 loop-vectorize
90
91
92
93 basic/or.h:9:3
94
95 TestH
96 loop-unroll
97
98
99
100 basic/or.h:13:3
101
102 TestH
103 inline
104
105
106
107 basic/or.h:13:3
108
109 TestH
110 inline
111
112
113
114 basic/or.h:15:3
115
116 TestH
117 inline
118
119
120
121 basic/or.h:15:3
122
123 TestH
124 inline
125
126
127
128 basic/or.h:15:10
129
130 TestH
131 inline
132
133
134
135 basic/or.h:15:17
136
137 TestH
138 inline
139
140
141
142 basic/or.h:15:17
143
144 TestH
145 inline
146
147
148
149
150
0 .source {
1 table-layout: fixed;
2 width: 100%;
3 white-space: nowrap;
4 }
5 .source td {
6 white-space: nowrap;
7 overflow: hidden;
8 text-overflow: ellipsis;
9 }
10 .red {
11 background-color: #ffd0d0;
12 }
13 .cyan {
14 background-color: cyan;
15 }
16 body {
17 font-family: -apple-system, sans-serif;
18 }
19 pre {
20 margin-top: 0px !important;
21 margin-bottom: 0px !important;
22 }
23 .source-name-title {
24 padding: 5px 10px;
25 border-bottom: 1px solid #dbdbdb;
26 background-color: #eee;
27 line-height: 35px;
28 }
29 .centered {
30 display: table;
31 margin-left: left;
32 margin-right: auto;
33 border: 1px solid #dbdbdb;
34 border-radius: 3px;
35 }
36 .expansion-view {
37 background-color: rgba(0, 0, 0, 0);
38 margin-left: 0px;
39 margin-top: 5px;
40 margin-right: 5px;
41 margin-bottom: 5px;
42 border: 1px solid #dbdbdb;
43 border-radius: 3px;
44 }
45 table {
46 border-collapse: collapse;
47 }
48 .light-row {
49 background: #ffffff;
50 border: 1px solid #dbdbdb;
51 }
52 .column-entry {
53 text-align: right;
54 }
55 .column-entry-left {
56 text-align: left;
57 }
58 .column-entry-white {
59 text-align: right;
60 background-color: #ffffff;
61 }
62 .column-entry-red {
63 text-align: right;
64 background-color: #ffd0d0;
65 }
66 .column-entry-green {
67 text-align: right;
68 background-color: #d0ffd0;
69 }
70 .column-entry-yellow {
71 text-align: left;
72 background-color: #ffe1a6;
73 }
74 .column-entry-0 {
75 background-color: #ffffff;
76 }
77 .column-entry-1 {
78 background-color: #eeeeee;
79 }
80 .line-number {
81 text-align: right;
82 color: #aaa;
83 }
84 .covered-line {
85 text-align: right;
86 color: #0080ff;
87 }
88 .uncovered-line {
89 text-align: right;
90 color: #ff3300;
91 }
92 .tooltip {
93 position: relative;
94 display: inline;
95 background-color: #b3e6ff;
96 text-decoration: none;
97 }
98 .tooltip span.tooltip-content {
99 position: absolute;
100 width: 100px;
101 margin-left: -50px;
102 color: #FFFFFF;
103 background: #000000;
104 height: 30px;
105 line-height: 30px;
106 text-align: center;
107 visibility: hidden;
108 border-radius: 6px;
109 }
110 .tooltip span.tooltip-content:after {
111 content: '';
112 position: absolute;
113 top: 100%;
114 left: 50%;
115 margin-left: -8px;
116 width: 0; height: 0;
117 border-top: 8px solid #000000;
118 border-right: 8px solid transparent;
119 border-left: 8px solid transparent;
120 }
121 :hover.tooltip span.tooltip-content {
122 visibility: visible;
123 opacity: 0.8;
124 bottom: 30px;
125 left: 50%;
126 z-index: 999;
127 }
128 th, td {
129 vertical-align: top;
130 padding: 2px 5px;
131 border-collapse: collapse;
132 border-right: solid 1px #eee;
133 border-left: solid 1px #eee;
134 }
135 td:first-child {
136 border-left: none;
137 }
138 td:last-child {
139 border-right: none;
140 }
141
142 /* Generated with pygmentize -S colorful -f html >> style.css */
143
144 .hll { background-color: #ffffcc }
145 .c { color: #888888 } /* Comment */
146 .err { color: #FF0000; background-color: #FFAAAA } /* Error */
147 .k { color: #008800; font-weight: bold } /* Keyword */
148 .o { color: #333333 } /* Operator */
149 .ch { color: #888888 } /* Comment.Hashbang */
150 .cm { color: #888888 } /* Comment.Multiline */
151 .cp { color: #557799 } /* Comment.Preproc */
152 .cpf { color: #888888 } /* Comment.PreprocFile */
153 .c1 { color: #888888 } /* Comment.Single */
154 .cs { color: #cc0000; font-weight: bold } /* Comment.Special */
155 .gd { color: #A00000 } /* Generic.Deleted */
156 .ge { font-style: italic } /* Generic.Emph */
157 .gr { color: #FF0000 } /* Generic.Error */
158 .gh { color: #000080; font-weight: bold } /* Generic.Heading */
159 .gi { color: #00A000 } /* Generic.Inserted */
160 .go { color: #888888 } /* Generic.Output */
161 .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
162 .gs { font-weight: bold } /* Generic.Strong */
163 .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
164 .gt { color: #0044DD } /* Generic.Traceback */
165 .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
166 .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
167 .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
168 .kp { color: #003388; font-weight: bold } /* Keyword.Pseudo */
169 .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
170 .kt { color: #333399; font-weight: bold } /* Keyword.Type */
171 .m { color: #6600EE; font-weight: bold } /* Literal.Number */
172 .s { background-color: #fff0f0 } /* Literal.String */
173 .na { color: #0000CC } /* Name.Attribute */
174 .nb { color: #007020 } /* Name.Builtin */
175 .nc { color: #BB0066; font-weight: bold } /* Name.Class */
176 .no { color: #003366; font-weight: bold } /* Name.Constant */
177 .nd { color: #555555; font-weight: bold } /* Name.Decorator */
178 .ni { color: #880000; font-weight: bold } /* Name.Entity */
179 .ne { color: #FF0000; font-weight: bold } /* Name.Exception */
180 .nf { color: #0066BB; font-weight: bold } /* Name.Function */
181 .nl { color: #997700; font-weight: bold } /* Name.Label */
182 .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
183 .nt { color: #007700 } /* Name.Tag */
184 .nv { color: #996633 } /* Name.Variable */
185 .ow { color: #000000; font-weight: bold } /* Operator.Word */
186 .w { color: #bbbbbb } /* Text.Whitespace */
187 .mb { color: #6600EE; font-weight: bold } /* Literal.Number.Bin */
188 .mf { color: #6600EE; font-weight: bold } /* Literal.Number.Float */
189 .mh { color: #005588; font-weight: bold } /* Literal.Number.Hex */
190 .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
191 .mo { color: #4400EE; font-weight: bold } /* Literal.Number.Oct */
192 .sb { background-color: #fff0f0 } /* Literal.String.Backtick */
193 .sc { color: #0044DD } /* Literal.String.Char */
194 .sd { color: #DD4422 } /* Literal.String.Doc */
195 .s2 { background-color: #fff0f0 } /* Literal.String.Double */
196 .se { color: #666666; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */
197 .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */
198 .si { background-color: #eeeeee } /* Literal.String.Interpol */
199 .sx { color: #DD2200; background-color: #fff0f0 } /* Literal.String.Other */
200 .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */
201 .s1 { background-color: #fff0f0 } /* Literal.String.Single */
202 .ss { color: #AA6600 } /* Literal.String.Symbol */
203 .bp { color: #007020 } /* Name.Builtin.Pseudo */
204 .vc { color: #336699 } /* Name.Variable.Class */
205 .vg { color: #dd7700; font-weight: bold } /* Name.Variable.Global */
206 .vi { color: #3333BB } /* Name.Variable.Instance */
207 .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
0 # Since we're performing a full compare of the generate HTML files disable
1 # syntax highlighting; pygments generates slightly different code with
2 # different versions.
3
4 RUN: %opt-viewer -s %p/Inputs -o %t %p/Inputs/basic/or.yaml --no-highlight
5 RUN: diff %p/Outputs/basic/index.html %t/index.html
6 RUN: diff %p/Outputs/basic/basic_or.h.html %t/basic_or.h.html
7 RUN: diff %p/Outputs/basic/basic_or.c.html %t/basic_or.c.html
8 RUN: ls %t/style.css
0 if 'have_opt_viewer_modules' not in config.available_features:
1 config.unsupported = True
5959
6060 def render_source_lines(self, stream, line_remarks):
6161 file_text = stream.read()
62 html_highlighted = highlight(
62
63 if args.no_highlight:
64 html_highlighted = file_text
65 else:
66 html_highlighted = highlight(
6367 file_text,
64 self.cpp_lexer,
65 self.html_formatter)
66
67 # On Python 3, pygments.highlight() returns a bytes object, not a str.
68 if sys.version_info >= (3, 0):
69 html_highlighted = html_highlighted.decode('utf-8')
70
71 # Take off the header and footer, these must be
72 # reapplied line-wise, within the page structure
73 html_highlighted = html_highlighted.replace('
', '')

                  
                
74 html_highlighted = html_highlighted.replace('', '')
68 self.cpp_lexer,
69 self.html_formatter)
70
71 # On Python 3, pygments.highlight() returns a bytes object, not a str.
72 if sys.version_info >= (3, 0):
73 html_highlighted = html_highlighted.decode('utf-8')
74
75 # Take off the header and footer, these must be
76 # reapplied line-wise, within the page structure
77 html_highlighted = html_highlighted.replace('
', '')

                  
                
78 html_highlighted = html_highlighted.replace('', '')
7579
7680 for (linenum, html_line) in enumerate(html_highlighted.split('\n'), start=1):
7781 print('''
273277 default=1000,
274278 type=int,
275279 help='Maximum number of the hottest remarks to appear on the index page')
280 parser.add_argument(
281 '--no-highlight',
282 action='store_true',
283 default=False,
284 help='Do not use a syntax highlighter when rendering the source code')
276285 args = parser.parse_args()
277286
278287 print_progress = not args.no_progress_indicator