summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2015-09-23 02:04:34 +0000
committerEnrico Granata <egranata@apple.com>2015-09-23 02:04:34 +0000
commit9c63f99a130761e24eb5fe8df5c6cd561edadf06 (patch)
tree668bd02a3f0d52b690847ad5a221afffb61cccb5 /lldb/source
parent2aacc0eccad6e0fee98ad28d9c885791926cf004 (diff)
downloadbcm5719-llvm-9c63f99a130761e24eb5fe8df5c6cd561edadf06.tar.gz
bcm5719-llvm-9c63f99a130761e24eb5fe8df5c6cd561edadf06.zip
Allow CompilerType to express a vote on whether oneliner printing should happen
llvm-svn: 248363
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/DataFormatters/FormatManager.cpp17
-rw-r--r--lldb/source/Symbol/CompilerType.cpp8
-rw-r--r--lldb/source/Symbol/TypeSystem.cpp6
3 files changed, 31 insertions, 0 deletions
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 6d45a89f8d3..03368f2acd9 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -558,6 +558,23 @@ FormatManager::ShouldPrintAsOneLiner (ValueObject& valobj)
if (valobj.GetNumChildren() == 0)
return false;
+ // ask the type if it has any opinion about this
+ // eLazyBoolCalculate == no opinion; other values should be self explanatory
+ CompilerType compiler_type(valobj.GetCompilerType());
+ if (compiler_type.IsValid())
+ {
+ switch (compiler_type.ShouldPrintAsOneLiner())
+ {
+ case eLazyBoolNo:
+ return false;
+ case eLazyBoolYes:
+ return true;
+ case eLazyBoolCalculate:
+ default:
+ break;
+ }
+ }
+
size_t total_children_name_len = 0;
for (size_t idx = 0;
diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp
index 3a459b01ca6..30f46876ab6 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -859,6 +859,14 @@ CompilerType::GetTypeForFormatters () const
return CompilerType();
}
+LazyBool
+CompilerType::ShouldPrintAsOneLiner () const
+{
+ if (IsValid())
+ return m_type_system->ShouldPrintAsOneLiner(m_type);
+ return eLazyBoolCalculate;
+}
+
// Get the index of the child of "clang_type" whose name matches. This function
// doesn't descend into the children, but only looks one level deep and name
// matches can include base class names.
diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp
index 4f25fc9ad24..84c243cd066 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -85,3 +85,9 @@ TypeSystem::GetTypeForFormatters (void* type)
{
return CompilerType(this, type);
}
+
+LazyBool
+TypeSystem::ShouldPrintAsOneLiner (void* type)
+{
+ return eLazyBoolCalculate;
+}
OpenPOWER on IntegriCloud