mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-13 17:36:16 +00:00
Merge pull request #950 from whitequark/attrmap_remove_wildcard
attrmap: extend -remove to allow removing attributes with any value
This commit is contained in:
commit
9050b5e191
1 changed files with 3 additions and 1 deletions
|
@ -111,9 +111,10 @@ struct AttrmapMap : AttrmapAction {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AttrmapRemove : AttrmapAction {
|
struct AttrmapRemove : AttrmapAction {
|
||||||
|
bool has_value;
|
||||||
string name, value;
|
string name, value;
|
||||||
bool apply(IdString &id, Const &val) YS_OVERRIDE {
|
bool apply(IdString &id, Const &val) YS_OVERRIDE {
|
||||||
return !(match_name(name, id) && match_value(value, val));
|
return !(match_name(name, id) && (!has_value || match_value(value, val)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -235,6 +236,7 @@ struct AttrmapPass : public Pass {
|
||||||
}
|
}
|
||||||
auto action = new AttrmapRemove;
|
auto action = new AttrmapRemove;
|
||||||
action->name = arg1;
|
action->name = arg1;
|
||||||
|
action->has_value = (p != string::npos);
|
||||||
action->value = val1;
|
action->value = val1;
|
||||||
actions.push_back(std::unique_ptr<AttrmapAction>(action));
|
actions.push_back(std::unique_ptr<AttrmapAction>(action));
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue