fix simplifyUsing debug warning for: using value_type = const ValueFlow::Value; (#3211)

This commit is contained in:
IOBYTE 2021-04-17 08:20:16 -04:00 committed by GitHub
parent 93c9963378
commit 5568ac95e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -2479,7 +2479,7 @@ bool Tokenizer::simplifyUsing()
}
if (Token::Match(type, "%type%") &&
type->next() && !Token::Match(type->next(), "[|;|,|(")) {
type->next() && !Token::Match(type->next(), "[|,|(")) {
type = type->next();
} else if (Token::simpleMatch(type, "const (")) {
type = type->next();

View File

@ -70,6 +70,7 @@ private:
TEST_CASE(simplifyUsing21);
TEST_CASE(simplifyUsing22);
TEST_CASE(simplifyUsing23);
TEST_CASE(simplifyUsing24);
TEST_CASE(simplifyUsing8970);
TEST_CASE(simplifyUsing8971);
@ -585,6 +586,13 @@ private:
ASSERT_EQUALS(expected, tok(code, false)); // don't hang
}
void simplifyUsing24() {
const char code[] = "using value_type = const ValueFlow::Value;\n"
"value_type vt;";
const char expected[] = "const ValueFlow :: Value vt ;";
ASSERT_EQUALS(expected, tok(code, false));
}
void simplifyUsing8970() {
const char code[] = "using V = std::vector<int>;\n"
"struct A {\n"