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

Function isMacroUsage

lib/checkstring.cpp:249–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249static bool isMacroUsage(const Token* tok)
250{
251 if (const Token* parent = tok->astParent()) {
252 while (parent && (parent->isCast() || parent->str() == "&&")) {
253 if (parent->isExpandedMacro())
254 return true;
255 parent = parent->astParent();
256 }
257 if (!parent)
258 return false;
259 if (parent->isExpandedMacro())
260 return true;
261 if (parent->isUnaryOp("!") || parent->isComparisonOp()) {
262 int argn{};
263 const Token* ftok = getTokenArgumentFunction(parent, argn);
264 if (ftok && !ftok->function())
265 return true;
266 }
267 }
268 return false;
269}
270
271//---------------------------------------------------------------------------
272// Implicit casts of string literals to bool

Callers 1

Calls 6

getTokenArgumentFunctionFunction · 0.85
astParentMethod · 0.80
isCastMethod · 0.80
isUnaryOpMethod · 0.80
strMethod · 0.45
functionMethod · 0.45

Tested by

no test coverage detected