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

Function astFlattenCopy

lib/astutils.cpp:110–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110template<class T, class OuputIterator, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )>
111static void astFlattenCopy(T* tok, const char* op, OuputIterator out, int depth = 100)
112{
113 --depth;
114 if (!tok || depth < 0)
115 return;
116 if (strcmp(tok->str().c_str(), op) == 0) {
117 astFlattenCopy(tok->astOperand1(), op, out, depth);
118 astFlattenCopy(tok->astOperand2(), op, out, depth);
119 } else {
120 *out = tok;
121 ++out;
122 }
123}
124
125std::vector<const Token*> astFlatten(const Token* tok, const char* op)
126{

Callers 1

astFlattenFunction · 0.85

Calls 3

astOperand1Method · 0.80
astOperand2Method · 0.80
strMethod · 0.45

Tested by

no test coverage detected