fix simplifyUsing debug warning for: using value_type = const ValueFlow::Value; (#3211)
This commit is contained in:
parent
93c9963378
commit
5568ac95e7
|
@ -2479,7 +2479,7 @@ bool Tokenizer::simplifyUsing()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token::Match(type, "%type%") &&
|
if (Token::Match(type, "%type%") &&
|
||||||
type->next() && !Token::Match(type->next(), "[|;|,|(")) {
|
type->next() && !Token::Match(type->next(), "[|,|(")) {
|
||||||
type = type->next();
|
type = type->next();
|
||||||
} else if (Token::simpleMatch(type, "const (")) {
|
} else if (Token::simpleMatch(type, "const (")) {
|
||||||
type = type->next();
|
type = type->next();
|
||||||
|
|
|
@ -70,6 +70,7 @@ private:
|
||||||
TEST_CASE(simplifyUsing21);
|
TEST_CASE(simplifyUsing21);
|
||||||
TEST_CASE(simplifyUsing22);
|
TEST_CASE(simplifyUsing22);
|
||||||
TEST_CASE(simplifyUsing23);
|
TEST_CASE(simplifyUsing23);
|
||||||
|
TEST_CASE(simplifyUsing24);
|
||||||
|
|
||||||
TEST_CASE(simplifyUsing8970);
|
TEST_CASE(simplifyUsing8970);
|
||||||
TEST_CASE(simplifyUsing8971);
|
TEST_CASE(simplifyUsing8971);
|
||||||
|
@ -585,6 +586,13 @@ private:
|
||||||
ASSERT_EQUALS(expected, tok(code, false)); // don't hang
|
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() {
|
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