Tokenizer::setVarIdNew: Better handling of function calls
This commit is contained in:
parent
31f8a71f84
commit
46bfe27831
|
@ -2903,8 +2903,8 @@ void Tokenizer::setVarIdNew()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok == _tokens || Token::Match(tok, "[;{},]") ||
|
if (tok == _tokens || Token::Match(tok, "[;{}]") ||
|
||||||
(tok->str()=="(" && (!executableScope.top() || Token::simpleMatch(tok->link(), ") {")))) {
|
(Token::Match(tok,"[(,]") && (!executableScope.top() || Token::simpleMatch(tok->link(), ") {")))) {
|
||||||
// locate the variable name..
|
// locate the variable name..
|
||||||
const Token *tok2 = (tok->isName()) ? tok : tok->next();
|
const Token *tok2 = (tok->isName()) ? tok : tok->next();
|
||||||
if (!tok2)
|
if (!tok2)
|
||||||
|
|
|
@ -3289,7 +3289,7 @@ private:
|
||||||
"2: x ( a * b");
|
"2: x ( a * b");
|
||||||
const std::string expected2(" , 10 ) ;\n"
|
const std::string expected2(" , 10 ) ;\n"
|
||||||
"3: }\n");
|
"3: }\n");
|
||||||
ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code));
|
ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code,false,"test.c"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void varidFunctionCall3() {
|
void varidFunctionCall3() {
|
||||||
|
@ -3313,11 +3313,11 @@ private:
|
||||||
const std::string code1("void f() { int x; fun(a,b*x); }");
|
const std::string code1("void f() { int x; fun(a,b*x); }");
|
||||||
ASSERT_EQUALS("\n\n##file 0\n"
|
ASSERT_EQUALS("\n\n##file 0\n"
|
||||||
"1: void f ( ) { int x@1 ; fun ( a , b * x@1 ) ; }\n",
|
"1: void f ( ) { int x@1 ; fun ( a , b * x@1 ) ; }\n",
|
||||||
tokenizeDebugListing(code1));
|
tokenizeDebugListing(code1,false,"test.c"));
|
||||||
const std::string code2("void f(int a) { int x; fun(a,b*x); }");
|
const std::string code2("void f(int a) { int x; fun(a,b*x); }");
|
||||||
ASSERT_EQUALS("\n\n##file 0\n"
|
ASSERT_EQUALS("\n\n##file 0\n"
|
||||||
"1: void f ( int a@1 ) { int x@2 ; fun ( a@1 , b * x@2 ) ; }\n",
|
"1: void f ( int a@1 ) { int x@2 ; fun ( a@1 , b * x@2 ) ; }\n",
|
||||||
tokenizeDebugListing(code2));
|
tokenizeDebugListing(code2,false,"test.c"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue