mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
helper function for comparing collections of definition points
This commit is contained in:
parent
b581c6435e
commit
ec97c9b042
2 changed files with 23 additions and 0 deletions
|
@ -253,6 +253,27 @@ void Reducer::TrackExprReplacement(const Expr* orig, const Expr* e)
|
|||
}
|
||||
|
||||
|
||||
bool same_DPs(const DefPoints* dp1, const DefPoints* dp2)
|
||||
{
|
||||
if ( dp1 == dp2 )
|
||||
return true;
|
||||
|
||||
if ( ! dp1 || ! dp2 )
|
||||
return false;
|
||||
|
||||
// Given how we construct DPs, they should be element-by-element
|
||||
// equivalent; we don't have to worry about reordering.
|
||||
if ( dp1->length() != dp2->length() )
|
||||
return false;
|
||||
|
||||
for ( auto i = 0; i < dp1->length(); ++i )
|
||||
if ( ! (*dp1)[i].SameAs((*dp2)[i]) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const Expr* non_reduced_perp;
|
||||
bool checking_reduction;
|
||||
|
||||
|
|
|
@ -214,6 +214,8 @@ protected:
|
|||
const DefSetsMgr* mgr = nullptr;
|
||||
};
|
||||
|
||||
extern bool same_DPs(const DefPoints* dp1, const DefPoints* dp2);
|
||||
|
||||
// Used for debugging, to communicate which expression wasn't
|
||||
// reduced when we expected them all to be.
|
||||
extern const Expr* non_reduced_perp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue