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

Method getParentFunction

lib/reverseanalyzer.cpp:71–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69 }
70
71 static Token* getParentFunction(Token* tok)
72 {
73 if (!tok)
74 return nullptr;
75 if (!tok->astParent())
76 return nullptr;
77 int argn = -1;
78 if (Token* ftok = getTokenArgumentFunction(tok, argn)) {
79 while (!Token::Match(ftok, "(|{")) {
80 if (!ftok)
81 return nullptr;
82 if (ftok->index() >= tok->index())
83 return nullptr;
84 if (!ftok->link() || ftok->str() == ")")
85 ftok = ftok->next();
86 else
87 ftok = ftok->link()->next();
88 }
89 if (ftok == tok)
90 return nullptr;
91 return ftok;
92 }
93 return nullptr;
94 }
95
96 static Token* getTopFunction(Token* tok)
97 {

Callers

nothing calls this directly

Calls 4

getTokenArgumentFunctionFunction · 0.85
astParentMethod · 0.80
nextMethod · 0.80
strMethod · 0.45

Tested by

no test coverage detected