parent
9367be804e
commit
bb3f490edd
|
@ -2041,13 +2041,18 @@ namespace {
|
||||||
base += ' ';
|
base += ' ';
|
||||||
base += tok->str();
|
base += tok->str();
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
// skip template parameters
|
// add template parameters
|
||||||
if (tok && tok->str() == "<") {
|
if (tok && tok->str() == "<") {
|
||||||
tok = tok->findClosingBracket();
|
const Token* endTok = tok->findClosingBracket();
|
||||||
if (tok)
|
if (endTok) {
|
||||||
|
endTok = endTok->next();
|
||||||
|
while (tok != endTok) {
|
||||||
|
base += tok->str();
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
baseTypes.insert(base);
|
baseTypes.insert(base);
|
||||||
} while (tok && !Token::Match(tok, ";|{"));
|
} while (tok && !Token::Match(tok, ";|{"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ private:
|
||||||
TEST_CASE(simplifyUsing23);
|
TEST_CASE(simplifyUsing23);
|
||||||
TEST_CASE(simplifyUsing24);
|
TEST_CASE(simplifyUsing24);
|
||||||
TEST_CASE(simplifyUsing25);
|
TEST_CASE(simplifyUsing25);
|
||||||
|
TEST_CASE(simplifyUsing26); // #11090
|
||||||
|
|
||||||
TEST_CASE(simplifyUsing8970);
|
TEST_CASE(simplifyUsing8970);
|
||||||
TEST_CASE(simplifyUsing8971);
|
TEST_CASE(simplifyUsing8971);
|
||||||
|
@ -617,6 +618,34 @@ private:
|
||||||
ASSERT_EQUALS(expected, tok(code));
|
ASSERT_EQUALS(expected, tok(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void simplifyUsing26() { // #11090
|
||||||
|
const char code[] = "namespace M {\n"
|
||||||
|
" struct A;\n"
|
||||||
|
" struct B;\n"
|
||||||
|
" struct C;\n"
|
||||||
|
" template<typename T>\n"
|
||||||
|
" struct F {};\n"
|
||||||
|
" template<>\n"
|
||||||
|
" struct F<B> : F<A> {};\n"
|
||||||
|
" template<>\n"
|
||||||
|
" struct F<C> : F<A> {};\n"
|
||||||
|
"}\n"
|
||||||
|
"namespace N {\n"
|
||||||
|
" using namespace M;\n"
|
||||||
|
" using A = void;\n"
|
||||||
|
"}\n";
|
||||||
|
const char expected[] = "namespace M { "
|
||||||
|
"struct A ; struct B ; struct C ; "
|
||||||
|
"struct F<C> ; struct F<B> ; struct F<A> ; "
|
||||||
|
"struct F<B> : F<A> { } ; struct F<C> : F<A> { } ; "
|
||||||
|
"} "
|
||||||
|
"namespace N { "
|
||||||
|
"using namespace M ; "
|
||||||
|
"} "
|
||||||
|
"struct M :: F<A> { } ;";
|
||||||
|
ASSERT_EQUALS(expected, tok(code));
|
||||||
|
}
|
||||||
|
|
||||||
void simplifyUsing8970() {
|
void simplifyUsing8970() {
|
||||||
const char code[] = "using V = std::vector<int>;\n"
|
const char code[] = "using V = std::vector<int>;\n"
|
||||||
"struct A {\n"
|
"struct A {\n"
|
||||||
|
|
Loading…
Reference in New Issue