Internals: Fix hash and comparison function for AstBasicDType (#4564)

This commit is contained in:
Anthony Donlon 2023-10-15 20:15:46 +01:00 committed by GitHub
parent 4fdaa46328
commit bba3487dc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -277,11 +277,9 @@ int AstBasicDType::widthTotalBytes() const {
bool AstBasicDType::same(const AstNode* samep) const {
const AstBasicDType* const sp = static_cast<const AstBasicDType*>(samep);
if (!rangep() && !sp->rangep() && m == sp->m) {
return true;
} else {
return m == sp->m && rangep() && rangep()->sameTree(sp->rangep());
}
if (!(m == sp->m) || numeric() != sp->numeric()) return false;
if (!rangep() && !sp->rangep()) return true;
return rangep() && rangep()->sameTree(sp->rangep());
}
int AstNodeUOrStructDType::widthTotalBytes() const {

View File

@ -143,6 +143,7 @@ private:
void visit(AstBasicDType* nodep) override {
m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() {
m_hash += nodep->keyword();
m_hash += nodep->numeric();
m_hash += nodep->nrange().left();
m_hash += nodep->nrange().right();
});