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

Method str

lib/symboldatabase.cpp:8665–8731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8663}
8664
8665std::string ValueType::str() const
8666{
8667 std::string ret;
8668 if (constness & 1)
8669 ret = " const";
8670 if (volatileness & 1)
8671 ret = " volatile";
8672 if (type == VOID)
8673 ret += " void";
8674 else if (isIntegral()) {
8675 if (sign == SIGNED)
8676 ret += " signed";
8677 else if (sign == UNSIGNED)
8678 ret += " unsigned";
8679 if (type == BOOL)
8680 ret += " bool";
8681 else if (type == CHAR)
8682 ret += " char";
8683 else if (type == SHORT)
8684 ret += " short";
8685 else if (type == WCHAR_T)
8686 ret += " wchar_t";
8687 else if (type == INT)
8688 ret += " int";
8689 else if (type == LONG)
8690 ret += " long";
8691 else if (type == LONGLONG)
8692 ret += " long long";
8693 else if (type == UNKNOWN_INT)
8694 ret += " unknown_int";
8695 } else if (type == FLOAT)
8696 ret += " float";
8697 else if (type == DOUBLE)
8698 ret += " double";
8699 else if (type == LONGDOUBLE)
8700 ret += " long double";
8701 else if ((type == ValueType::Type::NONSTD || type == ValueType::Type::RECORD) && typeScope) {
8702 std::string className(typeScope->className);
8703 const Scope *scope = typeScope->definedType ? typeScope->definedType->enclosingScope : typeScope->nestedIn;
8704 while (scope && scope->type != ScopeType::eGlobal) {
8705 if (scope->type == ScopeType::eClass || scope->type == ScopeType::eStruct || scope->type == ScopeType::eNamespace)
8706 className = scope->className + "::" + className;
8707 scope = (scope->definedType && scope->definedType->enclosingScope) ? scope->definedType->enclosingScope : scope->nestedIn;
8708 }
8709 ret += ' ' + className;
8710 } else if (type == ValueType::Type::CONTAINER && container) {
8711 ret += " container(" + container->startPattern + ')';
8712 } else if (type == ValueType::Type::ITERATOR && container) {
8713 ret += " iterator(" + container->startPattern + ')';
8714 } else if (type == ValueType::Type::SMART_POINTER && smartPointer) {
8715 ret += " smart-pointer(" + smartPointer->name + ")";
8716 }
8717 for (unsigned int p = 0; p < pointer; p++) {
8718 ret += " *";
8719 if (constness & (2 << p))
8720 ret += " const";
8721 if (volatileness & (2 << p))
8722 ret += " volatile";

Calls 2

isIntegralFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected