Fixed #4430 (FP: Member variable is not initialized in the constructor.)
This commit is contained in:
parent
47e1a571f7
commit
dae232015e
|
@ -4607,7 +4607,7 @@ bool Tokenizer::simplifyFunctionParameters()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the function e.g. foo( x ) or foo( x, y )
|
// Find the function e.g. foo( x ) or foo( x, y )
|
||||||
else if (Token::Match(tok, "%var% ( %var% [,)]")) {
|
else if (Token::Match(tok, "%var% ( %var% [,)]") && tok->strAt(-1) != ":") {
|
||||||
// We have found old style function, now we need to change it
|
// We have found old style function, now we need to change it
|
||||||
|
|
||||||
// First step: Get list of argument names in parenthesis
|
// First step: Get list of argument names in parenthesis
|
||||||
|
|
|
@ -290,6 +290,7 @@ private:
|
||||||
|
|
||||||
TEST_CASE(simplifyFunctionParameters);
|
TEST_CASE(simplifyFunctionParameters);
|
||||||
TEST_CASE(simplifyFunctionParameters1); // #3721
|
TEST_CASE(simplifyFunctionParameters1); // #3721
|
||||||
|
TEST_CASE(simplifyFunctionParameters2); // #4430
|
||||||
TEST_CASE(simplifyFunctionParametersErrors);
|
TEST_CASE(simplifyFunctionParametersErrors);
|
||||||
|
|
||||||
TEST_CASE(removeParentheses1); // Ticket #61
|
TEST_CASE(removeParentheses1); // Ticket #61
|
||||||
|
@ -4685,6 +4686,16 @@ private:
|
||||||
"}", tokenizeAndStringify(code));
|
"}", tokenizeAndStringify(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void simplifyFunctionParameters2() { // #4430
|
||||||
|
const char code[] = "class Item { "
|
||||||
|
"int i ; "
|
||||||
|
"public: "
|
||||||
|
"Item ( int i ) ; "
|
||||||
|
"} ; "
|
||||||
|
"Item :: Item ( int i ) : i ( i ) { }";
|
||||||
|
ASSERT_EQUALS(code, tokenizeAndStringify(code));
|
||||||
|
}
|
||||||
|
|
||||||
void simplifyFunctionParametersErrors() {
|
void simplifyFunctionParametersErrors() {
|
||||||
//same parameters...
|
//same parameters...
|
||||||
tokenizeAndStringify("void foo(x, x)\n"
|
tokenizeAndStringify("void foo(x, x)\n"
|
||||||
|
|
Loading…
Reference in New Issue