mirror of
https://github.com/verilator/verilator.git
synced 2026-09-02 18:58:51 +02:00
Internals: Add new VL_RESTORER flavours (#7866)
Restrict VL_RESTORER to be usable only with trivially copyable types. Introduce VL_RESTORER_COPY and VL_RESTORER_CLEAR, which are more efficient versions usable for non trivially copyable types. VL_RESTORER_COPY semantically behaves the same as VL_RESTORER, but only does one copy at initialization, and on scope exit restores via a move. VL_RESTORER_CLEAR swaps the variable with an new one constructed via the no-args constructor (e.g. empty collection), which does not require any copying at any point. Static assertions enforce picking one of the new flavours when copying might be expensive.
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ class InlineIntfRefVisitor final : public VNVisitor {
|
||||
// VISITORS
|
||||
void visit(AstNetlist* nodep) override { iterateChildren(nodep->topModulep()); }
|
||||
void visit(AstCell* nodep) override {
|
||||
VL_RESTORER(m_scope);
|
||||
VL_RESTORER_COPY(m_scope);
|
||||
if (m_scope.empty()) {
|
||||
m_scope = nodep->name();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user