Unused function check: Fix detection of func.usedOtherFile
Check if function is called from another file or not.
This commit is contained in:
parent
fd9134fe5b
commit
4bec2b58fd
|
@ -196,8 +196,9 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
|
||||||
|
|
||||||
if (funcname) {
|
if (funcname) {
|
||||||
FunctionUsage &func = _functions[ funcname->str()];
|
FunctionUsage &func = _functions[ funcname->str()];
|
||||||
|
const std::string called_from_file = tokenizer.list.getSourceFilePath();
|
||||||
|
|
||||||
if (func.filename.empty() || func.filename == "+")
|
if (func.filename.empty() || func.filename == "+" || func.filename != called_from_file)
|
||||||
func.usedOtherFile = true;
|
func.usedOtherFile = true;
|
||||||
else
|
else
|
||||||
func.usedSameFile = true;
|
func.usedSameFile = true;
|
||||||
|
|
Loading…
Reference in New Issue