template simplifier: fix a template alias TODO test (#1823)
This commit is contained in:
parent
f6527fcd9b
commit
baeae95bac
|
@ -1119,7 +1119,7 @@ void TemplateSimplifier::simplifyTemplateAliases()
|
||||||
}
|
}
|
||||||
tok2 = aliasUsage.token->next(); // the '<'
|
tok2 = aliasUsage.token->next(); // the '<'
|
||||||
const Token * const endToken1 = templateAlias.token->next()->findClosingBracket();
|
const Token * const endToken1 = templateAlias.token->next()->findClosingBracket();
|
||||||
const Token * const endToken2 = TokenList::copyTokens(tok2, templateAlias.token->tokAt(2), endToken1->previous(), false);
|
const Token * const endToken2 = TokenList::copyTokens(tok2, templateAlias.token->tokAt(2), endToken1->previous(), false)->next();
|
||||||
for (const Token *tok1 = templateAlias.token->next(); tok2 != endToken2; tok1 = tok1->next(), tok2 = tok2->next()) {
|
for (const Token *tok1 = templateAlias.token->next(); tok2 != endToken2; tok1 = tok1->next(), tok2 = tok2->next()) {
|
||||||
if (!tok2->isName())
|
if (!tok2->isName())
|
||||||
continue;
|
continue;
|
||||||
|
@ -1147,7 +1147,7 @@ void TemplateSimplifier::simplifyTemplateAliases()
|
||||||
endToken = endToken1->next();
|
endToken = endToken1->next();
|
||||||
|
|
||||||
// Remove alias usage code (parameters)
|
// Remove alias usage code (parameters)
|
||||||
Token::eraseTokens(tok2, args.back().second);
|
Token::eraseTokens(tok2->previous(), args.back().second);
|
||||||
}
|
}
|
||||||
if (endToken) {
|
if (endToken) {
|
||||||
// Remove all template instantiations in template alias
|
// Remove all template instantiations in template alias
|
||||||
|
|
|
@ -3397,12 +3397,9 @@ private:
|
||||||
"IntrusivePtr<Vertex<int>> p;";
|
"IntrusivePtr<Vertex<int>> p;";
|
||||||
const char expected[] = "; "
|
const char expected[] = "; "
|
||||||
"class Vertex<int> ; "
|
"class Vertex<int> ; "
|
||||||
"boost :: intrusive_ptr < Vertex<int> > p ;"
|
"boost :: intrusive_ptr < Vertex<int> > p ; "
|
||||||
"class Vertex<int> { } ;";
|
"class Vertex<int> { } ;";
|
||||||
const char actual[] = "; "
|
ASSERT_EQUALS(expected, tok(code));
|
||||||
"template < class T > class Vertex { } ; "
|
|
||||||
"boost :: intrusive_ptr < T > p ;";
|
|
||||||
TODO_ASSERT_EQUALS(expected, actual, tok(code));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int instantiateMatch(const char code[], const std::size_t numberOfArguments, const char patternAfter[]) {
|
unsigned int instantiateMatch(const char code[], const std::size_t numberOfArguments, const char patternAfter[]) {
|
||||||
|
|
Loading…
Reference in New Issue