Internals: Favor const for map keys. No functional change intended.

This commit is contained in:
Wilson Snyder 2020-10-30 18:00:40 -04:00
parent 0c949ceba2
commit 51b0963e61
30 changed files with 73 additions and 81 deletions

View File

@ -90,7 +90,7 @@ public:
class VerilatedCovImp : VerilatedCovImpBase { class VerilatedCovImp : VerilatedCovImpBase {
private: private:
// TYPES // TYPES
typedef std::map<std::string, int> ValueIndexMap; typedef std::map<const std::string, int> ValueIndexMap;
typedef std::map<int, std::string> IndexValueMap; typedef std::map<int, std::string> IndexValueMap;
typedef std::deque<VerilatedCovImpItem*> ItemList; typedef std::deque<VerilatedCovImpItem*> ItemList;
@ -350,7 +350,7 @@ public:
os << "# SystemC::Coverage-3\n"; os << "# SystemC::Coverage-3\n";
// Build list of events; totalize if collapsing hierarchy // Build list of events; totalize if collapsing hierarchy
typedef std::map<std::string, std::pair<std::string, vluint64_t>> EventMap; typedef std::map<const std::string, std::pair<std::string, vluint64_t>> EventMap;
EventMap eventCounts; EventMap eventCounts;
for (const auto& itemp : m_items) { for (const auto& itemp : m_items) {
std::string name; std::string name;

View File

@ -181,8 +181,7 @@ public:
T_Value& at(const T_Key& index) { T_Value& at(const T_Key& index) {
const auto it = m_map.find(index); const auto it = m_map.find(index);
if (it == m_map.end()) { if (it == m_map.end()) {
std::pair<typename Map::iterator, bool> pit const auto pit = m_map.insert(std::make_pair(index, m_defaultValue));
= m_map.insert(std::make_pair(index, m_defaultValue));
return pit.first->second; return pit.first->second;
} }
return it->second; return it->second;

View File

@ -76,7 +76,7 @@ private:
std::vector<char> m_suffixes; ///< VCD line end string codes + metadata std::vector<char> m_suffixes; ///< VCD line end string codes + metadata
const char* m_suffixesp; ///< Pointer to first element of above const char* m_suffixesp; ///< Pointer to first element of above
typedef std::map<std::string, std::string> NameMap; typedef std::map<const std::string, const std::string> NameMap;
NameMap* m_namemapp = nullptr; ///< List of names for the header NameMap* m_namemapp = nullptr; ///< List of names for the header
void bufferResize(vluint64_t minsize); void bufferResize(vluint64_t minsize);

View File

@ -2453,7 +2453,7 @@ class AstNodeUOrStructDType : public AstNodeDType {
// A struct or union; common handling // A struct or union; common handling
private: private:
// TYPES // TYPES
typedef std::map<string, AstMemberDType*> MemberNameMap; typedef std::map<const string, AstMemberDType*> MemberNameMap;
// MEMBERS // MEMBERS
string m_name; // Name from upper typedef, if any string m_name; // Name from upper typedef, if any
bool m_packed; bool m_packed;

View File

@ -300,7 +300,7 @@ public:
class AstClass : public AstNodeModule { class AstClass : public AstNodeModule {
// TYPES // TYPES
typedef std::map<string, AstNode*> MemberNameMap; typedef std::map<const string, AstNode*> MemberNameMap;
// MEMBERS // MEMBERS
MemberNameMap m_members; // Members or method children MemberNameMap m_members; // Members or method children
AstClassPackage* m_packagep = nullptr; // Class package this is under AstClassPackage* m_packagep = nullptr; // Class package this is under

View File

@ -41,7 +41,7 @@ private:
// MEMBERS // MEMBERS
AstNodeModule* m_modInsertp; // Current module to insert AstCUse under AstNodeModule* m_modInsertp; // Current module to insert AstCUse under
typedef std::pair<VUseType, string> UseString; typedef std::pair<VUseType, string> UseString;
std::map<UseString, AstCUse*> m_didUse; // What we already used std::map<const UseString, AstCUse*> m_didUse; // What we already used
// NODE STATE // NODE STATE
// Entire netlist: // Entire netlist:

View File

@ -33,7 +33,7 @@
// cache of resolved entities. Entities stored in this container need an update // cache of resolved entities. Entities stored in this container need an update
// function that takes a reference of this type to join multiple entities into one. // function that takes a reference of this type to join multiple entities into one.
template <typename T> class V3ConfigWildcardResolver { template <typename T> class V3ConfigWildcardResolver {
typedef std::map<string, T> Map; typedef std::map<const string, T> Map;
Map m_mapWildcard; // Wildcard strings to entities Map m_mapWildcard; // Wildcard strings to entities
Map m_mapResolved; // Resolved strings to converged entities Map m_mapResolved; // Resolved strings to converged entities

View File

@ -95,10 +95,10 @@ private:
bool m_inDly = false; // True in delayed assignments bool m_inDly = false; // True in delayed assignments
bool m_inLoop = false; // True in for loops bool m_inLoop = false; // True in for loops
bool m_inInitial = false; // True in initial blocks bool m_inInitial = false; // True in initial blocks
typedef std::map<std::pair<AstNodeModule*, string>, AstVar*> VarMap; typedef std::map<const std::pair<AstNodeModule*, string>, AstVar*> VarMap;
VarMap m_modVarMap; // Table of new var names created under module VarMap m_modVarMap; // Table of new var names created under module
VDouble0 m_statSharedSet; // Statistic tracking VDouble0 m_statSharedSet; // Statistic tracking
typedef std::map<AstVarScope*, int> ScopeVecMap; typedef std::map<const AstVarScope*, int> ScopeVecMap;
ScopeVecMap m_scopeVecMap; // Next var number for each scope ScopeVecMap m_scopeVecMap; // Next var number for each scope
// METHODS // METHODS

View File

@ -2874,7 +2874,7 @@ void EmitCStmts::emitVarSort(const VarSortMap& vmap, VarVec* sortedp) {
} }
// MacroTask mode. Sort by MTask-affinity group first, size second. // MacroTask mode. Sort by MTask-affinity group first, size second.
typedef std::map<MTaskIdSet, VarSortMap> MTaskVarSortMap; typedef std::map<const MTaskIdSet, VarSortMap> MTaskVarSortMap;
MTaskVarSortMap m2v; MTaskVarSortMap m2v;
for (VarSortMap::const_iterator it = vmap.begin(); it != vmap.end(); ++it) { for (VarSortMap::const_iterator it = vmap.begin(); it != vmap.end(); ++it) {
int size_class = it->first; int size_class = it->first;

View File

@ -71,13 +71,13 @@ class EmitCSyms : EmitCBaseVisitor {
, m_modp{modp} , m_modp{modp}
, m_scopep{scopep} {} , m_scopep{scopep} {}
}; };
typedef std::map<string, ScopeFuncData> ScopeFuncs; typedef std::map<const string, ScopeFuncData> ScopeFuncs;
typedef std::map<string, ScopeVarData> ScopeVars; typedef std::map<const string, ScopeVarData> ScopeVars;
typedef std::map<string, ScopeData> ScopeNames; typedef std::map<const string, ScopeData> ScopeNames;
typedef std::pair<AstScope*, AstNodeModule*> ScopeModPair; typedef std::pair<AstScope*, AstNodeModule*> ScopeModPair;
typedef std::pair<AstNodeModule*, AstVar*> ModVarPair; typedef std::pair<AstNodeModule*, AstVar*> ModVarPair;
typedef std::vector<string> ScopeNameList; typedef std::vector<string> ScopeNameList;
typedef std::map<string, ScopeNameList> ScopeNameHierarchy; typedef std::map<const string, ScopeNameList> ScopeNameHierarchy;
struct CmpName { struct CmpName {
inline bool operator()(const ScopeModPair& lhsp, const ScopeModPair& rhsp) const { inline bool operator()(const ScopeModPair& lhsp, const ScopeModPair& rhsp) const {
return lhsp.first->name() < rhsp.first->name(); return lhsp.first->name() < rhsp.first->name();
@ -395,7 +395,7 @@ void EmitCSyms::emitSymHdr() {
if (v3Global.dpi()) { if (v3Global.dpi()) {
puts("\n// DPI TYPES for DPI Export callbacks (Internal use)\n"); puts("\n// DPI TYPES for DPI Export callbacks (Internal use)\n");
std::map<string, int> types; // Remove duplicates and sort std::map<const string, int> types; // Remove duplicates and sort
for (ScopeFuncs::iterator it = m_scopeFuncs.begin(); it != m_scopeFuncs.end(); ++it) { for (ScopeFuncs::iterator it = m_scopeFuncs.begin(); it != m_scopeFuncs.end(); ++it) {
AstCFunc* funcp = it->second.m_funcp; AstCFunc* funcp = it->second.m_funcp;
if (funcp->dpiExport()) { if (funcp->dpiExport()) {
@ -403,9 +403,7 @@ void EmitCSyms::emitSymHdr() {
types["typedef void (*" + cbtype + ") (" + cFuncArgs(funcp) + ");\n"] = 1; types["typedef void (*" + cbtype + ") (" + cFuncArgs(funcp) + ");\n"] = 1;
} }
} }
for (std::map<string, int>::iterator it = types.begin(); it != types.end(); ++it) { for (const auto& i : types) puts(i.first);
puts(it->first);
}
} }
puts("\n// SYMS CLASS\n"); puts("\n// SYMS CLASS\n");
@ -432,9 +430,9 @@ void EmitCSyms::emitSymHdr() {
puts("bool __Vm_didInit;\n"); puts("bool __Vm_didInit;\n");
puts("\n// SUBCELL STATE\n"); puts("\n// SUBCELL STATE\n");
for (std::vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { for (const auto& i : m_scopes) {
AstScope* scopep = it->first; AstScope* scopep = i.first;
AstNodeModule* modp = it->second; AstNodeModule* modp = i.second;
if (VN_IS(modp, Class)) continue; if (VN_IS(modp, Class)) continue;
if (modp->isTop()) { if (modp->isTop()) {
ofp()->printf("%-30s ", (prefixNameProtect(modp) + "*").c_str()); ofp()->printf("%-30s ", (prefixNameProtect(modp) + "*").c_str());
@ -469,9 +467,9 @@ void EmitCSyms::emitSymHdr() {
puts(symClassName() + "(" + topClassName() + "* topp, const char* namep);\n"); puts(symClassName() + "(" + topClassName() + "* topp, const char* namep);\n");
puts(string("~") + symClassName() + "() {}\n"); puts(string("~") + symClassName() + "() {}\n");
for (std::map<int, bool>::iterator it = m_usesVfinal.begin(); it != m_usesVfinal.end(); ++it) { for (const auto& i : m_usesVfinal) {
puts("void " + symClassName() + "_" + cvtToStr(it->first) + "("); puts("void " + symClassName() + "_" + cvtToStr(i.first) + "(");
if (it->second) { if (i.second) {
puts("int __Vfinal"); puts("int __Vfinal");
} else { } else {
puts(topClassName() + "* topp"); puts(topClassName() + "* topp");
@ -619,9 +617,9 @@ void EmitCSyms::emitSymImp() {
puts(" , __Vm_didInit(false)\n"); puts(" , __Vm_didInit(false)\n");
puts(" // Setup submodule names\n"); puts(" // Setup submodule names\n");
char comma = ','; char comma = ',';
for (std::vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { for (const auto& i : m_scopes) {
AstScope* scopep = it->first; AstScope* scopep = i.first;
AstNodeModule* modp = it->second; AstNodeModule* modp = i.second;
if (modp->isTop()) { if (modp->isTop()) {
} else { } else {
puts(string(" ") + comma + " " + protect(scopep->nameDotless())); puts(string(" ") + comma + " " + protect(scopep->nameDotless()));
@ -638,9 +636,9 @@ void EmitCSyms::emitSymImp() {
puts("// Pointer to top level\n"); puts("// Pointer to top level\n");
puts("TOPp = topp;\n"); puts("TOPp = topp;\n");
puts("// Setup each module's pointers to their submodules\n"); puts("// Setup each module's pointers to their submodules\n");
for (std::vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { for (const auto& i : m_scopes) {
AstScope* scopep = it->first; AstScope* scopep = i.first;
AstNodeModule* modp = it->second; AstNodeModule* modp = i.second;
if (!modp->isTop()) { if (!modp->isTop()) {
checkSplit(false); checkSplit(false);
string arrow = scopep->name(); string arrow = scopep->name();
@ -656,9 +654,9 @@ void EmitCSyms::emitSymImp() {
puts("// Setup each module's pointer back to symbol table (for public functions)\n"); puts("// Setup each module's pointer back to symbol table (for public functions)\n");
puts("TOPp->" + protect("__Vconfigure") + "(this, true);\n"); puts("TOPp->" + protect("__Vconfigure") + "(this, true);\n");
for (std::vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { for (const auto& i : m_scopes) {
AstScope* scopep = it->first; AstScope* scopep = i.first;
AstNodeModule* modp = it->second; AstNodeModule* modp = i.second;
if (!modp->isTop()) { if (!modp->isTop()) {
checkSplit(false); checkSplit(false);
// first is used by AstCoverDecl's call to __vlCoverInsert // first is used by AstCoverDecl's call to __vlCoverInsert

View File

@ -331,7 +331,7 @@ void V3File::createMakeDir() {
// VInFilterImp // VInFilterImp
class VInFilterImp { class VInFilterImp {
typedef std::map<string, string> FileContentsMap; typedef std::map<const string, string> FileContentsMap;
typedef VInFilter::StrList StrList; typedef VInFilter::StrList StrList;
FileContentsMap m_contentsMap; // Cache of file contents FileContentsMap m_contentsMap; // Cache of file contents
@ -954,7 +954,7 @@ void V3OutCFile::putsGuard() {
class VIdProtectImp { class VIdProtectImp {
// MEMBERS // MEMBERS
typedef std::map<string, string> IdMap; typedef std::map<const string, string> IdMap;
IdMap m_nameMap; // Map of old name into new name IdMap m_nameMap; // Map of old name into new name
typedef std::unordered_set<std::string> IdSet; typedef std::unordered_set<std::string> IdSet;
IdSet m_newIdSet; // Which new names exist IdSet m_newIdSet; // Which new names exist

View File

@ -39,7 +39,7 @@ class FileLine;
//! source file (each with its own unique filename number). //! source file (each with its own unique filename number).
class FileLineSingleton { class FileLineSingleton {
// TYPES // TYPES
typedef std::map<string, int> FileNameNumMap; typedef std::map<const string, int> FileNameNumMap;
// MEMBERS // MEMBERS
FileNameNumMap m_namemap; // filenameno for each filename FileNameNumMap m_namemap; // filenameno for each filename
std::deque<string> m_names; // filename text for each filenameno std::deque<string> m_names; // filename text for each filenameno

View File

@ -335,7 +335,7 @@ void V3Graph::dumpDotFile(const string& filename, bool colorAsSubgraph) const {
// We use a map here, as we don't want to corrupt anything (userp) in the graph, // We use a map here, as we don't want to corrupt anything (userp) in the graph,
// and we don't care if this is slow. // and we don't care if this is slow.
std::map<V3GraphVertex*, int> numMap; std::map<const V3GraphVertex*, int> numMap;
// Print vertices // Print vertices
int n = 0; int n = 0;

View File

@ -174,9 +174,8 @@ void V3Hashed::dumpFile(const string& filename, bool tree) {
} }
*logp << "\n*** STATS:\n" << endl; *logp << "\n*** STATS:\n" << endl;
*logp << " #InBucket Occurrences\n"; *logp << " #InBucket Occurrences\n";
for (std::map<int, int>::iterator it = dist.begin(); it != dist.end(); ++it) { for (const auto& i : dist) {
*logp << " " << std::setw(9) << it->first << " " << std::setw(12) << it->second *logp << " " << std::setw(9) << i.first << " " << std::setw(12) << i.second << endl;
<< endl;
} }
*logp << "\n*** Dump:\n" << endl; *logp << "\n*** Dump:\n" << endl;

View File

@ -141,7 +141,7 @@ class InstDeModVarVisitor : public AstNVisitor {
// Expand all module variables, and save names for later reference // Expand all module variables, and save names for later reference
private: private:
// STATE // STATE
typedef std::map<string, AstVar*> VarNameMap; typedef std::map<const string, AstVar*> VarNameMap;
VarNameMap m_modVarNameMap; // Per module, name of cloned variables VarNameMap m_modVarNameMap; // Per module, name of cloned variables
VL_DEBUG_FUNC; // Declare debug() VL_DEBUG_FUNC; // Declare debug()

View File

@ -27,7 +27,7 @@
class V3LanguageWords { class V3LanguageWords {
// List of common reserved keywords // List of common reserved keywords
private: private:
typedef std::map<string, string> KeywordMap; typedef std::map<const string, string> KeywordMap;
struct Singleton { struct Singleton {
KeywordMap s_kwdMap; // List of keywords, and what language applies KeywordMap s_kwdMap; // List of keywords, and what language applies
Singleton() { init(); } Singleton() { init(); }

View File

@ -183,9 +183,8 @@ private:
return true; return true;
} }
if (before(assignPostLoc, loc)) return true; if (before(assignPostLoc, loc)) return true;
for (std::set<LifeLocation>::iterator it = dlyVarAssigns.begin(); for (const auto& i : dlyVarAssigns) {
it != dlyVarAssigns.end(); ++it) { if (!before(loc, i)) return false;
if (!before(loc, *it)) return false;
} }
return true; return true;
} }

View File

@ -44,7 +44,7 @@ private:
AstUser2InUse m_inuser2; AstUser2InUse m_inuser2;
// TYPES // TYPES
typedef std::map<std::pair<void*, string>, AstTypedef*> ImplTypedefMap; typedef std::map<const std::pair<void*, string>, AstTypedef*> ImplTypedefMap;
typedef std::set<FileLine*> FileLineSet; typedef std::set<FileLine*> FileLineSet;
// STATE // STATE

View File

@ -53,7 +53,7 @@
class V3OptionsImp { class V3OptionsImp {
public: public:
// TYPES // TYPES
typedef std::map<string, std::set<string>> DirMap; // Directory listing typedef std::map<const string, std::set<string>> DirMap; // Directory listing
// STATE // STATE
std::list<string> m_allArgs; // List of every argument encountered std::list<string> m_allArgs; // List of every argument encountered
@ -61,7 +61,7 @@ public:
std::set<string> m_incDirUserSet; // Include directories (for removing duplicates) std::set<string> m_incDirUserSet; // Include directories (for removing duplicates)
std::list<string> m_incDirFallbacks; // Include directories (ordered) std::list<string> m_incDirFallbacks; // Include directories (ordered)
std::set<string> m_incDirFallbackSet; // Include directories (for removing duplicates) std::set<string> m_incDirFallbackSet; // Include directories (for removing duplicates)
std::map<string, V3LangCode> m_langExts; // Language extension map std::map<const string, V3LangCode> m_langExts; // Language extension map
std::list<string> m_libExtVs; // Library extensions (ordered) std::list<string> m_libExtVs; // Library extensions (ordered)
std::set<string> m_libExtVSet; // Library extensions (for removing duplicates) std::set<string> m_libExtVSet; // Library extensions (for removing duplicates)
DirMap m_dirMap; // Directory listing DirMap m_dirMap; // Directory listing
@ -346,10 +346,7 @@ void V3Options::checkParameters() {
if (!m_parameters.empty()) { if (!m_parameters.empty()) {
std::stringstream msg; std::stringstream msg;
msg << "Parameters from the command line were not found in the design:"; msg << "Parameters from the command line were not found in the design:";
for (std::map<string, string>::iterator it = m_parameters.begin(); for (const auto& i : m_parameters) msg << " " << i.first;
it != m_parameters.end(); ++it) {
msg << " " << it->first;
}
v3error(msg.str()); v3error(msg.str());
} }
} }

View File

@ -201,7 +201,7 @@ typedef std::set<string> V3StringSet;
class V3HierarchicalBlockOption { class V3HierarchicalBlockOption {
public: public:
// key:parameter name, value:value (as string) // key:parameter name, value:value (as string)
typedef std::map<string, string> ParamStrMap; typedef std::map<const string, string> ParamStrMap;
private: private:
string m_origName; // module name string m_origName; // module name
@ -218,7 +218,7 @@ public:
const ParamStrMap params() const { return m_parameters; } const ParamStrMap params() const { return m_parameters; }
}; };
typedef std::map<string, V3HierarchicalBlockOption> V3HierBlockOptSet; typedef std::map<const string, V3HierarchicalBlockOption> V3HierBlockOptSet;
//###################################################################### //######################################################################
// V3Options - Command line options // V3Options - Command line options
@ -227,7 +227,7 @@ class V3Options {
public: public:
private: private:
// TYPES // TYPES
typedef std::map<string, int> DebugSrcMap; typedef std::map<const string, int> DebugSrcMap;
// MEMBERS (general options) // MEMBERS (general options)
V3OptionsImp* m_impp; // Slow hidden options V3OptionsImp* m_impp; // Slow hidden options
@ -245,8 +245,8 @@ private:
V3StringList m_forceIncs; // argument: -FI V3StringList m_forceIncs; // argument: -FI
DebugSrcMap m_debugSrcs; // argument: --debugi-<srcfile>=<level> DebugSrcMap m_debugSrcs; // argument: --debugi-<srcfile>=<level>
DebugSrcMap m_dumpTrees; // argument: --dump-treei-<srcfile>=<level> DebugSrcMap m_dumpTrees; // argument: --dump-treei-<srcfile>=<level>
std::map<string,string> m_parameters; // Parameters std::map<const string, string> m_parameters; // Parameters
std::map<string, V3HierarchicalBlockOption> m_hierBlocks; // main switch: --hierarchical-block std::map<const string, V3HierarchicalBlockOption> m_hierBlocks; // main switch: --hierarchical-block
bool m_preprocOnly = false; // main switch: -E bool m_preprocOnly = false; // main switch: -E
bool m_makePhony = false; // main switch: -MP bool m_makePhony = false; // main switch: -MP

View File

@ -68,8 +68,8 @@
class ParameterizedHierBlocks { class ParameterizedHierBlocks {
typedef std::multimap<string, const V3HierarchicalBlockOption*> HierBlockOptsByOrigName; typedef std::multimap<string, const V3HierarchicalBlockOption*> HierBlockOptsByOrigName;
typedef HierBlockOptsByOrigName::const_iterator HierMapIt; typedef HierBlockOptsByOrigName::const_iterator HierMapIt;
typedef std::map<string, AstNodeModule*> HierBlockModMap; typedef std::map<const string, AstNodeModule*> HierBlockModMap;
typedef std::map<string, AstConst*> ParamConstMap; typedef std::map<const string, AstConst*> ParamConstMap;
typedef std::map<const V3HierarchicalBlockOption*, ParamConstMap> ParamsMap; typedef std::map<const V3HierarchicalBlockOption*, ParamConstMap> ParamsMap;
// MEMBERS // MEMBERS
@ -218,17 +218,17 @@ private:
typedef std::deque<std::pair<AstIfaceRefDType*, AstIfaceRefDType*>> IfaceRefRefs; typedef std::deque<std::pair<AstIfaceRefDType*, AstIfaceRefDType*>> IfaceRefRefs;
// STATE // STATE
typedef std::map<AstNode*, AstNode*> CloneMap; typedef std::map<const AstNode*, AstNode*> CloneMap;
struct ModInfo { struct ModInfo {
AstNodeModule* m_modp; // Module with specified name AstNodeModule* m_modp; // Module with specified name
CloneMap m_cloneMap; // Map of old-varp -> new cloned varp CloneMap m_cloneMap; // Map of old-varp -> new cloned varp
explicit ModInfo(AstNodeModule* modp) explicit ModInfo(AstNodeModule* modp)
: m_modp{modp} {} : m_modp{modp} {}
}; };
typedef std::map<string, ModInfo> ModNameMap; typedef std::map<const string, ModInfo> ModNameMap;
ModNameMap m_modNameMap; // Hash of created module flavors by name ModNameMap m_modNameMap; // Hash of created module flavors by name
typedef std::map<string, string> LongMap; typedef std::map<const string, string> LongMap;
LongMap m_longMap; // Hash of very long names to unique identity number LongMap m_longMap; // Hash of very long names to unique identity number
int m_longId = 0; int m_longId = 0;
@ -237,7 +237,7 @@ private:
V3StringSet m_allModuleNames; V3StringSet m_allModuleNames;
typedef std::pair<int, string> ValueMapValue; typedef std::pair<int, string> ValueMapValue;
typedef std::map<V3Hash, ValueMapValue> ValueMap; typedef std::map<const V3Hash, ValueMapValue> ValueMap;
ValueMap m_valueMap; // Hash of node hash to (param value, name) ValueMap m_valueMap; // Hash of node hash to (param value, name)
int m_nextValue = 1; // Next value to use in m_valueMap int m_nextValue = 1; // Next value to use in m_valueMap
@ -370,7 +370,7 @@ private:
} }
} }
void relinkPinsByName(AstPin* startpinp, AstNodeModule* modp) { void relinkPinsByName(AstPin* startpinp, AstNodeModule* modp) {
std::map<string, AstVar*> nameToPin; std::map<const string, AstVar*> nameToPin;
for (AstNode* stmtp = modp->stmtsp(); stmtp; stmtp = stmtp->nextp()) { for (AstNode* stmtp = modp->stmtsp(); stmtp; stmtp = stmtp->nextp()) {
if (AstVar* varp = VN_CAST(stmtp, Var)) { if (AstVar* varp = VN_CAST(stmtp, Var)) {
if (varp->isIO() || varp->isGParam() || varp->isIfaceRef()) { if (varp->isIO() || varp->isGParam() || varp->isIfaceRef()) {

View File

@ -108,7 +108,7 @@ public:
class V3PreProcImp : public V3PreProc { class V3PreProcImp : public V3PreProc {
public: public:
// TYPES // TYPES
typedef std::map<string, VDefine> DefinesMap; typedef std::map<const string, VDefine> DefinesMap;
typedef VInFilter::StrList StrList; typedef VInFilter::StrList StrList;
// debug() -> see V3PreShellImp::debug; use --debugi-V3PreShell // debug() -> see V3PreShellImp::debug; use --debugi-V3PreShell
@ -585,7 +585,7 @@ string V3PreProcImp::defineSubst(VDefineRef* refp) {
string value = defValue(refp->name()); string value = defValue(refp->name());
UINFO(4, "defineValue '" << V3PreLex::cleanDbgStrg(value) << "'" << endl); UINFO(4, "defineValue '" << V3PreLex::cleanDbgStrg(value) << "'" << endl);
std::map<string, string> argValueByName; std::map<const string, string> argValueByName;
{ // Parse argument list into map { // Parse argument list into map
unsigned numArgs = 0; unsigned numArgs = 0;
string argName; string argName;

View File

@ -61,7 +61,7 @@ public:
}; };
typedef std::deque<AstConst*> ConstDeque; typedef std::deque<AstConst*> ConstDeque;
typedef std::map<AstNodeDType*, ConstDeque> ConstPile; typedef std::map<const AstNodeDType*, ConstDeque> ConstPile;
class SimulateVisitor : public AstNVisitor { class SimulateVisitor : public AstNVisitor {
// Simulate a node tree, returning value of variables // Simulate a node tree, returning value of variables

View File

@ -34,7 +34,7 @@ class StatsVisitor : public AstNVisitor {
private: private:
// NODE STATE/TYPES // NODE STATE/TYPES
typedef std::map<string, int> NameMap; // Number of times a name appears typedef std::map<const string, int> NameMap; // Number of times a name appears
// STATE // STATE
string m_stage; // Name of the stage we are scanning string m_stage; // Name of the stage we are scanning

View File

@ -222,7 +222,7 @@ private:
void createTableVars(AstNode* nodep) { void createTableVars(AstNode* nodep) {
// Create table for each output // Create table for each output
typedef std::map<string, int> NameCounts; typedef std::map<const string, int> NameCounts;
NameCounts namecounts; NameCounts namecounts;
for (const AstVarScope* outvscp : m_outVarps) { for (const AstVarScope* outvscp : m_outVarps) {
AstVar* outvarp = outvscp->varp(); AstVar* outvarp = outvscp->varp();

View File

@ -104,7 +104,7 @@ private:
// TYPES // TYPES
typedef std::map<std::pair<AstScope*, AstVar*>, AstVarScope*> VarToScopeMap; typedef std::map<std::pair<AstScope*, AstVar*>, AstVarScope*> VarToScopeMap;
typedef std::map<AstNodeFTask*, AstClass*> FuncToClassMap; typedef std::map<const AstNodeFTask*, AstClass*> FuncToClassMap;
typedef std::vector<AstInitial*> Initials; typedef std::vector<AstInitial*> Initials;
// MEMBERS // MEMBERS
VarToScopeMap m_varToScopeMap; // Map for Var -> VarScope mappings VarToScopeMap m_varToScopeMap; // Map for Var -> VarScope mappings
@ -341,7 +341,7 @@ private:
IM_AFTER, // Pointing at last inserted stmt, insert after IM_AFTER, // Pointing at last inserted stmt, insert after
IM_WHILE_PRECOND // Pointing to for loop, add to body end IM_WHILE_PRECOND // Pointing to for loop, add to body end
}; };
typedef std::map<string, std::pair<AstNodeFTask*, string>> DpiNames; typedef std::map<const string, std::pair<AstNodeFTask*, string>> DpiNames;
// STATE // STATE
TaskStateVisitor* m_statep; // Common state between visitors TaskStateVisitor* m_statep; // Common state between visitors
@ -1388,7 +1388,7 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp)
// Missing pin/expr? We return (pinvar, nullptr) // Missing pin/expr? We return (pinvar, nullptr)
// Extra pin/expr? We clean it up // Extra pin/expr? We clean it up
typedef std::map<string, int> NameToIndex; typedef std::map<const string, int> NameToIndex;
NameToIndex nameToIndex; NameToIndex nameToIndex;
V3TaskConnects tconnects; V3TaskConnects tconnects;
UASSERT_OBJ(nodep->taskp(), nodep, "unlinked"); UASSERT_OBJ(nodep->taskp(), nodep, "unlinked");

View File

@ -741,8 +741,8 @@ private:
// Remove refs to traced values from TraceDecl nodes, these have now moved under // Remove refs to traced values from TraceDecl nodes, these have now moved under
// TraceInc // TraceInc
for (TraceVec::iterator it = traces.begin(); it != traces.end(); ++it) { for (const auto& i : traces) {
AstNode* const valuep = it->second->nodep()->valuep(); AstNode* const valuep = i.second->nodep()->valuep();
valuep->unlinkFrBack(); valuep->unlinkFrBack();
valuep->deleteTree(); valuep->deleteTree();
} }

View File

@ -191,7 +191,7 @@ public:
class WidthVisitor : public AstNVisitor { class WidthVisitor : public AstNVisitor {
private: private:
// TYPES // TYPES
typedef std::map<std::pair<AstNodeDType*, AstAttrType>, AstVar*> TableMap; typedef std::map<std::pair<const AstNodeDType*, AstAttrType>, AstVar*> TableMap;
typedef std::map<int, AstPatMember*> PatVecMap; typedef std::map<int, AstPatMember*> PatVecMap;
// STATE // STATE
@ -1880,7 +1880,7 @@ private:
// Assign missing values // Assign missing values
V3Number num(nodep, nodep->width(), 0); V3Number num(nodep, nodep->width(), 0);
V3Number one(nodep, nodep->width(), 1); V3Number one(nodep, nodep->width(), 1);
std::map<V3Number, AstEnumItem*> inits; std::map<const V3Number, AstEnumItem*> inits;
for (AstEnumItem* itemp = nodep->itemsp(); itemp; for (AstEnumItem* itemp = nodep->itemsp(); itemp;
itemp = VN_CAST(itemp->nextp(), EnumItem)) { itemp = VN_CAST(itemp->nextp(), EnumItem)) {
if (itemp->valuep()) { if (itemp->valuep()) {
@ -2982,7 +2982,7 @@ private:
// which member each AstPatMember corresponds to before we can // which member each AstPatMember corresponds to before we can
// determine the dtypep for that PatMember's value, and then // determine the dtypep for that PatMember's value, and then
// width the initial value appropriately. // width the initial value appropriately.
typedef std::map<AstMemberDType*, AstPatMember*> PatMap; typedef std::map<const AstMemberDType*, AstPatMember*> PatMap;
PatMap patmap; PatMap patmap;
{ {
AstMemberDType* memp = vdtypep->membersp(); AstMemberDType* memp = vdtypep->membersp();

View File

@ -93,7 +93,7 @@ public:
class VlcPoints { class VlcPoints {
private: private:
// MEMBERS // MEMBERS
typedef std::map<string, vluint64_t> NameMap; // Sorted by name (ordered) typedef std::map<const string, vluint64_t> NameMap; // Sorted by name (ordered)
NameMap m_nameMap; //< Name to point-number NameMap m_nameMap; //< Name to point-number
std::vector<VlcPoint> m_points; //< List of all points std::vector<VlcPoint> m_points; //< List of all points
vluint64_t m_numPoints = 0; //< Total unique points vluint64_t m_numPoints = 0; //< Total unique points

View File

@ -101,7 +101,7 @@ public:
class VlcSources { class VlcSources {
public: public:
// TYPES // TYPES
typedef std::map<string, VlcSource> NameMap; typedef std::map<const string, VlcSource> NameMap;
private: private:
// MEMBERS // MEMBERS