3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-05-15 03:34:45 +00:00

ast.h: Move attribute check into set

There are a number of places that check for an existing attribute and delete it before assigning a new node to it.
Reduce code duplication by doing it as part of the `set_attribute()` method.
This commit is contained in:
Krystine Sherwin 2025-05-10 17:24:13 +12:00
parent c4af97c1c4
commit 10ea2fa67e
No known key found for this signature in database
3 changed files with 2 additions and 10 deletions

View file

@ -1174,10 +1174,6 @@ static RTLIL::Module *process_module(RTLIL::Design *design, AstNode *ast, bool d
delete ast->attributes.at(ID::lib_whitebox);
ast->attributes.erase(ID::lib_whitebox);
} else {
if (ast->attributes.count(ID::whitebox)) {
delete ast->attributes.at(ID::whitebox);
ast->attributes.erase(ID::whitebox);
}
AstNode *n = ast->attributes.at(ID::lib_whitebox);
ast->set_attribute(ID::whitebox, n);
ast->attributes.erase(ID::lib_whitebox);