dump: add more template info to dumpfile
This commit is contained in:
parent
30b3d73229
commit
b0e8ed3117
|
@ -247,6 +247,13 @@ TemplateSimplifier::TokenAndName::~TokenAndName()
|
|||
mToken->templateSimplifierPointers()->erase(this);
|
||||
}
|
||||
|
||||
std::string TemplateSimplifier::TokenAndName::dump(const std::vector<std::string>& fileNames) const {
|
||||
std::string ret = " <TokenAndName name=\"" + mName + "\" file=\"" + ErrorLogger::toxml(fileNames.at(mToken->fileIndex())) + "\" line=\"" + std::to_string(mToken->linenr()) + "\">\n";
|
||||
for (const Token* tok = mToken; tok && !Token::Match(tok, "[;{}]"); tok = tok->next())
|
||||
ret += " " + ErrorLogger::toxml(tok->str()) + "\n";
|
||||
return ret + " </TokenAndName>\n";
|
||||
}
|
||||
|
||||
const Token * TemplateSimplifier::TokenAndName::aliasStartToken() const
|
||||
{
|
||||
if (mParamEnd)
|
||||
|
@ -3749,8 +3756,16 @@ void TemplateSimplifier::simplifyTemplates(
|
|||
|
||||
const bool hasTemplates = getTemplateDeclarations();
|
||||
|
||||
if (passCount == 0)
|
||||
if (passCount == 0) {
|
||||
codeWithTemplates = hasTemplates;
|
||||
mDump.clear();
|
||||
for (const TokenAndName& t: mTemplateDeclarations)
|
||||
mDump += t.dump(mTokenizer.list.getFiles());
|
||||
for (const TokenAndName& t: mTemplateForwardDeclarations)
|
||||
mDump += t.dump(mTokenizer.list.getFiles());
|
||||
if (!mDump.empty())
|
||||
mDump = " <TemplateSimplifier>\n" + mDump + " </TemplateSimplifier>\n";
|
||||
}
|
||||
|
||||
// Make sure there is something to simplify.
|
||||
if (mTemplateDeclarations.empty() && mTemplateForwardDeclarations.empty())
|
||||
|
|
|
@ -49,6 +49,10 @@ public:
|
|||
explicit TemplateSimplifier(Tokenizer &tokenizer);
|
||||
~TemplateSimplifier();
|
||||
|
||||
std::string dump() const {
|
||||
return mDump;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
void checkComplicatedSyntaxErrorsInTemplates();
|
||||
|
@ -156,6 +160,8 @@ public:
|
|||
mNameToken == rhs.mNameToken && mParamEnd == rhs.mParamEnd && mFlags == rhs.mFlags;
|
||||
}
|
||||
|
||||
std::string dump(const std::vector<std::string>& fileNames) const;
|
||||
|
||||
// TODO: do not return non-const pointer from const object
|
||||
Token * token() const {
|
||||
return mToken;
|
||||
|
@ -506,6 +512,7 @@ private:
|
|||
std::vector<TokenAndName> mExplicitInstantiationsToDelete;
|
||||
std::vector<TokenAndName> mTypesUsedInTemplateInstantiation;
|
||||
std::unordered_map<const Token*, int> mTemplateNamePos;
|
||||
std::string mDump;
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
|
|
@ -5347,6 +5347,7 @@ void Tokenizer::dump(std::ostream &out) const
|
|||
}
|
||||
out << " </typedef-info>" << std::endl;
|
||||
}
|
||||
out << mTemplateSimplifier->dump();
|
||||
}
|
||||
|
||||
void Tokenizer::simplifyHeadersAndUnusedTemplates()
|
||||
|
|
Loading…
Reference in New Issue