From 01f9ce2c4afebfa56dbf2e21f35ae9cf8e1b6063 Mon Sep 17 00:00:00 2001 From: IOBYTE Date: Mon, 24 Sep 2018 00:40:20 -0400 Subject: [PATCH] Improve debug printing of type qualification when declaration and definition are in different scopes. (#1394) --- lib/symboldatabase.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index d2fbcd808..ef825309f 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -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) {