diff --git a/include/verilated_timing.h b/include/verilated_timing.h index 48646de69..58d18b9d9 100644 --- a/include/verilated_timing.h +++ b/include/verilated_timing.h @@ -39,7 +39,7 @@ using namespace experimental; // Bring std::experimental into the std namespace } #else -# if defined __clang__ && defined __GLIBCXX__ +# if defined __clang__ && defined __GLIBCXX__ && !defined __cpp_impl_coroutine # define __cpp_impl_coroutine 1 // Clang doesn't define this, but it's needed for libstdc++ # endif # include diff --git a/src/V3Ast.h b/src/V3Ast.h index d2bb7068f..40ed725ba 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -757,11 +757,15 @@ public: bool isRef() const VL_MT_SAFE { return m_e == REF; } bool isConstRef() const VL_MT_SAFE { return m_e == CONSTREF; } }; -constexpr bool operator==(const VDirection& lhs, const VDirection& rhs) { +constexpr bool operator==(const VDirection& lhs, const VDirection& rhs) VL_MT_SAFE { return lhs.m_e == rhs.m_e; } -constexpr bool operator==(const VDirection& lhs, VDirection::en rhs) { return lhs.m_e == rhs; } -constexpr bool operator==(VDirection::en lhs, const VDirection& rhs) { return lhs == rhs.m_e; } +constexpr bool operator==(const VDirection& lhs, VDirection::en rhs) VL_MT_SAFE { + return lhs.m_e == rhs; +} +constexpr bool operator==(VDirection::en lhs, const VDirection& rhs) VL_MT_SAFE { + return lhs == rhs.m_e; +} inline std::ostream& operator<<(std::ostream& os, const VDirection& rhs) { return os << rhs.ascii(); } diff --git a/src/V3AstNodeDType.h b/src/V3AstNodeDType.h index dd5efe25d..c4da4ad26 100644 --- a/src/V3AstNodeDType.h +++ b/src/V3AstNodeDType.h @@ -777,13 +777,7 @@ public: } ASTGEN_MEMBERS_AstEnumDType; - const char* broken() const override { - BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) - || (!m_refDTypep && childDTypep()))); - BROKEN_RTN(std::any_of(m_tableMap.begin(), m_tableMap.end(), - [](const auto& p) { return !p.second->brokeExists(); })); - return nullptr; - } + const char* broken() const override; void cloneRelink() override { if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep(); } diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index d9cef86c2..76ea7d7f4 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -1577,6 +1577,14 @@ void AstEnumItemRef::dump(std::ostream& str) const { str << "UNLINKED"; } } +const char* AstEnumDType::broken() const { + BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) + || (!m_refDTypep && childDTypep()))); + BROKEN_RTN(std::any_of(m_tableMap.begin(), m_tableMap.end(), + [](const auto& p) { return !p.second->brokeExists(); })); + return nullptr; +} + const char* AstEnumItemRef::broken() const { BROKEN_RTN(m_itemp && !m_itemp->brokeExists()); BROKEN_RTN(m_classOrPackagep && !m_classOrPackagep->brokeExists()); diff --git a/src/V3Const.cpp b/src/V3Const.cpp index bb68a436b..de342d983 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -1126,7 +1126,7 @@ private: // commonly appears after V3Expand and the simplification in matchMaskedOr. Similarly, // drop redundant masking of left shift result. E.g.: 0xff000000 & ((uint32_t)a << 24). - const auto checkMask = [=](const V3Number& mask) -> bool { + const auto checkMask = [nodep, this](const V3Number& mask) -> bool { const AstConst* const constp = VN_AS(nodep->lhsp(), Const); if (constp->num().isCaseEq(mask)) { AstNode* const rhsp = nodep->rhsp(); diff --git a/src/V3Dfg.h b/src/V3Dfg.h index 3be33cf06..411b8efbe 100644 --- a/src/V3Dfg.h +++ b/src/V3Dfg.h @@ -752,13 +752,13 @@ class DfgVertexWithArity VL_NOT_FINAL : public DfgVertex { std::array m_srcs; // Source edges protected: - DfgVertexWithArity(DfgGraph& dfg, VDfgType type, FileLine* flp, AstNodeDType* dtypep) + DfgVertexWithArity(DfgGraph& dfg, VDfgType type, FileLine* flp, AstNodeDType* dtypep) : DfgVertex{dfg, type, flp, dtypep} { // Initialize source edges for (size_t i = 0; i < Arity; ++i) m_srcs[i].init(this); } - ~DfgVertexWithArity() override = default; + ~DfgVertexWithArity() override = default; public: std::pair sourceEdges() final override { // diff --git a/src/V3DfgDecomposition.cpp b/src/V3DfgDecomposition.cpp index 200d12610..f8038dc8a 100644 --- a/src/V3DfgDecomposition.cpp +++ b/src/V3DfgDecomposition.cpp @@ -292,11 +292,11 @@ class ExtractCyclicComponents final { // Visit all neighbors. We stop at variable boundaries, // which is where we will split the graphs - vtx.forEachSource([=](DfgVertex& other) { + vtx.forEachSource([this, targetComponent](DfgVertex& other) { if (other.is()) return; visitMergeSCCs(other, targetComponent); }); - vtx.forEachSink([=](DfgVertex& other) { + vtx.forEachSink([this, targetComponent](DfgVertex& other) { if (other.is()) return; visitMergeSCCs(other, targetComponent); }); diff --git a/src/V3DfgVertices.h b/src/V3DfgVertices.h index bbcd9bdca..5c5f8bdda 100644 --- a/src/V3DfgVertices.h +++ b/src/V3DfgVertices.h @@ -224,7 +224,7 @@ public: uint32_t driverIndex(size_t idx) const { return m_driverData[idx].second; } DfgVertex* driverAt(size_t idx) const { - const DfgEdge* const edgep = findSourceEdge([=](const DfgEdge&, size_t i) { // + const DfgEdge* const edgep = findSourceEdge([this, idx](const DfgEdge&, size_t i) { // return driverIndex(i) == idx; }); return edgep ? edgep->sourcep() : nullptr; diff --git a/src/V3Hasher.cpp b/src/V3Hasher.cpp index e58dce546..0bf295154 100644 --- a/src/V3Hasher.cpp +++ b/src/V3Hasher.cpp @@ -91,56 +91,56 @@ private: //------------------------------------------------------------ // AstNodeDType void visit(AstNodeArrayDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { iterateConstNull(nodep->virtRefDTypep()); m_hash += nodep->left(); m_hash += nodep->right(); }); } void visit(AstNodeUOrStructDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, false, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, false, [this, nodep]() { // m_hash += nodep->uniqueNum(); }); } void visit(AstParamTypeDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { m_hash += nodep->name(); m_hash += nodep->varType(); }); } void visit(AstMemberDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstDefImplicitDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->uniqueNum(); }); } void visit(AstAssocArrayDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { iterateConstNull(nodep->virtRefDTypep()); iterateConstNull(nodep->virtRefDType2p()); }); } void visit(AstDynArrayDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->virtRefDTypep()); }); } void visit(AstUnsizedArrayDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->virtRefDTypep()); }); } void visit(AstWildcardArrayDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->virtRefDTypep()); }); } void visit(AstBasicDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { m_hash += nodep->keyword(); m_hash += nodep->numeric(); m_hash += nodep->nrange().left(); @@ -148,45 +148,45 @@ private: }); } void visit(AstCDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstConstDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->virtRefDTypep()); }); } void visit(AstClassRefDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->classp()); }); } void visit(AstIfaceRefDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->cellp()); }); } void visit(AstQueueDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->virtRefDTypep()); }); } void visit(AstRefDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { m_hash += nodep->name(); iterateConstNull(nodep->typedefp()); iterateConstNull(nodep->refDTypep()); }); } void visit(AstStreamDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, []() {}); } void visit(AstVoidDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, []() {}); } void visit(AstEnumDType* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, false, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, false, [this, nodep]() { // m_hash += nodep->uniqueNum(); }); } @@ -194,23 +194,23 @@ private: //------------------------------------------------------------ // AstNodeExpr void visit(AstNodeExpr* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstConst* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->num().toHash(); }); } void visit(AstNullCheck* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstCCast* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->size(); }); } void visit(AstVarRef* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { if (nodep->varScopep()) { iterateConstNull(nodep->varScopep()); } else { @@ -220,28 +220,28 @@ private: }); } void visit(AstVarXRef* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { iterateConstNull(nodep->varp()); m_hash += nodep->dotted(); }); } void visit(AstMemberSel* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstFScanF* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->text(); }); } void visit(AstSScanF* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->text(); }); } void visit(AstAddrOfCFunc* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->funcp()); }); } @@ -249,64 +249,64 @@ private: //------------------------------------------------------------ // AstNodeStmt void visit(AstNodeStmt* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, []() {}); } void visit(AstNodeText* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->text(); }); } void visit(AstNodeCCall* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->funcp()); }); } void visit(AstNodeFTaskRef* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { iterateConstNull(nodep->taskp()); iterateConstNull(nodep->classOrPackagep()); }); } void visit(AstCMethodHard* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstCAwait* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->sensesp()); }); } void visit(AstCLocalScope* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstCoverInc* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->declp()); }); } void visit(AstDisplay* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->displayType(); }); } void visit(AstMonitorOff* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->off(); }); } void visit(AstJumpGo* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->labelp()); }); } void visit(AstTraceInc* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->declp()); }); } void visit(AstNodeCoverOrAssert* nodep) override { - m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } @@ -314,103 +314,104 @@ private: //------------------------------------------------------------ // AstNode direct descendants void visit(AstNodeRange* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstNodeModule* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, false, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, false, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstNodePreSel* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstClassExtends* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstSelLoopVars* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstDefParam* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstArg* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstParseRef* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { m_hash += nodep->expect(); m_hash += nodep->name(); }); } void visit(AstClassOrPackageRef* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->classOrPackageNodep()); }); } void visit(AstSenItem* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->edgeType(); }); } void visit(AstSenTree* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstSFormatF* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->text(); }); } void visit(AstElabDisplay* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->displayType(); }); } void visit(AstInitItem* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstInitArray* nodep) override { if (const AstAssocArrayDType* const dtypep = VN_CAST(nodep->dtypep(), AssocArrayDType)) { if (nodep->defaultp()) { m_hash - += hashNodeAndIterate(nodep->defaultp(), HASH_DTYPE, HASH_CHILDREN, [=]() {}); + += hashNodeAndIterate(nodep->defaultp(), HASH_DTYPE, HASH_CHILDREN, []() {}); } const auto& mapr = nodep->map(); for (const auto& itr : mapr) { // mapr is sorted, so hash should get stable results m_hash += itr.first; - m_hash += hashNodeAndIterate(itr.second, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(itr.second, HASH_DTYPE, HASH_CHILDREN, []() {}); } } else if (const AstUnpackArrayDType* const dtypep = VN_CAST(nodep->dtypep(), UnpackArrayDType)) { // Hash unpacked array initializers by value, as the order of initializer nodes does // not matter, and we want semantically equivalent initializers to map to the same // hash. - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, /* hashChildren: */ !dtypep, [=]() { - if (dtypep) { - const uint32_t size = dtypep->elementsConst(); - for (uint32_t n = 0; n < size; ++n) { // - iterateConstNull(nodep->getIndexDefaultedValuep(n)); + m_hash += hashNodeAndIterate( + nodep, HASH_DTYPE, /* hashChildren: */ !dtypep, [this, nodep, dtypep]() { + if (dtypep) { + const uint32_t size = dtypep->elementsConst(); + for (uint32_t n = 0; n < size; ++n) { // + iterateConstNull(nodep->getIndexDefaultedValuep(n)); + } } - } - }); + }); } } void visit(AstPragma* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->pragType(); }); } void visit(AstAttrOf* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->attrType(); }); } void visit(AstNodeFile* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstCFunc* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // // We might be in a recursive function, if so on *second* call // here we need to break what would be an infinite loop. nodep->user4(V3Hash{1}.value()); // Set this "first" call @@ -421,90 +422,90 @@ private: }); } void visit(AstVar* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { m_hash += nodep->name(); m_hash += nodep->varType(); }); } void visit(AstScope* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, false, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, false, [this, nodep]() { m_hash += nodep->name(); iterateConstNull(nodep->aboveScopep()); }); } void visit(AstVarScope* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { iterateConstNull(nodep->varp()); iterateConstNull(nodep->scopep()); }); } void visit(AstEnumItem* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstTypedef* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstTypedefFwd* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstActive* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // iterateConstNull(nodep->sensesp()); }); } void visit(AstCell* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { m_hash += nodep->name(); iterateConstNull(nodep->modp()); }); } void visit(AstCellInline* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { m_hash += nodep->name(); iterateConstNull(nodep->scopep()); }); } void visit(AstNodeFTask* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstModport* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstModportVarRef* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { m_hash += nodep->name(); iterateConstNull(nodep->varp()); }); } void visit(AstModportFTaskRef* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { m_hash += nodep->name(); iterateConstNull(nodep->ftaskp()); }); } void visit(AstMTaskBody* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstNodeProcedure* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {}); } void visit(AstNodeBlock* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { // m_hash += nodep->name(); }); } void visit(AstPin* nodep) override { - m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { + m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { m_hash += nodep->name(); m_hash += nodep->pinNum(); }); diff --git a/src/V3SchedPartition.cpp b/src/V3SchedPartition.cpp index e381b2727..05db62245 100644 --- a/src/V3SchedPartition.cpp +++ b/src/V3SchedPartition.cpp @@ -184,7 +184,7 @@ class SchedGraphBuilder final : public VNVisitor { // Clocked or hybrid logic has explicit sensitivity, so add edge from sensitivity vertex if (!m_senTreep->hasCombo()) { - m_senTreep->foreach([=](AstSenItem* senItemp) { + m_senTreep->foreach([this, nodep, logicVtxp](AstSenItem* senItemp) { if (senItemp->isIllegal()) return; UASSERT_OBJ(senItemp->isClocked() || senItemp->isHybrid(), nodep, "Non-clocked SenItem under clocked SenTree"); @@ -194,7 +194,7 @@ class SchedGraphBuilder final : public VNVisitor { } // Add edges based on references - nodep->foreach([=](const AstVarRef* vrefp) { + nodep->foreach([this, logicVtxp](const AstVarRef* vrefp) { AstVarScope* const vscp = vrefp->varScopep(); if (vrefp->access().isReadOrRW() && m_readTriggersThisLogic(vscp)) { new V3GraphEdge{m_graphp, getVarVertex(vscp), logicVtxp, 10}; @@ -206,7 +206,7 @@ class SchedGraphBuilder final : public VNVisitor { // If the logic calls a 'context' DPI import, it might fire the DPI Export trigger if (m_dpiExportTriggerp) { - nodep->foreach([=](const AstCCall* callp) { + nodep->foreach([this, logicVtxp](const AstCCall* callp) { if (!callp->funcp()->dpiImportWrapper()) return; if (!callp->funcp()->dpiContext()) return; new V3GraphEdge{m_graphp, logicVtxp, getVarVertex(m_dpiExportTriggerp), 10}; diff --git a/src/V3SenExprBuilder.h b/src/V3SenExprBuilder.h index 70a981696..149d1409d 100644 --- a/src/V3SenExprBuilder.h +++ b/src/V3SenExprBuilder.h @@ -91,7 +91,7 @@ class SenExprBuilder final { } AstVarScope* getPrev(AstNodeExpr* exprp) { FileLine* const flp = exprp->fileline(); - const auto rdCurr = [=]() { return getCurr(exprp); }; + const auto rdCurr = [this, exprp]() { return getCurr(exprp); }; AstNode* scopeExprp = exprp; if (AstVarRef* const refp = VN_CAST(exprp, VarRef)) scopeExprp = refp->varScopep(); @@ -155,8 +155,10 @@ class SenExprBuilder final { FileLine* const flp = senItemp->fileline(); AstNodeExpr* const senp = senItemp->sensp(); - const auto currp = [=]() { return getCurr(senp); }; - const auto prevp = [=]() { return new AstVarRef{flp, getPrev(senp), VAccess::READ}; }; + const auto currp = [this, senp]() { return getCurr(senp); }; + const auto prevp = [this, flp, senp]() { + return new AstVarRef{flp, getPrev(senp), VAccess::READ}; + }; const auto lsb = [=](AstNodeExpr* opp) { return new AstSel{flp, opp, 0, 1}; }; // All event signals should be 1-bit at this point