Improve debug printing of type qualification when declaration and definition are in different scopes. (#1394)

This commit is contained in:
IOBYTE 2018-09-24 00:40:20 -04:00 committed by Daniel Marjamäki
parent 5bebeec224
commit 01f9ce2c4a
1 changed files with 8 additions and 3 deletions

View File

@ -2864,7 +2864,12 @@ void SymbolDatabase::printOut(const char *title) const
std::cout << " name: " << type->name() << std::endl;
std::cout << " classDef: " << tokenToString(type->classDef, mTokenizer) << std::endl;
std::cout << " classScope: " << type->classScope << std::endl;
std::cout << " enclosingScope: " << type->enclosingScope << std::endl;
std::cout << " enclosingScope: " << type->enclosingScope;
if (type->enclosingScope) {
std::cout << " " << type->enclosingScope->type << " "
<< type->enclosingScope->className;
}
std::cout << std::endl;
std::cout << " needInitialization: " << (type->needInitialization == Type::Unknown ? "Unknown" :
type->needInitialization == Type::True ? "True" :
type->needInitialization == Type::False ? "False" :
@ -5654,11 +5659,11 @@ std::string ValueType::str() const
ret += " long double";
else if ((type == ValueType::Type::NONSTD || type == ValueType::Type::RECORD) && typeScope) {
std::string className(typeScope->className);
const Scope *scope = typeScope->nestedIn;
const Scope *scope = typeScope->definedType ? typeScope->definedType->enclosingScope : typeScope->nestedIn;
while (scope && scope->type != Scope::eGlobal) {
if (scope->type == Scope::eClass || scope->type == Scope::eStruct || scope->type == Scope::eNamespace)
className = scope->className + "::" + className;
scope = scope->nestedIn;
scope = scope->definedType ? scope->definedType->enclosingScope : scope->nestedIn;
}
ret += ' ' + className;
} else if (type == ValueType::Type::CONTAINER && container) {