Merge pull request #263 from trulabs/master
Fix the detection of methods called from Qt's invokeMethod
This commit is contained in:
commit
401b43c36a
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
<!-- qt can call methods as strings using invokeMethod -->
|
<!-- qt can call methods as strings using invokeMethod -->
|
||||||
<reflection>
|
<reflection>
|
||||||
<call arg="4">invokeMethod</call>
|
<call arg="2">invokeMethod</call>
|
||||||
</reflection>
|
</reflection>
|
||||||
|
|
||||||
<!-- the SLOT/SIGNAL methods can be cause false-positives for pure
|
<!-- the SLOT/SIGNAL methods can be cause false-positives for pure
|
||||||
|
|
|
@ -170,9 +170,19 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
|
||||||
if (settings->library.isreflection(tok->str())) {
|
if (settings->library.isreflection(tok->str())) {
|
||||||
const int index = settings->library.reflectionArgument(tok->str());
|
const int index = settings->library.reflectionArgument(tok->str());
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
const Token * funcToken = tok->tokAt(index);
|
const Token * funcToken = tok->next();
|
||||||
if (funcToken) {
|
int p = 0;
|
||||||
std::string value = funcToken->str();
|
std::string value;
|
||||||
|
while(funcToken) {
|
||||||
|
if (funcToken->str()==",") {
|
||||||
|
if (++p==index)
|
||||||
|
break;
|
||||||
|
value = "";
|
||||||
|
} else
|
||||||
|
value += funcToken->str();
|
||||||
|
funcToken = funcToken->next();
|
||||||
|
}
|
||||||
|
if (p==index) {
|
||||||
value = value.substr(1, value.length() - 2);
|
value = value.substr(1, value.length() - 2);
|
||||||
_functions[value].usedOtherFile = true;
|
_functions[value].usedOtherFile = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue