summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/vulkan/vulkan-samples/0001-Qualify-move-as-std-move.patch
blob: 80ee521499f36c20b76744703ff07f5c83fda33f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
From 9e061b12b9305eee96a4d3129b646c244cc02347 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 14 Aug 2022 19:16:45 -0700
Subject: [PATCH] Qualify move as std::move

Seeing errors like below with clang-15

spirv_common.hpp:692:19: error: unqualified call to std::move

squashed Backport of following upstream commits

https://github.com/KhronosGroup/SPIRV-Cross/commit/44c3333a1c315ead00c24f7aef5fa8a7ccf49299
https://github.com/KhronosGroup/SPIRV-Cross/commit/0eda71c40936586ea812d0d20d93c11a3e9af192

Upstream-Status: Backport [https://github.com/KhronosGroup/SPIRV-Cross/commit/0eda71c40936586ea812d0d20d93c11a3e9af192]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 main.cpp          | 38 +++++++++++++++++++-------------------
 spirv_common.hpp  |  2 +-
 spirv_cpp.hpp     |  2 +-
 spirv_cross.cpp   | 18 +++++++++---------
 spirv_glsl.cpp    |  2 +-
 spirv_glsl.hpp    |  2 +-
 spirv_hlsl.cpp    |  4 ++--
 spirv_hlsl.hpp    |  2 +-
 spirv_msl.cpp     |  2 +-
 spirv_parser.cpp  |  4 ++--
 spirv_reflect.hpp |  2 +-
 11 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/main.cpp b/main.cpp
index 78991094..581c5e3b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -65,7 +65,7 @@ struct CLICallbacks
 struct CLIParser
 {
 	CLIParser(CLICallbacks cbs_, int argc_, char *argv_[])
-	    : cbs(move(cbs_))
+	    : cbs(std::move(cbs_))
 	    , argc(argc_)
 	    , argv(argv_)
 	{
@@ -722,7 +722,7 @@ static int main_inner(int argc, char *argv[])
 		auto old_name = parser.next_string();
 		auto new_name = parser.next_string();
 		auto model = stage_to_execution_model(parser.next_string());
-		args.entry_point_rename.push_back({ old_name, new_name, move(model) });
+		args.entry_point_rename.push_back({ old_name, new_name, std::move(model) });
 	});
 	cbs.add("--entry", [&args](CLIParser &parser) { args.entry = parser.next_string(); });
 	cbs.add("--stage", [&args](CLIParser &parser) { args.entry_stage = parser.next_string(); });
@@ -731,20 +731,20 @@ static int main_inner(int argc, char *argv[])
 		HLSLVertexAttributeRemap remap;
 		remap.location = parser.next_uint();
 		remap.semantic = parser.next_string();
-		args.hlsl_attr_remap.push_back(move(remap));
+		args.hlsl_attr_remap.push_back(std::move(remap));
 	});
 
 	cbs.add("--remap", [&args](CLIParser &parser) {
 		string src = parser.next_string();
 		string dst = parser.next_string();
 		uint32_t components = parser.next_uint();
-		args.remaps.push_back({ move(src), move(dst), components });
+		args.remaps.push_back({ std::move(src), std::move(dst), components });
 	});
 
 	cbs.add("--remap-variable-type", [&args](CLIParser &parser) {
 		string var_name = parser.next_string();
 		string new_type = parser.next_string();
-		args.variable_type_remaps.push_back({ move(var_name), move(new_type) });
+		args.variable_type_remaps.push_back({ std::move(var_name), std::move(new_type) });
 	});
 
 	cbs.add("--rename-interface-variable", [&args](CLIParser &parser) {
@@ -757,18 +757,18 @@ static int main_inner(int argc, char *argv[])
 
 		uint32_t loc = parser.next_uint();
 		string var_name = parser.next_string();
-		args.interface_variable_renames.push_back({ cls, loc, move(var_name) });
+		args.interface_variable_renames.push_back({ cls, loc, std::move(var_name) });
 	});
 
 	cbs.add("--pls-in", [&args](CLIParser &parser) {
 		auto fmt = pls_format(parser.next_string());
 		auto name = parser.next_string();
-		args.pls_in.push_back({ move(fmt), move(name) });
+		args.pls_in.push_back({ std::move(fmt), std::move(name) });
 	});
 	cbs.add("--pls-out", [&args](CLIParser &parser) {
 		auto fmt = pls_format(parser.next_string());
 		auto name = parser.next_string();
-		args.pls_out.push_back({ move(fmt), move(name) });
+		args.pls_out.push_back({ std::move(fmt), std::move(name) });
 	});
 	cbs.add("--shader-model", [&args](CLIParser &parser) {
 		args.shader_model = parser.next_uint();
@@ -788,7 +788,7 @@ static int main_inner(int argc, char *argv[])
 	cbs.default_handler = [&args](const char *value) { args.input = value; };
 	cbs.error_handler = [] { print_help(); };
 
-	CLIParser parser{ move(cbs), argc - 1, argv + 1 };
+	CLIParser parser{ std::move(cbs), argc - 1, argv + 1 };
 	if (!parser.parse())
 	{
 		return EXIT_FAILURE;
@@ -808,14 +808,14 @@ static int main_inner(int argc, char *argv[])
 	auto spirv_file = read_spirv_file(args.input);
 	if (spirv_file.empty())
 		return EXIT_FAILURE;
-	Parser spirv_parser(move(spirv_file));
+	Parser spirv_parser(std::move(spirv_file));
 
 	spirv_parser.parse();
 
 	// Special case reflection because it has little to do with the path followed by code-outputting compilers
 	if (!args.reflect.empty())
 	{
-		CompilerReflection compiler(move(spirv_parser.get_parsed_ir()));
+		CompilerReflection compiler(std::move(spirv_parser.get_parsed_ir()));
 		compiler.set_format(args.reflect);
 		auto json = compiler.compile();
 		if (args.output)
@@ -831,13 +831,13 @@ static int main_inner(int argc, char *argv[])
 
 	if (args.cpp)
 	{
-		compiler.reset(new CompilerCPP(move(spirv_parser.get_parsed_ir())));
+		compiler.reset(new CompilerCPP(std::move(spirv_parser.get_parsed_ir())));
 		if (args.cpp_interface_name)
 			static_cast<CompilerCPP *>(compiler.get())->set_interface_name(args.cpp_interface_name);
 	}
 	else if (args.msl)
 	{
-		compiler.reset(new CompilerMSL(move(spirv_parser.get_parsed_ir())));
+		compiler.reset(new CompilerMSL(std::move(spirv_parser.get_parsed_ir())));
 
 		auto *msl_comp = static_cast<CompilerMSL *>(compiler.get());
 		auto msl_opts = msl_comp->get_msl_options();
@@ -850,13 +850,13 @@ static int main_inner(int argc, char *argv[])
 		msl_comp->set_msl_options(msl_opts);
 	}
 	else if (args.hlsl)
-		compiler.reset(new CompilerHLSL(move(spirv_parser.get_parsed_ir())));
+		compiler.reset(new CompilerHLSL(std::move(spirv_parser.get_parsed_ir())));
 	else
 	{
 		combined_image_samplers = !args.vulkan_semantics;
 		if (!args.vulkan_semantics)
 			build_dummy_sampler = true;
-		compiler.reset(new CompilerGLSL(move(spirv_parser.get_parsed_ir())));
+		compiler.reset(new CompilerGLSL(std::move(spirv_parser.get_parsed_ir())));
 	}
 
 	if (!args.variable_type_remaps.empty())
@@ -867,7 +867,7 @@ static int main_inner(int argc, char *argv[])
 					out = remap.new_variable_type;
 		};
 
-		compiler->set_variable_type_remap_callback(move(remap_cb));
+		compiler->set_variable_type_remap_callback(std::move(remap_cb));
 	}
 
 	for (auto &rename : args.entry_point_rename)
@@ -1019,7 +1019,7 @@ static int main_inner(int argc, char *argv[])
 	{
 		auto active = compiler->get_active_interface_variables();
 		res = compiler->get_shader_resources(active);
-		compiler->set_enabled_interface_variables(move(active));
+		compiler->set_enabled_interface_variables(std::move(active));
 	}
 	else
 		res = compiler->get_shader_resources();
@@ -1034,7 +1034,7 @@ static int main_inner(int argc, char *argv[])
 
 	auto pls_inputs = remap_pls(args.pls_in, res.stage_inputs, &res.subpass_inputs);
 	auto pls_outputs = remap_pls(args.pls_out, res.stage_outputs, nullptr);
-	compiler->remap_pixel_local_storage(move(pls_inputs), move(pls_outputs));
+	compiler->remap_pixel_local_storage(std::move(pls_inputs), std::move(pls_outputs));
 
 	for (auto &ext : args.extensions)
 		compiler->require_extension(ext);
@@ -1101,7 +1101,7 @@ static int main_inner(int argc, char *argv[])
 	for (uint32_t i = 0; i < args.iterations; i++)
 	{
 		if (args.hlsl)
-			glsl = static_cast<CompilerHLSL *>(compiler.get())->compile(move(args.hlsl_attr_remap));
+			glsl = static_cast<CompilerHLSL *>(compiler.get())->compile(std::move(args.hlsl_attr_remap));
 		else
 			glsl = compiler->compile();
 	}
diff --git a/spirv_common.hpp b/spirv_common.hpp
index aa32142d..0daf5ad5 100644
--- a/spirv_common.hpp
+++ b/spirv_common.hpp
@@ -536,7 +536,7 @@ struct SPIRExpression : IVariant
 
 	// Only created by the backend target to avoid creating tons of temporaries.
 	SPIRExpression(std::string expr, uint32_t expression_type_, bool immutable_)
-	    : expression(move(expr))
+	    : expression(std::move(expr))
 	    , expression_type(expression_type_)
 	    , immutable(immutable_)
 	{
diff --git a/spirv_cpp.hpp b/spirv_cpp.hpp
index bcdb669b..b4da84b9 100644
--- a/spirv_cpp.hpp
+++ b/spirv_cpp.hpp
@@ -27,7 +27,7 @@ class CompilerCPP : public CompilerGLSL
 {
 public:
 	explicit CompilerCPP(std::vector<uint32_t> spirv_)
-	    : CompilerGLSL(move(spirv_))
+	    : CompilerGLSL(std::move(spirv_))
 	{
 	}
 
diff --git a/spirv_cross.cpp b/spirv_cross.cpp
index 19bac301..d21dbd41 100644
--- a/spirv_cross.cpp
+++ b/spirv_cross.cpp
@@ -28,16 +28,16 @@ using namespace spirv_cross;
 
 Compiler::Compiler(vector<uint32_t> ir_)
 {
-	Parser parser(move(ir_));
+	Parser parser(std::move(ir_));
 	parser.parse();
-	set_ir(move(parser.get_parsed_ir()));
+	set_ir(std::move(parser.get_parsed_ir()));
 }
 
 Compiler::Compiler(const uint32_t *ir_, size_t word_count)
 {
 	Parser parser(ir_, word_count);
 	parser.parse();
-	set_ir(move(parser.get_parsed_ir()));
+	set_ir(std::move(parser.get_parsed_ir()));
 }
 
 Compiler::Compiler(const ParsedIR &ir_)
@@ -47,12 +47,12 @@ Compiler::Compiler(const ParsedIR &ir_)
 
 Compiler::Compiler(ParsedIR &&ir_)
 {
-	set_ir(move(ir_));
+	set_ir(std::move(ir_));
 }
 
 void Compiler::set_ir(ParsedIR &&ir_)
 {
-	ir = move(ir_);
+	ir = std::move(ir_);
 	parse_fixup();
 }
 
@@ -716,7 +716,7 @@ unordered_set<uint32_t> Compiler::get_active_interface_variables() const
 
 void Compiler::set_enabled_interface_variables(std::unordered_set<uint32_t> active_variables)
 {
-	active_interface_variables = move(active_variables);
+	active_interface_variables = std::move(active_variables);
 	check_active_interface_variables = true;
 }
 
@@ -2163,7 +2163,7 @@ void Compiler::CombinedImageSamplerHandler::push_remap_parameters(const SPIRFunc
 	unordered_map<uint32_t, uint32_t> remapping;
 	for (uint32_t i = 0; i < length; i++)
 		remapping[func.arguments[i].id] = remap_parameter(args[i]);
-	parameter_remapping.push(move(remapping));
+	parameter_remapping.push(std::move(remapping));
 }
 
 void Compiler::CombinedImageSamplerHandler::pop_remap_parameters()
@@ -3611,7 +3611,7 @@ void Compiler::analyze_image_and_sampler_usage()
 
 	CombinedImageSamplerUsageHandler handler(*this, dref_handler.dref_combined_samplers);
 	traverse_all_reachable_opcodes(get<SPIRFunction>(ir.default_entry_point), handler);
-	comparison_ids = move(handler.comparison_ids);
+	comparison_ids = std::move(handler.comparison_ids);
 	need_subpass_input = handler.need_subpass_input;
 
 	// Forward information from separate images and samplers into combined image samplers.
@@ -3650,7 +3650,7 @@ void Compiler::build_function_control_flow_graphs_and_analyze()
 	CFGBuilder handler(*this);
 	handler.function_cfgs[ir.default_entry_point].reset(new CFG(*this, get<SPIRFunction>(ir.default_entry_point)));
 	traverse_all_reachable_opcodes(get<SPIRFunction>(ir.default_entry_point), handler);
-	function_cfgs = move(handler.function_cfgs);
+	function_cfgs = std::move(handler.function_cfgs);
 
 	for (auto &f : function_cfgs)
 	{
diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp
index a8855987..fabbb105 100644
--- a/spirv_glsl.cpp
+++ b/spirv_glsl.cpp
@@ -6876,7 +6876,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
 		bool ptr_chain = opcode == OpPtrAccessChain;
 		auto e = access_chain(ops[2], &ops[3], length - 3, get<SPIRType>(ops[0]), &meta, ptr_chain);
 
-		auto &expr = set<SPIRExpression>(ops[1], move(e), ops[0], should_forward(ops[2]));
+		auto &expr = set<SPIRExpression>(ops[1], std::move(e), ops[0], should_forward(ops[2]));
 
 		auto *backing_variable = maybe_get_backing_variable(ops[2]);
 		expr.loaded_from = backing_variable ? backing_variable->self : ops[2];
diff --git a/spirv_glsl.hpp b/spirv_glsl.hpp
index caf0ad3b..aac1196e 100644
--- a/spirv_glsl.hpp
+++ b/spirv_glsl.hpp
@@ -138,7 +138,7 @@ public:
 	}
 
 	explicit CompilerGLSL(std::vector<uint32_t> spirv_)
-	    : Compiler(move(spirv_))
+	    : Compiler(std::move(spirv_))
 	{
 		init();
 	}
diff --git a/spirv_hlsl.cpp b/spirv_hlsl.cpp
index a5b6d2dc..0933017e 100644
--- a/spirv_hlsl.cpp
+++ b/spirv_hlsl.cpp
@@ -2028,7 +2028,7 @@ void CompilerHLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret
 		out_argument += " ";
 		out_argument += "SPIRV_Cross_return_value";
 		out_argument += type_to_array_glsl(type);
-		arglist.push_back(move(out_argument));
+		arglist.push_back(std::move(out_argument));
 	}
 
 	for (auto &arg : func.arguments)
@@ -4553,7 +4553,7 @@ void CompilerHLSL::require_texture_query_variant(const SPIRType &type)
 
 string CompilerHLSL::compile(std::vector<HLSLVertexAttributeRemap> vertex_attributes)
 {
-	remap_vertex_attributes = move(vertex_attributes);
+	remap_vertex_attributes = std::move(vertex_attributes);
 	return compile();
 }
 
diff --git a/spirv_hlsl.hpp b/spirv_hlsl.hpp
index b2b60fca..3503c674 100644
--- a/spirv_hlsl.hpp
+++ b/spirv_hlsl.hpp
@@ -63,7 +63,7 @@ public:
 	};
 
 	explicit CompilerHLSL(std::vector<uint32_t> spirv_)
-	    : CompilerGLSL(move(spirv_))
+	    : CompilerGLSL(std::move(spirv_))
 	{
 	}
 
diff --git a/spirv_msl.cpp b/spirv_msl.cpp
index 0e1e733d..fbfcdba5 100644
--- a/spirv_msl.cpp
+++ b/spirv_msl.cpp
@@ -32,7 +32,7 @@ static const uint32_t k_aux_mbr_idx_swizzle_const = 0u;
 
 CompilerMSL::CompilerMSL(vector<uint32_t> spirv_, vector<MSLVertexAttr> *p_vtx_attrs,
                          vector<MSLResourceBinding> *p_res_bindings)
-    : CompilerGLSL(move(spirv_))
+    : CompilerGLSL(std::move(spirv_))
 {
 	if (p_vtx_attrs)
 		for (auto &va : *p_vtx_attrs)
diff --git a/spirv_parser.cpp b/spirv_parser.cpp
index 1725b4ca..0fcd7691 100644
--- a/spirv_parser.cpp
+++ b/spirv_parser.cpp
@@ -24,7 +24,7 @@ namespace spirv_cross
 {
 Parser::Parser(std::vector<uint32_t> spirv)
 {
-	ir.spirv = move(spirv);
+	ir.spirv = std::move(spirv);
 }
 
 Parser::Parser(const uint32_t *spirv_data, size_t word_count)
@@ -223,7 +223,7 @@ void Parser::parse(const Instruction &instruction)
 	case OpExtension:
 	{
 		auto ext = extract_string(ir.spirv, instruction.offset);
-		ir.declared_extensions.push_back(move(ext));
+		ir.declared_extensions.push_back(std::move(ext));
 		break;
 	}
 
diff --git a/spirv_reflect.hpp b/spirv_reflect.hpp
index 13b5b431..f5c6a6ff 100644
--- a/spirv_reflect.hpp
+++ b/spirv_reflect.hpp
@@ -34,7 +34,7 @@ class CompilerReflection : public CompilerGLSL
 
 public:
 	explicit CompilerReflection(std::vector<uint32_t> spirv_)
-	    : Parent(move(spirv_))
+	    : Parent(std::move(spirv_))
 	{
 		options.vulkan_semantics = true;
 	}
-- 
2.37.2