diff --git a/lib/checkio.cpp b/lib/checkio.cpp index 508f47314..31797d738 100644 --- a/lib/checkio.cpp +++ b/lib/checkio.cpp @@ -1867,7 +1867,7 @@ void CheckIO::argumentType(std::ostream& os, const ArgumentInfo * argInfo) os << type->str() << "::"; type = type->tokAt(2); } - type->stringify(os, false, true); + type->stringify(os, false, true, false); if (type->strAt(1) == "*" && !argInfo->element) os << " *"; else if (argInfo->variableInfo && !argInfo->element && argInfo->variableInfo->isArray()) @@ -1883,7 +1883,7 @@ void CheckIO::argumentType(std::ostream& os, const ArgumentInfo * argInfo) if (type->strAt(1) == "*" || argInfo->address) os << " *"; os << " {aka "; - type->stringify(os, false, true); + type->stringify(os, false, true, false); if (type->strAt(1) == "*" || argInfo->address) os << " *"; os << "}"; diff --git a/lib/token.cpp b/lib/token.cpp index 83a76a948..237f5f798 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -928,7 +928,7 @@ void Token::printOut(const char *title, const std::vector &fileName std::cout << stringifyList(true, true, true, true, true, &fileNames, 0) << std::endl; } -void Token::stringify(std::ostream& os, bool varid, bool attributes) const +void Token::stringify(std::ostream& os, bool varid, bool attributes, bool macro) const { if (attributes) { if (isUnsigned()) @@ -942,7 +942,7 @@ void Token::stringify(std::ostream& os, bool varid, bool attributes) const os << "long "; } } - if (isExpandedMacro()) + if (macro && isExpandedMacro()) os << "$"; if (_str[0] != '\"' || _str.find("\0") == std::string::npos) os << _str; @@ -1007,7 +1007,7 @@ std::string Token::stringifyList(bool varid, bool attributes, bool linenumbers, lineNumber = tok->linenr(); } - tok->stringify(ret, varid, attributes); // print token + tok->stringify(ret, varid, attributes, attributes); // print token if (tok->next() != end && (!linebreaks || (tok->next()->linenr() <= tok->linenr() && tok->next()->fileIndex() == tok->fileIndex()))) ret << ' '; } diff --git a/lib/token.h b/lib/token.h index 648ee1f34..3f2fa0b9e 100644 --- a/lib/token.h +++ b/lib/token.h @@ -481,8 +481,9 @@ public: * @param os The result is shifted into that output stream * @param varid Print varids. (Style: "varname@id") * @param attributes Print attributes of tokens like "unsigned" in front of it. + * @param macro Prints $ in front of the token if it was expanded from a macro. */ - void stringify(std::ostream& os, bool varid, bool attributes) const; + void stringify(std::ostream& os, bool varid, bool attributes, bool macro) const; /** * Stringify a list of token, from current instance on.