From 8bc04d3593e41059ccdd35f5fbc2b36fab84e93c Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Thu, 2 Sep 2021 10:02:12 -0700 Subject: [PATCH] additional conversions of size() to empty() checks that were missed previously --- src/script_opt/ZAM/Driver.cc | 16 ++++++++-------- src/script_opt/ZAM/Gen-ZAM.h | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/script_opt/ZAM/Driver.cc b/src/script_opt/ZAM/Driver.cc index c7edf982fd..cf25ba5d44 100644 --- a/src/script_opt/ZAM/Driver.cc +++ b/src/script_opt/ZAM/Driver.cc @@ -136,13 +136,13 @@ StmtPtr ZAMCompiler::CompileBody() ResolveHookBreaks(); - if ( nexts.size() > 0 ) + if ( ! nexts.empty() ) reporter->Error("\"next\" used without an enclosing \"for\""); - if ( fallthroughs.size() > 0 ) + if ( ! fallthroughs.empty() ) reporter->Error("\"fallthrough\" used without an enclosing \"switch\""); - if ( catches.size() > 0 ) + if ( ! catches.empty() ) reporter->InternalError("untargeted inline return"); // Make sure we have a (pseudo-)instruction at the end so we @@ -192,7 +192,7 @@ StmtPtr ZAMCompiler::CompileBody() // If we have remapped frame denizens, update them. If not, // create them. - if ( shared_frame_denizens.size() > 0 ) + if ( ! shared_frame_denizens.empty() ) RemapFrameDenizens(inst1_to_inst2); else @@ -218,7 +218,7 @@ StmtPtr ZAMCompiler::CompileBody() void ZAMCompiler::ResolveHookBreaks() { - if ( breaks.size() > 0 ) + if ( ! breaks.empty() ) { ASSERT(breaks.size() == 1); @@ -400,14 +400,14 @@ void ZAMCompiler::Dump() } } - if ( insts2.size() > 0 ) + if ( ! insts2.empty() ) printf("Pre-removal of dead code for %s:\n", func->Name()); auto remappings = remapped_frame ? &shared_frame_denizens : nullptr; DumpInsts1(remappings); - if ( insts2.size() > 0 ) + if ( ! insts2.empty() ) printf("Final intermediary code for %s:\n", func->Name()); remappings = remapped_frame ? &shared_frame_denizens_final : nullptr; @@ -430,7 +430,7 @@ void ZAMCompiler::Dump() inst->Dump(&frame_denizens, remappings); } - if ( insts2.size() > 0 ) + if ( ! insts2.empty() ) printf("Final code for %s:\n", func->Name()); for ( auto i = 0U; i < insts2.size(); ++i ) diff --git a/src/script_opt/ZAM/Gen-ZAM.h b/src/script_opt/ZAM/Gen-ZAM.h index c5bf3c21ba..f012e078f6 100644 --- a/src/script_opt/ZAM/Gen-ZAM.h +++ b/src/script_opt/ZAM/Gen-ZAM.h @@ -292,27 +292,27 @@ protected: // Tracking of assignment values (C++ variables that hold the // value that should be assigned to usual frame slot). void SetAssignVal(string _av) { av = _av; } - bool HasAssignVal() const { return av.size() > 0; } + bool HasAssignVal() const { return ! av.empty(); } const string& GetAssignVal() const { return av; } // Management of C++ evaluation blocks. These are built up // line-by-line. void AddEval(string line) { eval += line; } - bool HasEval() const { return eval.size() > 0; } + bool HasEval() const { return ! eval.empty(); } const string& GetEval() const { return eval; } // Management of custom methods to be used rather than generating // a method. void SetCustomMethod(string cm) { custom_method = SkipWS(cm); } bool HasCustomMethod() const - { return custom_method.size() > 0; } + { return ! custom_method.empty(); } const string& GetCustomMethod() const { return custom_method; } // Management of code to execute at the end of a generated method. void SetPostMethod(string cm) { post_method = SkipWS(cm); } bool HasPostMethod() const - { return post_method.size() > 0; } + { return ! post_method.empty(); } const string& GetPostMethod() const { return post_method; } @@ -352,7 +352,7 @@ protected: // is used in a dead assignment, should be converted to a different // operation that explictly omits any assignment. bool HasAssignmentLess() const - { return assignment_less_op.size() > 0; } + { return ! assignment_less_op.empty(); } void SetAssignmentLess(string op, string op_type) { assignment_less_op = op; @@ -651,7 +651,7 @@ public: bool IncludesFieldOp() const override { return includes_field_op; } void SetIncludesFieldOp() { includes_field_op = true; } - bool HasPreEval() const { return pre_eval.size() > 0; } + bool HasPreEval() const { return ! pre_eval.empty(); } void SetPreEval(string pe) { pre_eval = SkipWS(pe); } const string& GetPreEval() const { return pre_eval; }