MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / findArgumentPosRecursive

Function findArgumentPosRecursive

lib/astutils.cpp:68–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68static int findArgumentPosRecursive(const Token* tok, const Token* tokToFind, bool &found, nonneg int depth=0)
69{
70 ++depth;
71 if (!tok || depth >= 100)
72 return -1;
73 if (tok->str() == ",") {
74 int res = findArgumentPosRecursive(tok->astOperand1(), tokToFind, found, depth);
75 if (res == -1)
76 return -1;
77 if (found)
78 return res;
79 const int argn = res;
80 res = findArgumentPosRecursive(tok->astOperand2(), tokToFind, found, depth);
81 if (res == -1)
82 return -1;
83 return argn + res;
84 }
85 if (tokToFind == tok)
86 found = true;
87 return 1;
88}
89
90static int findArgumentPos(const Token* tok, const Token* tokToFind){
91 bool found = false;

Callers 1

findArgumentPosFunction · 0.85

Calls 3

astOperand1Method · 0.80
astOperand2Method · 0.80
strMethod · 0.45

Tested by

no test coverage detected