Cleanup: Clang tidy

Use using instead of typedef, remove redundant string init,
use "empty", address qualified auto, use nullptr.
This commit is contained in:
Hans Goudey 2022-02-13 13:15:53 -06:00
parent 7413c2feed
commit 7d5f6c330f
5 changed files with 12 additions and 12 deletions

View File

@ -35,7 +35,7 @@ void GPencilBackup::restore_to_gpencil(bGPdata *gpd)
}
/* Doing a copy-on-write copies the update cache pointer. Make sure to reset it
* to NULL as we should never use the update cache from eval data. */
gpd->runtime.update_cache = NULL;
gpd->runtime.update_cache = nullptr;
/* Make sure to update the original runtime pointers in the eval data. */
BKE_gpencil_data_update_orig_pointers(gpd_orig, gpd);
}

View File

@ -730,7 +730,7 @@ static int node_box_select_exec(bContext *C, wmOperator *op)
/* Frame nodes are selectable by their borders (including their whole rect - as for other
* nodes - would prevent selection of other nodes inside that frame. */
const rctf frame_inside = node_frame_rect_inside(*node);
if (BLI_rctf_isect(&rectf, &node->totr, NULL) &&
if (BLI_rctf_isect(&rectf, &node->totr, nullptr) &&
!BLI_rctf_inside_rctf(&frame_inside, &rectf)) {
nodeSetSelected(node, select);
is_inside = true;
@ -932,7 +932,7 @@ static bool do_lasso_select_node(bContext *C,
BLI_rctf_rcti_copy(&rectf, &rect);
UI_view2d_region_to_view_rctf(&region->v2d, &rectf, &rectf);
const rctf frame_inside = node_frame_rect_inside(*node);
if (BLI_rctf_isect(&rectf, &node->totr, NULL) &&
if (BLI_rctf_isect(&rectf, &node->totr, nullptr) &&
!BLI_rctf_inside_rctf(&frame_inside, &rectf)) {
nodeSetSelected(node, select);
changed = true;

View File

@ -499,7 +499,7 @@ static std::string main_function_wrapper(std::string &pre_main, std::string &pos
std::string GLShader::vertex_interface_declare(const ShaderCreateInfo &info) const
{
std::stringstream ss;
std::string post_main = "";
std::string post_main;
ss << "\n/* Inputs. */\n";
for (const ShaderCreateInfo::VertIn &attr : info.vertex_inputs_) {
@ -532,7 +532,7 @@ std::string GLShader::vertex_interface_declare(const ShaderCreateInfo &info) con
ss << "\n";
if (post_main.empty() == false) {
std::string pre_main = "";
std::string pre_main;
ss << main_function_wrapper(pre_main, post_main);
}
return ss.str();
@ -541,7 +541,7 @@ std::string GLShader::vertex_interface_declare(const ShaderCreateInfo &info) con
std::string GLShader::fragment_interface_declare(const ShaderCreateInfo &info) const
{
std::stringstream ss;
std::string pre_main = "";
std::string pre_main;
ss << "\n/* Interfaces. */\n";
const Vector<StageInterfaceInfo *> &in_interfaces = (info.geometry_source_.is_empty()) ?
@ -595,7 +595,7 @@ std::string GLShader::fragment_interface_declare(const ShaderCreateInfo &info) c
ss << "\n";
if (pre_main.empty() == false) {
std::string post_main = "";
std::string post_main;
ss << main_function_wrapper(pre_main, post_main);
}
return ss.str();
@ -715,7 +715,7 @@ std::string GLShader::workaround_geometry_shader_source_create(
ss << " gl_Layer = gpu_Layer[0];\n";
}
for (auto i : IndexRange(3)) {
for (auto iface : info_modified.vertex_out_interfaces_) {
for (StageInterfaceInfo *iface : info_modified.vertex_out_interfaces_) {
for (auto &inout : iface->inouts) {
ss << " " << iface->instance_name << "_out." << inout.name;
ss << " = " << iface->instance_name << "_in[" << i << "]." << inout.name << ";\n";

View File

@ -67,7 +67,7 @@ ArchiveReader *ArchiveReader::get(struct Main *bmain, const std::vector<const ch
std::vector<ArchiveReader *> readers;
for (const char *filename : filenames) {
auto reader = new ArchiveReader(bmain, filename);
ArchiveReader *reader = new ArchiveReader(bmain, filename);
if (!reader->valid()) {
delete reader;
@ -77,7 +77,7 @@ ArchiveReader *ArchiveReader::get(struct Main *bmain, const std::vector<const ch
readers.push_back(reader);
}
if (readers.size() == 0) {
if (readers.empty()) {
return nullptr;
}
@ -92,7 +92,7 @@ ArchiveReader::ArchiveReader(const std::vector<ArchiveReader *> &readers) : m_re
{
Alembic::AbcCoreLayer::ArchiveReaderPtrs archives;
for (auto &reader : readers) {
for (ArchiveReader *reader : readers) {
archives.push_back(reader->m_archive.getPtr());
}

View File

@ -82,7 +82,7 @@ struct InputSpec {
};
/* Map Blender socket names to USD Preview Surface InputSpec structs. */
typedef std::map<std::string, InputSpec> InputSpecMap;
using InputSpecMap = std::map<std::string, InputSpec>;
/* Static function forward declarations. */
static pxr::UsdShadeShader create_usd_preview_shader(const USDExporterContext &usd_export_context,