mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
additional conversions of size() to empty() checks that were missed previously
This commit is contained in:
parent
9d38946a95
commit
8bc04d3593
2 changed files with 14 additions and 14 deletions
|
@ -136,13 +136,13 @@ StmtPtr ZAMCompiler::CompileBody()
|
||||||
|
|
||||||
ResolveHookBreaks();
|
ResolveHookBreaks();
|
||||||
|
|
||||||
if ( nexts.size() > 0 )
|
if ( ! nexts.empty() )
|
||||||
reporter->Error("\"next\" used without an enclosing \"for\"");
|
reporter->Error("\"next\" used without an enclosing \"for\"");
|
||||||
|
|
||||||
if ( fallthroughs.size() > 0 )
|
if ( ! fallthroughs.empty() )
|
||||||
reporter->Error("\"fallthrough\" used without an enclosing \"switch\"");
|
reporter->Error("\"fallthrough\" used without an enclosing \"switch\"");
|
||||||
|
|
||||||
if ( catches.size() > 0 )
|
if ( ! catches.empty() )
|
||||||
reporter->InternalError("untargeted inline return");
|
reporter->InternalError("untargeted inline return");
|
||||||
|
|
||||||
// Make sure we have a (pseudo-)instruction at the end so we
|
// 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,
|
// If we have remapped frame denizens, update them. If not,
|
||||||
// create them.
|
// create them.
|
||||||
if ( shared_frame_denizens.size() > 0 )
|
if ( ! shared_frame_denizens.empty() )
|
||||||
RemapFrameDenizens(inst1_to_inst2);
|
RemapFrameDenizens(inst1_to_inst2);
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -218,7 +218,7 @@ StmtPtr ZAMCompiler::CompileBody()
|
||||||
|
|
||||||
void ZAMCompiler::ResolveHookBreaks()
|
void ZAMCompiler::ResolveHookBreaks()
|
||||||
{
|
{
|
||||||
if ( breaks.size() > 0 )
|
if ( ! breaks.empty() )
|
||||||
{
|
{
|
||||||
ASSERT(breaks.size() == 1);
|
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());
|
printf("Pre-removal of dead code for %s:\n", func->Name());
|
||||||
|
|
||||||
auto remappings = remapped_frame ? &shared_frame_denizens : nullptr;
|
auto remappings = remapped_frame ? &shared_frame_denizens : nullptr;
|
||||||
|
|
||||||
DumpInsts1(remappings);
|
DumpInsts1(remappings);
|
||||||
|
|
||||||
if ( insts2.size() > 0 )
|
if ( ! insts2.empty() )
|
||||||
printf("Final intermediary code for %s:\n", func->Name());
|
printf("Final intermediary code for %s:\n", func->Name());
|
||||||
|
|
||||||
remappings = remapped_frame ? &shared_frame_denizens_final : nullptr;
|
remappings = remapped_frame ? &shared_frame_denizens_final : nullptr;
|
||||||
|
@ -430,7 +430,7 @@ void ZAMCompiler::Dump()
|
||||||
inst->Dump(&frame_denizens, remappings);
|
inst->Dump(&frame_denizens, remappings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( insts2.size() > 0 )
|
if ( ! insts2.empty() )
|
||||||
printf("Final code for %s:\n", func->Name());
|
printf("Final code for %s:\n", func->Name());
|
||||||
|
|
||||||
for ( auto i = 0U; i < insts2.size(); ++i )
|
for ( auto i = 0U; i < insts2.size(); ++i )
|
||||||
|
|
|
@ -292,27 +292,27 @@ protected:
|
||||||
// Tracking of assignment values (C++ variables that hold the
|
// Tracking of assignment values (C++ variables that hold the
|
||||||
// value that should be assigned to usual frame slot).
|
// value that should be assigned to usual frame slot).
|
||||||
void SetAssignVal(string _av) { av = _av; }
|
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; }
|
const string& GetAssignVal() const { return av; }
|
||||||
|
|
||||||
// Management of C++ evaluation blocks. These are built up
|
// Management of C++ evaluation blocks. These are built up
|
||||||
// line-by-line.
|
// line-by-line.
|
||||||
void AddEval(string line) { eval += 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; }
|
const string& GetEval() const { return eval; }
|
||||||
|
|
||||||
// Management of custom methods to be used rather than generating
|
// Management of custom methods to be used rather than generating
|
||||||
// a method.
|
// a method.
|
||||||
void SetCustomMethod(string cm) { custom_method = SkipWS(cm); }
|
void SetCustomMethod(string cm) { custom_method = SkipWS(cm); }
|
||||||
bool HasCustomMethod() const
|
bool HasCustomMethod() const
|
||||||
{ return custom_method.size() > 0; }
|
{ return ! custom_method.empty(); }
|
||||||
const string& GetCustomMethod() const
|
const string& GetCustomMethod() const
|
||||||
{ return custom_method; }
|
{ return custom_method; }
|
||||||
|
|
||||||
// Management of code to execute at the end of a generated method.
|
// Management of code to execute at the end of a generated method.
|
||||||
void SetPostMethod(string cm) { post_method = SkipWS(cm); }
|
void SetPostMethod(string cm) { post_method = SkipWS(cm); }
|
||||||
bool HasPostMethod() const
|
bool HasPostMethod() const
|
||||||
{ return post_method.size() > 0; }
|
{ return ! post_method.empty(); }
|
||||||
const string& GetPostMethod() const
|
const string& GetPostMethod() const
|
||||||
{ return post_method; }
|
{ return post_method; }
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ protected:
|
||||||
// is used in a dead assignment, should be converted to a different
|
// is used in a dead assignment, should be converted to a different
|
||||||
// operation that explictly omits any assignment.
|
// operation that explictly omits any assignment.
|
||||||
bool HasAssignmentLess() const
|
bool HasAssignmentLess() const
|
||||||
{ return assignment_less_op.size() > 0; }
|
{ return ! assignment_less_op.empty(); }
|
||||||
void SetAssignmentLess(string op, string op_type)
|
void SetAssignmentLess(string op, string op_type)
|
||||||
{
|
{
|
||||||
assignment_less_op = op;
|
assignment_less_op = op;
|
||||||
|
@ -651,7 +651,7 @@ public:
|
||||||
bool IncludesFieldOp() const override { return includes_field_op; }
|
bool IncludesFieldOp() const override { return includes_field_op; }
|
||||||
void SetIncludesFieldOp() { includes_field_op = true; }
|
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); }
|
void SetPreEval(string pe) { pre_eval = SkipWS(pe); }
|
||||||
const string& GetPreEval() const { return pre_eval; }
|
const string& GetPreEval() const { return pre_eval; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue