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