Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 1 | From 9e061b12b9305eee96a4d3129b646c244cc02347 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 14 Aug 2022 19:16:45 -0700 |
| 4 | Subject: [PATCH] Qualify move as std::move |
| 5 | |
| 6 | Seeing errors like below with clang-15 |
| 7 | |
| 8 | spirv_common.hpp:692:19: error: unqualified call to std::move |
| 9 | |
| 10 | squashed Backport of following upstream commits |
| 11 | |
| 12 | https://github.com/KhronosGroup/SPIRV-Cross/commit/44c3333a1c315ead00c24f7aef5fa8a7ccf49299 |
| 13 | https://github.com/KhronosGroup/SPIRV-Cross/commit/0eda71c40936586ea812d0d20d93c11a3e9af192 |
| 14 | |
| 15 | Upstream-Status: Backport [https://github.com/KhronosGroup/SPIRV-Cross/commit/0eda71c40936586ea812d0d20d93c11a3e9af192] |
| 16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 17 | --- |
| 18 | main.cpp | 38 +++++++++++++++++++------------------- |
| 19 | spirv_common.hpp | 2 +- |
| 20 | spirv_cpp.hpp | 2 +- |
| 21 | spirv_cross.cpp | 18 +++++++++--------- |
| 22 | spirv_glsl.cpp | 2 +- |
| 23 | spirv_glsl.hpp | 2 +- |
| 24 | spirv_hlsl.cpp | 4 ++-- |
| 25 | spirv_hlsl.hpp | 2 +- |
| 26 | spirv_msl.cpp | 2 +- |
| 27 | spirv_parser.cpp | 4 ++-- |
| 28 | spirv_reflect.hpp | 2 +- |
| 29 | 11 files changed, 39 insertions(+), 39 deletions(-) |
| 30 | |
| 31 | diff --git a/main.cpp b/main.cpp |
| 32 | index 78991094..581c5e3b 100644 |
| 33 | --- a/main.cpp |
| 34 | +++ b/main.cpp |
| 35 | @@ -65,7 +65,7 @@ struct CLICallbacks |
| 36 | struct CLIParser |
| 37 | { |
| 38 | CLIParser(CLICallbacks cbs_, int argc_, char *argv_[]) |
| 39 | - : cbs(move(cbs_)) |
| 40 | + : cbs(std::move(cbs_)) |
| 41 | , argc(argc_) |
| 42 | , argv(argv_) |
| 43 | { |
| 44 | @@ -722,7 +722,7 @@ static int main_inner(int argc, char *argv[]) |
| 45 | auto old_name = parser.next_string(); |
| 46 | auto new_name = parser.next_string(); |
| 47 | auto model = stage_to_execution_model(parser.next_string()); |
| 48 | - args.entry_point_rename.push_back({ old_name, new_name, move(model) }); |
| 49 | + args.entry_point_rename.push_back({ old_name, new_name, std::move(model) }); |
| 50 | }); |
| 51 | cbs.add("--entry", [&args](CLIParser &parser) { args.entry = parser.next_string(); }); |
| 52 | cbs.add("--stage", [&args](CLIParser &parser) { args.entry_stage = parser.next_string(); }); |
| 53 | @@ -731,20 +731,20 @@ static int main_inner(int argc, char *argv[]) |
| 54 | HLSLVertexAttributeRemap remap; |
| 55 | remap.location = parser.next_uint(); |
| 56 | remap.semantic = parser.next_string(); |
| 57 | - args.hlsl_attr_remap.push_back(move(remap)); |
| 58 | + args.hlsl_attr_remap.push_back(std::move(remap)); |
| 59 | }); |
| 60 | |
| 61 | cbs.add("--remap", [&args](CLIParser &parser) { |
| 62 | string src = parser.next_string(); |
| 63 | string dst = parser.next_string(); |
| 64 | uint32_t components = parser.next_uint(); |
| 65 | - args.remaps.push_back({ move(src), move(dst), components }); |
| 66 | + args.remaps.push_back({ std::move(src), std::move(dst), components }); |
| 67 | }); |
| 68 | |
| 69 | cbs.add("--remap-variable-type", [&args](CLIParser &parser) { |
| 70 | string var_name = parser.next_string(); |
| 71 | string new_type = parser.next_string(); |
| 72 | - args.variable_type_remaps.push_back({ move(var_name), move(new_type) }); |
| 73 | + args.variable_type_remaps.push_back({ std::move(var_name), std::move(new_type) }); |
| 74 | }); |
| 75 | |
| 76 | cbs.add("--rename-interface-variable", [&args](CLIParser &parser) { |
| 77 | @@ -757,18 +757,18 @@ static int main_inner(int argc, char *argv[]) |
| 78 | |
| 79 | uint32_t loc = parser.next_uint(); |
| 80 | string var_name = parser.next_string(); |
| 81 | - args.interface_variable_renames.push_back({ cls, loc, move(var_name) }); |
| 82 | + args.interface_variable_renames.push_back({ cls, loc, std::move(var_name) }); |
| 83 | }); |
| 84 | |
| 85 | cbs.add("--pls-in", [&args](CLIParser &parser) { |
| 86 | auto fmt = pls_format(parser.next_string()); |
| 87 | auto name = parser.next_string(); |
| 88 | - args.pls_in.push_back({ move(fmt), move(name) }); |
| 89 | + args.pls_in.push_back({ std::move(fmt), std::move(name) }); |
| 90 | }); |
| 91 | cbs.add("--pls-out", [&args](CLIParser &parser) { |
| 92 | auto fmt = pls_format(parser.next_string()); |
| 93 | auto name = parser.next_string(); |
| 94 | - args.pls_out.push_back({ move(fmt), move(name) }); |
| 95 | + args.pls_out.push_back({ std::move(fmt), std::move(name) }); |
| 96 | }); |
| 97 | cbs.add("--shader-model", [&args](CLIParser &parser) { |
| 98 | args.shader_model = parser.next_uint(); |
| 99 | @@ -788,7 +788,7 @@ static int main_inner(int argc, char *argv[]) |
| 100 | cbs.default_handler = [&args](const char *value) { args.input = value; }; |
| 101 | cbs.error_handler = [] { print_help(); }; |
| 102 | |
| 103 | - CLIParser parser{ move(cbs), argc - 1, argv + 1 }; |
| 104 | + CLIParser parser{ std::move(cbs), argc - 1, argv + 1 }; |
| 105 | if (!parser.parse()) |
| 106 | { |
| 107 | return EXIT_FAILURE; |
| 108 | @@ -808,14 +808,14 @@ static int main_inner(int argc, char *argv[]) |
| 109 | auto spirv_file = read_spirv_file(args.input); |
| 110 | if (spirv_file.empty()) |
| 111 | return EXIT_FAILURE; |
| 112 | - Parser spirv_parser(move(spirv_file)); |
| 113 | + Parser spirv_parser(std::move(spirv_file)); |
| 114 | |
| 115 | spirv_parser.parse(); |
| 116 | |
| 117 | // Special case reflection because it has little to do with the path followed by code-outputting compilers |
| 118 | if (!args.reflect.empty()) |
| 119 | { |
| 120 | - CompilerReflection compiler(move(spirv_parser.get_parsed_ir())); |
| 121 | + CompilerReflection compiler(std::move(spirv_parser.get_parsed_ir())); |
| 122 | compiler.set_format(args.reflect); |
| 123 | auto json = compiler.compile(); |
| 124 | if (args.output) |
| 125 | @@ -831,13 +831,13 @@ static int main_inner(int argc, char *argv[]) |
| 126 | |
| 127 | if (args.cpp) |
| 128 | { |
| 129 | - compiler.reset(new CompilerCPP(move(spirv_parser.get_parsed_ir()))); |
| 130 | + compiler.reset(new CompilerCPP(std::move(spirv_parser.get_parsed_ir()))); |
| 131 | if (args.cpp_interface_name) |
| 132 | static_cast<CompilerCPP *>(compiler.get())->set_interface_name(args.cpp_interface_name); |
| 133 | } |
| 134 | else if (args.msl) |
| 135 | { |
| 136 | - compiler.reset(new CompilerMSL(move(spirv_parser.get_parsed_ir()))); |
| 137 | + compiler.reset(new CompilerMSL(std::move(spirv_parser.get_parsed_ir()))); |
| 138 | |
| 139 | auto *msl_comp = static_cast<CompilerMSL *>(compiler.get()); |
| 140 | auto msl_opts = msl_comp->get_msl_options(); |
| 141 | @@ -850,13 +850,13 @@ static int main_inner(int argc, char *argv[]) |
| 142 | msl_comp->set_msl_options(msl_opts); |
| 143 | } |
| 144 | else if (args.hlsl) |
| 145 | - compiler.reset(new CompilerHLSL(move(spirv_parser.get_parsed_ir()))); |
| 146 | + compiler.reset(new CompilerHLSL(std::move(spirv_parser.get_parsed_ir()))); |
| 147 | else |
| 148 | { |
| 149 | combined_image_samplers = !args.vulkan_semantics; |
| 150 | if (!args.vulkan_semantics) |
| 151 | build_dummy_sampler = true; |
| 152 | - compiler.reset(new CompilerGLSL(move(spirv_parser.get_parsed_ir()))); |
| 153 | + compiler.reset(new CompilerGLSL(std::move(spirv_parser.get_parsed_ir()))); |
| 154 | } |
| 155 | |
| 156 | if (!args.variable_type_remaps.empty()) |
| 157 | @@ -867,7 +867,7 @@ static int main_inner(int argc, char *argv[]) |
| 158 | out = remap.new_variable_type; |
| 159 | }; |
| 160 | |
| 161 | - compiler->set_variable_type_remap_callback(move(remap_cb)); |
| 162 | + compiler->set_variable_type_remap_callback(std::move(remap_cb)); |
| 163 | } |
| 164 | |
| 165 | for (auto &rename : args.entry_point_rename) |
| 166 | @@ -1019,7 +1019,7 @@ static int main_inner(int argc, char *argv[]) |
| 167 | { |
| 168 | auto active = compiler->get_active_interface_variables(); |
| 169 | res = compiler->get_shader_resources(active); |
| 170 | - compiler->set_enabled_interface_variables(move(active)); |
| 171 | + compiler->set_enabled_interface_variables(std::move(active)); |
| 172 | } |
| 173 | else |
| 174 | res = compiler->get_shader_resources(); |
| 175 | @@ -1034,7 +1034,7 @@ static int main_inner(int argc, char *argv[]) |
| 176 | |
| 177 | auto pls_inputs = remap_pls(args.pls_in, res.stage_inputs, &res.subpass_inputs); |
| 178 | auto pls_outputs = remap_pls(args.pls_out, res.stage_outputs, nullptr); |
| 179 | - compiler->remap_pixel_local_storage(move(pls_inputs), move(pls_outputs)); |
| 180 | + compiler->remap_pixel_local_storage(std::move(pls_inputs), std::move(pls_outputs)); |
| 181 | |
| 182 | for (auto &ext : args.extensions) |
| 183 | compiler->require_extension(ext); |
| 184 | @@ -1101,7 +1101,7 @@ static int main_inner(int argc, char *argv[]) |
| 185 | for (uint32_t i = 0; i < args.iterations; i++) |
| 186 | { |
| 187 | if (args.hlsl) |
| 188 | - glsl = static_cast<CompilerHLSL *>(compiler.get())->compile(move(args.hlsl_attr_remap)); |
| 189 | + glsl = static_cast<CompilerHLSL *>(compiler.get())->compile(std::move(args.hlsl_attr_remap)); |
| 190 | else |
| 191 | glsl = compiler->compile(); |
| 192 | } |
| 193 | diff --git a/spirv_common.hpp b/spirv_common.hpp |
| 194 | index aa32142d..0daf5ad5 100644 |
| 195 | --- a/spirv_common.hpp |
| 196 | +++ b/spirv_common.hpp |
| 197 | @@ -536,7 +536,7 @@ struct SPIRExpression : IVariant |
| 198 | |
| 199 | // Only created by the backend target to avoid creating tons of temporaries. |
| 200 | SPIRExpression(std::string expr, uint32_t expression_type_, bool immutable_) |
| 201 | - : expression(move(expr)) |
| 202 | + : expression(std::move(expr)) |
| 203 | , expression_type(expression_type_) |
| 204 | , immutable(immutable_) |
| 205 | { |
| 206 | diff --git a/spirv_cpp.hpp b/spirv_cpp.hpp |
| 207 | index bcdb669b..b4da84b9 100644 |
| 208 | --- a/spirv_cpp.hpp |
| 209 | +++ b/spirv_cpp.hpp |
| 210 | @@ -27,7 +27,7 @@ class CompilerCPP : public CompilerGLSL |
| 211 | { |
| 212 | public: |
| 213 | explicit CompilerCPP(std::vector<uint32_t> spirv_) |
| 214 | - : CompilerGLSL(move(spirv_)) |
| 215 | + : CompilerGLSL(std::move(spirv_)) |
| 216 | { |
| 217 | } |
| 218 | |
| 219 | diff --git a/spirv_cross.cpp b/spirv_cross.cpp |
| 220 | index 19bac301..d21dbd41 100644 |
| 221 | --- a/spirv_cross.cpp |
| 222 | +++ b/spirv_cross.cpp |
| 223 | @@ -28,16 +28,16 @@ using namespace spirv_cross; |
| 224 | |
| 225 | Compiler::Compiler(vector<uint32_t> ir_) |
| 226 | { |
| 227 | - Parser parser(move(ir_)); |
| 228 | + Parser parser(std::move(ir_)); |
| 229 | parser.parse(); |
| 230 | - set_ir(move(parser.get_parsed_ir())); |
| 231 | + set_ir(std::move(parser.get_parsed_ir())); |
| 232 | } |
| 233 | |
| 234 | Compiler::Compiler(const uint32_t *ir_, size_t word_count) |
| 235 | { |
| 236 | Parser parser(ir_, word_count); |
| 237 | parser.parse(); |
| 238 | - set_ir(move(parser.get_parsed_ir())); |
| 239 | + set_ir(std::move(parser.get_parsed_ir())); |
| 240 | } |
| 241 | |
| 242 | Compiler::Compiler(const ParsedIR &ir_) |
| 243 | @@ -47,12 +47,12 @@ Compiler::Compiler(const ParsedIR &ir_) |
| 244 | |
| 245 | Compiler::Compiler(ParsedIR &&ir_) |
| 246 | { |
| 247 | - set_ir(move(ir_)); |
| 248 | + set_ir(std::move(ir_)); |
| 249 | } |
| 250 | |
| 251 | void Compiler::set_ir(ParsedIR &&ir_) |
| 252 | { |
| 253 | - ir = move(ir_); |
| 254 | + ir = std::move(ir_); |
| 255 | parse_fixup(); |
| 256 | } |
| 257 | |
| 258 | @@ -716,7 +716,7 @@ unordered_set<uint32_t> Compiler::get_active_interface_variables() const |
| 259 | |
| 260 | void Compiler::set_enabled_interface_variables(std::unordered_set<uint32_t> active_variables) |
| 261 | { |
| 262 | - active_interface_variables = move(active_variables); |
| 263 | + active_interface_variables = std::move(active_variables); |
| 264 | check_active_interface_variables = true; |
| 265 | } |
| 266 | |
| 267 | @@ -2163,7 +2163,7 @@ void Compiler::CombinedImageSamplerHandler::push_remap_parameters(const SPIRFunc |
| 268 | unordered_map<uint32_t, uint32_t> remapping; |
| 269 | for (uint32_t i = 0; i < length; i++) |
| 270 | remapping[func.arguments[i].id] = remap_parameter(args[i]); |
| 271 | - parameter_remapping.push(move(remapping)); |
| 272 | + parameter_remapping.push(std::move(remapping)); |
| 273 | } |
| 274 | |
| 275 | void Compiler::CombinedImageSamplerHandler::pop_remap_parameters() |
| 276 | @@ -3611,7 +3611,7 @@ void Compiler::analyze_image_and_sampler_usage() |
| 277 | |
| 278 | CombinedImageSamplerUsageHandler handler(*this, dref_handler.dref_combined_samplers); |
| 279 | traverse_all_reachable_opcodes(get<SPIRFunction>(ir.default_entry_point), handler); |
| 280 | - comparison_ids = move(handler.comparison_ids); |
| 281 | + comparison_ids = std::move(handler.comparison_ids); |
| 282 | need_subpass_input = handler.need_subpass_input; |
| 283 | |
| 284 | // Forward information from separate images and samplers into combined image samplers. |
| 285 | @@ -3650,7 +3650,7 @@ void Compiler::build_function_control_flow_graphs_and_analyze() |
| 286 | CFGBuilder handler(*this); |
| 287 | handler.function_cfgs[ir.default_entry_point].reset(new CFG(*this, get<SPIRFunction>(ir.default_entry_point))); |
| 288 | traverse_all_reachable_opcodes(get<SPIRFunction>(ir.default_entry_point), handler); |
| 289 | - function_cfgs = move(handler.function_cfgs); |
| 290 | + function_cfgs = std::move(handler.function_cfgs); |
| 291 | |
| 292 | for (auto &f : function_cfgs) |
| 293 | { |
| 294 | diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp |
| 295 | index a8855987..fabbb105 100644 |
| 296 | --- a/spirv_glsl.cpp |
| 297 | +++ b/spirv_glsl.cpp |
| 298 | @@ -6876,7 +6876,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) |
| 299 | bool ptr_chain = opcode == OpPtrAccessChain; |
| 300 | auto e = access_chain(ops[2], &ops[3], length - 3, get<SPIRType>(ops[0]), &meta, ptr_chain); |
| 301 | |
| 302 | - auto &expr = set<SPIRExpression>(ops[1], move(e), ops[0], should_forward(ops[2])); |
| 303 | + auto &expr = set<SPIRExpression>(ops[1], std::move(e), ops[0], should_forward(ops[2])); |
| 304 | |
| 305 | auto *backing_variable = maybe_get_backing_variable(ops[2]); |
| 306 | expr.loaded_from = backing_variable ? backing_variable->self : ops[2]; |
| 307 | diff --git a/spirv_glsl.hpp b/spirv_glsl.hpp |
| 308 | index caf0ad3b..aac1196e 100644 |
| 309 | --- a/spirv_glsl.hpp |
| 310 | +++ b/spirv_glsl.hpp |
| 311 | @@ -138,7 +138,7 @@ public: |
| 312 | } |
| 313 | |
| 314 | explicit CompilerGLSL(std::vector<uint32_t> spirv_) |
| 315 | - : Compiler(move(spirv_)) |
| 316 | + : Compiler(std::move(spirv_)) |
| 317 | { |
| 318 | init(); |
| 319 | } |
| 320 | diff --git a/spirv_hlsl.cpp b/spirv_hlsl.cpp |
| 321 | index a5b6d2dc..0933017e 100644 |
| 322 | --- a/spirv_hlsl.cpp |
| 323 | +++ b/spirv_hlsl.cpp |
| 324 | @@ -2028,7 +2028,7 @@ void CompilerHLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret |
| 325 | out_argument += " "; |
| 326 | out_argument += "SPIRV_Cross_return_value"; |
| 327 | out_argument += type_to_array_glsl(type); |
| 328 | - arglist.push_back(move(out_argument)); |
| 329 | + arglist.push_back(std::move(out_argument)); |
| 330 | } |
| 331 | |
| 332 | for (auto &arg : func.arguments) |
| 333 | @@ -4553,7 +4553,7 @@ void CompilerHLSL::require_texture_query_variant(const SPIRType &type) |
| 334 | |
| 335 | string CompilerHLSL::compile(std::vector<HLSLVertexAttributeRemap> vertex_attributes) |
| 336 | { |
| 337 | - remap_vertex_attributes = move(vertex_attributes); |
| 338 | + remap_vertex_attributes = std::move(vertex_attributes); |
| 339 | return compile(); |
| 340 | } |
| 341 | |
| 342 | diff --git a/spirv_hlsl.hpp b/spirv_hlsl.hpp |
| 343 | index b2b60fca..3503c674 100644 |
| 344 | --- a/spirv_hlsl.hpp |
| 345 | +++ b/spirv_hlsl.hpp |
| 346 | @@ -63,7 +63,7 @@ public: |
| 347 | }; |
| 348 | |
| 349 | explicit CompilerHLSL(std::vector<uint32_t> spirv_) |
| 350 | - : CompilerGLSL(move(spirv_)) |
| 351 | + : CompilerGLSL(std::move(spirv_)) |
| 352 | { |
| 353 | } |
| 354 | |
| 355 | diff --git a/spirv_msl.cpp b/spirv_msl.cpp |
| 356 | index 0e1e733d..fbfcdba5 100644 |
| 357 | --- a/spirv_msl.cpp |
| 358 | +++ b/spirv_msl.cpp |
| 359 | @@ -32,7 +32,7 @@ static const uint32_t k_aux_mbr_idx_swizzle_const = 0u; |
| 360 | |
| 361 | CompilerMSL::CompilerMSL(vector<uint32_t> spirv_, vector<MSLVertexAttr> *p_vtx_attrs, |
| 362 | vector<MSLResourceBinding> *p_res_bindings) |
| 363 | - : CompilerGLSL(move(spirv_)) |
| 364 | + : CompilerGLSL(std::move(spirv_)) |
| 365 | { |
| 366 | if (p_vtx_attrs) |
| 367 | for (auto &va : *p_vtx_attrs) |
| 368 | diff --git a/spirv_parser.cpp b/spirv_parser.cpp |
| 369 | index 1725b4ca..0fcd7691 100644 |
| 370 | --- a/spirv_parser.cpp |
| 371 | +++ b/spirv_parser.cpp |
| 372 | @@ -24,7 +24,7 @@ namespace spirv_cross |
| 373 | { |
| 374 | Parser::Parser(std::vector<uint32_t> spirv) |
| 375 | { |
| 376 | - ir.spirv = move(spirv); |
| 377 | + ir.spirv = std::move(spirv); |
| 378 | } |
| 379 | |
| 380 | Parser::Parser(const uint32_t *spirv_data, size_t word_count) |
| 381 | @@ -223,7 +223,7 @@ void Parser::parse(const Instruction &instruction) |
| 382 | case OpExtension: |
| 383 | { |
| 384 | auto ext = extract_string(ir.spirv, instruction.offset); |
| 385 | - ir.declared_extensions.push_back(move(ext)); |
| 386 | + ir.declared_extensions.push_back(std::move(ext)); |
| 387 | break; |
| 388 | } |
| 389 | |
| 390 | diff --git a/spirv_reflect.hpp b/spirv_reflect.hpp |
| 391 | index 13b5b431..f5c6a6ff 100644 |
| 392 | --- a/spirv_reflect.hpp |
| 393 | +++ b/spirv_reflect.hpp |
| 394 | @@ -34,7 +34,7 @@ class CompilerReflection : public CompilerGLSL |
| 395 | |
| 396 | public: |
| 397 | explicit CompilerReflection(std::vector<uint32_t> spirv_) |
| 398 | - : Parent(move(spirv_)) |
| 399 | + : Parent(std::move(spirv_)) |
| 400 | { |
| 401 | options.vulkan_semantics = true; |
| 402 | } |
| 403 | -- |
| 404 | 2.37.2 |
| 405 | |