summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2015-09-23 01:39:46 +0000
committerEnrico Granata <egranata@apple.com>2015-09-23 01:39:46 +0000
commitc6bf2e2d1d07538c6e6592ca629cf321f0c619a5 (patch)
tree396043590ab37f4be42a637dd267feceb9412073
parent8d0e3011d8c85c9ad5e1a9fbe61057b0125057b7 (diff)
downloadbcm5719-llvm-c6bf2e2d1d07538c6e6592ca629cf321f0c619a5.tar.gz
bcm5719-llvm-c6bf2e2d1d07538c6e6592ca629cf321f0c619a5.zip
Add {TypeSystem|CompilerType}::GetTypeForFormatters()
Different type system may have different notions of attributes of a type that do not matter for data formatters matching purposes For instance, in the case of clang types, we remove some qualifiers (e.g. "volatile") as it doesn't make much sense to differentiate volatile T from T in the data formatters This new API allows each type system to generate, if needed, a type that does not have those unwanted attributes that the data formatters can then consume to generate matches llvm-svn: 248359
-rw-r--r--lldb/include/lldb/Symbol/ClangASTContext.h3
-rw-r--r--lldb/include/lldb/Symbol/CompilerType.h3
-rw-r--r--lldb/include/lldb/Symbol/TypeSystem.h3
-rw-r--r--lldb/source/DataFormatters/FormatManager.cpp2
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp8
-rw-r--r--lldb/source/Symbol/CompilerType.cpp7
-rw-r--r--lldb/source/Symbol/TypeSystem.cpp5
7 files changed, 30 insertions, 1 deletions
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h
index 7c21ded048c..918c8b26e46 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -904,6 +904,9 @@ public:
size_t idx,
lldb::TemplateArgumentKind &kind) override;
+ CompilerType
+ GetTypeForFormatters (void* type) override;
+
//----------------------------------------------------------------------
// Modifying RecordType
//----------------------------------------------------------------------
diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h
index 13e86b22d9a..536893759a5 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -456,6 +456,9 @@ public:
GetTemplateArgument (size_t idx,
lldb::TemplateArgumentKind &kind) const;
+ CompilerType
+ GetTypeForFormatters () const;
+
//------------------------------------------------------------------
// Pointers & References
//------------------------------------------------------------------
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h
index 4cc475a571a..b9318359f95 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -504,6 +504,9 @@ public:
return nullptr;
}
+ virtual CompilerType
+ GetTypeForFormatters (void* type);
+
protected:
const LLVMCastKind m_kind; // Support for llvm casting
SymbolFile *m_sym_file;
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 7c241e196d8..6d45a89f8d3 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -199,7 +199,7 @@ FormatManager::GetPossibleMatches (ValueObject& valobj,
bool did_strip_typedef,
bool root_level)
{
- compiler_type = ClangASTContext::RemoveFastQualifiers(compiler_type);
+ compiler_type = compiler_type.GetTypeForFormatters();
ConstString type_name(compiler_type.GetConstTypeName());
if (valobj.GetBitfieldBitSize() > 0)
{
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index d28cd20e70a..b07d502afe7 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -6801,6 +6801,14 @@ ClangASTContext::GetTemplateArgument (lldb::opaque_compiler_type_t type, size_t
return CompilerType ();
}
+CompilerType
+ClangASTContext::GetTypeForFormatters (void* type)
+{
+ if (type)
+ return RemoveFastQualifiers(CompilerType(this, type));
+ return CompilerType();
+}
+
static bool
IsOperator (const char *name, clang::OverloadedOperatorKind &op_kind)
{
diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp
index b10f5f5af6d..3a459b01ca6 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -851,6 +851,13 @@ CompilerType::GetTemplateArgument (size_t idx,
return CompilerType();
}
+CompilerType
+CompilerType::GetTypeForFormatters () const
+{
+ if (IsValid())
+ return m_type_system->GetTypeForFormatters(m_type);
+ return CompilerType();
+}
// 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
diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp
index 06e98dcff36..4f25fc9ad24 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -80,3 +80,8 @@ TypeSystem::GetBuiltinTypeByName (const ConstString &name)
return CompilerType();
}
+CompilerType
+TypeSystem::GetTypeForFormatters (void* type)
+{
+ return CompilerType(this, type);
+}
OpenPOWER on IntegriCloud