Skip to content
Snippets Groups Projects
Commit 6500061e authored by Enrico Granata's avatar Enrico Granata
Browse files

Extend the TypeSystem's ShouldPrintAsOneLiner implementation so that the...

Extend the TypeSystem's ShouldPrintAsOneLiner implementation so that the ValueObject itself also gets a say in the process; NFC

llvm-svn: 252516
parent 32538d68
No related branches found
No related tags found
No related merge requests found
...@@ -470,7 +470,7 @@ public: ...@@ -470,7 +470,7 @@ public:
GetTypeForFormatters () const; GetTypeForFormatters () const;
LazyBool LazyBool
ShouldPrintAsOneLiner () const; ShouldPrintAsOneLiner (ValueObject* valobj) const;
bool bool
IsMeaninglessWithoutDynamicResolution () const; IsMeaninglessWithoutDynamicResolution () const;
......
...@@ -531,7 +531,7 @@ public: ...@@ -531,7 +531,7 @@ public:
GetTypeForFormatters (void* type); GetTypeForFormatters (void* type);
virtual LazyBool virtual LazyBool
ShouldPrintAsOneLiner (void* type); ShouldPrintAsOneLiner (void* type, ValueObject* valobj);
// Type systems can have types that are placeholder types, which are meant to indicate // Type systems can have types that are placeholder types, which are meant to indicate
// the presence of a type, but offer no actual information about said types, and leave // the presence of a type, but offer no actual information about said types, and leave
......
...@@ -568,7 +568,7 @@ FormatManager::ShouldPrintAsOneLiner (ValueObject& valobj) ...@@ -568,7 +568,7 @@ FormatManager::ShouldPrintAsOneLiner (ValueObject& valobj)
CompilerType compiler_type(valobj.GetCompilerType()); CompilerType compiler_type(valobj.GetCompilerType());
if (compiler_type.IsValid()) if (compiler_type.IsValid())
{ {
switch (compiler_type.ShouldPrintAsOneLiner()) switch (compiler_type.ShouldPrintAsOneLiner(&valobj))
{ {
case eLazyBoolNo: case eLazyBoolNo:
return false; return false;
...@@ -590,6 +590,23 @@ FormatManager::ShouldPrintAsOneLiner (ValueObject& valobj) ...@@ -590,6 +590,23 @@ FormatManager::ShouldPrintAsOneLiner (ValueObject& valobj)
// something is wrong here - bail out // something is wrong here - bail out
if (!child_sp) if (!child_sp)
return false; return false;
// also ask the child's type if it has any opinion
CompilerType child_compiler_type(child_sp->GetCompilerType());
if (child_compiler_type.IsValid())
{
switch (child_compiler_type.ShouldPrintAsOneLiner(child_sp.get()))
{
case eLazyBoolYes:
// an opinion of yes is only binding for the child, so keep going
case eLazyBoolCalculate:
break;
case eLazyBoolNo:
// but if the child says no, then it's a veto on the whole thing
return false;
}
}
// if we decided to define synthetic children for a type, we probably care enough // if we decided to define synthetic children for a type, we probably care enough
// to show them, but avoid nesting children in children // to show them, but avoid nesting children in children
if (child_sp->GetSyntheticChildren().get() != nullptr) if (child_sp->GetSyntheticChildren().get() != nullptr)
......
...@@ -870,10 +870,10 @@ CompilerType::GetTypeForFormatters () const ...@@ -870,10 +870,10 @@ CompilerType::GetTypeForFormatters () const
} }
LazyBool LazyBool
CompilerType::ShouldPrintAsOneLiner () const CompilerType::ShouldPrintAsOneLiner (ValueObject* valobj) const
{ {
if (IsValid()) if (IsValid())
return m_type_system->ShouldPrintAsOneLiner(m_type); return m_type_system->ShouldPrintAsOneLiner(m_type, valobj);
return eLazyBoolCalculate; return eLazyBoolCalculate;
} }
......
...@@ -110,7 +110,7 @@ TypeSystem::GetTypeForFormatters (void* type) ...@@ -110,7 +110,7 @@ TypeSystem::GetTypeForFormatters (void* type)
} }
LazyBool LazyBool
TypeSystem::ShouldPrintAsOneLiner (void* type) TypeSystem::ShouldPrintAsOneLiner (void* type, ValueObject* valobj)
{ {
return eLazyBoolCalculate; return eLazyBoolCalculate;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment