forked from OSchip/llvm-project
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
This commit is contained in:
parent
8d0e3011d8
commit
c6bf2e2d1d
|
@ -904,6 +904,9 @@ public:
|
|||
size_t idx,
|
||||
lldb::TemplateArgumentKind &kind) override;
|
||||
|
||||
CompilerType
|
||||
GetTypeForFormatters (void* type) override;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Modifying RecordType
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -456,6 +456,9 @@ public:
|
|||
GetTemplateArgument (size_t idx,
|
||||
lldb::TemplateArgumentKind &kind) const;
|
||||
|
||||
CompilerType
|
||||
GetTypeForFormatters () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Pointers & References
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -80,3 +80,8 @@ TypeSystem::GetBuiltinTypeByName (const ConstString &name)
|
|||
return CompilerType();
|
||||
}
|
||||
|
||||
CompilerType
|
||||
TypeSystem::GetTypeForFormatters (void* type)
|
||||
{
|
||||
return CompilerType(this, type);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue