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

Method argumentType

lib/checkio.cpp:1970–2018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1968}
1969
1970void CheckIOImpl::argumentType(std::ostream& os, const ArgumentInfo * argInfo)
1971{
1972 if (argInfo) {
1973 os << "\'";
1974 const Token *type = argInfo->typeToken;
1975 if (type->tokType() == Token::eString) {
1976 if (type->isLong())
1977 os << "const wchar_t *";
1978 else
1979 os << "const char *";
1980 } else {
1981 if (type->originalName().empty()) {
1982 if (type->strAt(-1) == "const")
1983 os << "const ";
1984 while (Token::Match(type, "const|struct")) {
1985 os << type->str() << " ";
1986 type = type->next();
1987 }
1988 while (Token::Match(type, "%any% ::")) {
1989 os << type->str() << "::";
1990 type = type->tokAt(2);
1991 }
1992 os << type->stringify(false, true, false);
1993 if (type->strAt(1) == "*" && !argInfo->element)
1994 os << " *";
1995 else if (argInfo->variableInfo && !argInfo->element && argInfo->variableInfo->isArray())
1996 os << " *";
1997 else if (type->strAt(1) == "*" && argInfo->variableInfo && argInfo->element && argInfo->variableInfo->isArray())
1998 os << " *";
1999 if (argInfo->address)
2000 os << " *";
2001 } else {
2002 if (type->isUnsigned()) {
2003 if (type->originalName() == "__int64" || type->originalName() == "__int32" || type->originalName() == "ptrdiff_t")
2004 os << "unsigned ";
2005 }
2006 os << type->originalName();
2007 if (type->strAt(1) == "*" || argInfo->address)
2008 os << " *";
2009 os << " {aka " << type->stringify(false, true, false);
2010 if (type->strAt(1) == "*" || argInfo->address)
2011 os << " *";
2012 os << "}";
2013 }
2014 }
2015 os << "\'";
2016 } else
2017 os << "Unknown";
2018}
2019
2020void CheckIOImpl::invalidLengthModifierError(const Token* tok, nonneg int numFormat, const std::string& modifier)
2021{

Callers 1

ArgumentInfoMethod · 0.45

Calls 7

nextMethod · 0.80
isArrayMethod · 0.80
isUnsignedMethod · 0.80
emptyMethod · 0.45
strMethod · 0.45
tokAtMethod · 0.45
stringifyMethod · 0.45

Tested by

no test coverage detected