Add --dump-defines.

This commit is contained in:
Wilson Snyder
2018-10-25 19:47:07 -04:00
parent 74a92e739f
commit e0654dc218
14 changed files with 109 additions and 14 deletions
+11
View File
@@ -231,6 +231,7 @@ public:
void insertUnreadback(const string& text) { m_lineCmt += text; }
void insertUnreadbackAtBol(const string& text);
void addLineComment(int enterExit);
void dumpDefines(std::ostream& os);
// METHODS, callbacks
virtual void comment(const string& text); // Comment detected (if keepComments==2)
@@ -798,6 +799,16 @@ void V3PreProcImp::addLineComment(int enterExit) {
}
}
void V3PreProcImp::dumpDefines(std::ostream& os) {
for (DefinesMap::iterator it = m_defines.begin(); it != m_defines.end(); ++it) {
os<<"`define "<<it->first;
// No need to print "()" below as already part of params()
if (!it->second.params().empty()) os<<it->second.params();
if (!it->second.value().empty()) os<<" "<<it->second.value();
os<<endl;
}
}
int V3PreProcImp::getRawToken() {
// Get a token from the file, whatever it may be.
while (1) {