[Bf-blender-cvs] [414d1ea1c1d] tmp-gpu-shader-descriptor-2: Fix clang-tidy warnings.

Jeroen Bakker noreply at git.blender.org
Wed Jan 12 11:28:25 CET 2022


Commit: 414d1ea1c1d0a2e462a451df35b389fd46aea496
Author: Jeroen Bakker
Date:   Wed Jan 12 08:12:33 2022 +0100
Branches: tmp-gpu-shader-descriptor-2
https://developer.blender.org/rB414d1ea1c1d0a2e462a451df35b389fd46aea496

Fix clang-tidy warnings.

===================================================================

M	source/blender/gpu/intern/gpu_shader.cc
M	source/blender/gpu/intern/gpu_shader_builder_stubs.cc
M	source/blender/gpu/intern/gpu_shader_create_info.cc
M	source/blender/gpu/intern/gpu_shader_dependency.cc

===================================================================

diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc
index 243c2c829ff..3b41e804fd4 100644
--- a/source/blender/gpu/intern/gpu_shader.cc
+++ b/source/blender/gpu/intern/gpu_shader.cc
@@ -44,7 +44,7 @@ namespace blender::gpu {
 
 std::string Shader::defines_declare(const shader::ShaderCreateInfo &info) const
 {
-  std::string defines("");
+  std::string defines;
   for (const auto &def : info.defines_) {
     defines += "#define ";
     defines += def[0];
@@ -311,7 +311,7 @@ GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
     if (!typedefs.is_empty()) {
       sources.append(shader_shared_utils);
     }
-    for (auto types : typedefs) {
+    for (auto *types : typedefs) {
       sources.append(types);
     }
     sources.append(resources.c_str());
@@ -339,7 +339,7 @@ GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
     if (!typedefs.is_empty()) {
       sources.append(shader_shared_utils);
     }
-    for (auto types : typedefs) {
+    for (auto *types : typedefs) {
       sources.append(types);
     }
     sources.append(resources.c_str());
@@ -365,7 +365,7 @@ GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
     if (!typedefs.is_empty()) {
       sources.append(shader_shared_utils);
     }
-    for (auto types : typedefs) {
+    for (auto *types : typedefs) {
       sources.append(types);
     }
     sources.append(resources.c_str());
@@ -390,7 +390,7 @@ GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
     if (!typedefs.is_empty()) {
       sources.append(shader_shared_utils);
     }
-    for (auto types : typedefs) {
+    for (auto *types : typedefs) {
       sources.append(types);
     }
     sources.append(resources.c_str());
@@ -401,7 +401,7 @@ GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
     free(code);
   }
 
-  for (auto types : typedefs) {
+  for (auto *types : typedefs) {
     free(types);
   }
 
diff --git a/source/blender/gpu/intern/gpu_shader_builder_stubs.cc b/source/blender/gpu/intern/gpu_shader_builder_stubs.cc
index d3ef1291ecf..40e54ab4394 100644
--- a/source/blender/gpu/intern/gpu_shader_builder_stubs.cc
+++ b/source/blender/gpu/intern/gpu_shader_builder_stubs.cc
@@ -54,7 +54,7 @@ UserDef U;
 /** \name Stubs of BLI_imbuf_types.h
  * \{ */
 
-void IMB_freeImBuf(ImBuf *UNUSED(buffer))
+void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
 {
   BLI_assert_unreachable();
 }
@@ -218,7 +218,7 @@ int BKE_subdiv_ccg_grid_to_face_index(const SubdivCCG *UNUSED(subdiv_ccg),
  * \{ */
 void ntreeGPUMaterialNodes(struct bNodeTree *UNUSED(localtree),
                            struct GPUMaterial *UNUSED(mat),
-                           bool *UNUSED(as_surface_output),
+                           bool *UNUSED(has_surface_output),
                            bool *UNUSED(has_volume_output))
 {
   BLI_assert_unreachable();
diff --git a/source/blender/gpu/intern/gpu_shader_create_info.cc b/source/blender/gpu/intern/gpu_shader_create_info.cc
index 3ff83c3714c..223a62f3118 100644
--- a/source/blender/gpu/intern/gpu_shader_create_info.cc
+++ b/source/blender/gpu/intern/gpu_shader_create_info.cc
@@ -137,12 +137,12 @@ void gpu_shader_create_info_init()
 
 void gpu_shader_create_info_exit()
 {
-  for (auto value : g_create_infos->values()) {
+  for (auto *value : g_create_infos->values()) {
     delete value;
   }
   delete g_create_infos;
 
-  for (auto value : g_interfaces->values()) {
+  for (auto *value : g_interfaces->values()) {
     delete value;
   }
   delete g_interfaces;
diff --git a/source/blender/gpu/intern/gpu_shader_dependency.cc b/source/blender/gpu/intern/gpu_shader_dependency.cc
index 361805f21db..a866e9f1fda 100644
--- a/source/blender/gpu/intern/gpu_shader_dependency.cc
+++ b/source/blender/gpu/intern/gpu_shader_dependency.cc
@@ -108,7 +108,7 @@ struct GPUSource {
     }
     dependencies_init = true;
     int64_t pos = 0;
-    while (1) {
+    while (true) {
       pos = source.find("pragma BLENDER_REQUIRE(", pos);
       if (pos == -1) {
         return;
@@ -132,7 +132,7 @@ struct GPUSource {
       /* Recursive. */
       dependency_source->init_dependencies(dict);
 
-      for (auto dep : dependency_source->dependencies) {
+      for (auto *dep : dependency_source->dependencies) {
         dependencies.append_non_duplicates(dep);
       }
       dependencies.append_non_duplicates(dependency_source);
@@ -143,7 +143,7 @@ struct GPUSource {
   /* Returns the final string with all inlcudes done. */
   void build(std::string &str, shader::BuiltinBits &out_builtins)
   {
-    for (auto dep : dependencies) {
+    for (auto *dep : dependencies) {
       out_builtins |= builtins;
       str += dep->source;
     }
@@ -167,14 +167,14 @@ void gpu_shader_dependency_init()
 #include "glsl_gpu_source_list.h"
 #undef SHADER_SOURCE
 
-  for (auto value : g_sources->values()) {
+  for (auto *value : g_sources->values()) {
     value->init_dependencies(*g_sources);
   }
 }
 
 void gpu_shader_dependency_exit()
 {
-  for (auto value : g_sources->values()) {
+  for (auto *value : g_sources->values()) {
     delete value;
   }
   delete g_sources;



More information about the Bf-blender-cvs mailing list