diff options
| author | Greg Clayton <gclayton@apple.com> | 2015-09-17 22:23:34 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2015-09-17 22:23:34 +0000 |
| commit | 56939cb31061d24ae3d1fc62da38b57e78bb2556 (patch) | |
| tree | aa2b9fa60158abf0548d6b0f51ec5d2e1adf47d1 /lldb/source/DataFormatters | |
| parent | 6a51dbdb3c163bea935462519f663df3dda34070 (diff) | |
| download | bcm5719-llvm-56939cb31061d24ae3d1fc62da38b57e78bb2556.tar.gz bcm5719-llvm-56939cb31061d24ae3d1fc62da38b57e78bb2556.zip | |
TypeSystem is now a plugin interface and removed any "ClangASTContext &Class::GetClangASTContext()" functions.
This cleans up type systems to be more pluggable. Prior to this we had issues:
- Module, SymbolFile, and many others has "ClangASTContext &GetClangASTContext()" functions. All have been switched over to use "TypeSystem *GetTypeSystemForLanguage()"
- Cleaned up any places that were using the GetClangASTContext() functions to use TypeSystem
- Cleaned up Module so that it no longer has dedicated type system member variables:
lldb::ClangASTContextUP m_ast; ///< The Clang AST context for this module.
lldb::GoASTContextUP m_go_ast; ///< The Go AST context for this module.
Now we have a type system map:
typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> TypeSystemMap;
TypeSystemMap m_type_system_map; ///< A map of any type systems associated with this module
- Many places in code were using ClangASTContext static functions to place with CompilerType objects and add modifiers (const, volatile, restrict) and to make typedefs, L and R value references and more. These have been made into CompilerType functions that are abstract:
class CompilerType
{
...
//----------------------------------------------------------------------
// Return a new CompilerType that is a L value reference to this type if
// this type is valid and the type system supports L value references,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
GetLValueReferenceType () const;
//----------------------------------------------------------------------
// Return a new CompilerType that is a R value reference to this type if
// this type is valid and the type system supports R value references,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
GetRValueReferenceType () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a const modifier to this type if
// this type is valid and the type system supports const modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddConstModifier () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a volatile modifier to this type if
// this type is valid and the type system supports volatile modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddVolatileModifier () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a restrict modifier to this type if
// this type is valid and the type system supports restrict modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddRestrictModifier () const;
//----------------------------------------------------------------------
// Create a typedef to this type using "name" as the name of the typedef
// this type is valid and the type system supports typedefs, else return
// an invalid type.
//----------------------------------------------------------------------
CompilerType
CreateTypedef (const char *name, const CompilerDeclContext &decl_ctx) const;
};
Other changes include:
- Removed "CompilerType TypeSystem::GetIntTypeFromBitSize(...)" and CompilerType TypeSystem::GetFloatTypeFromBitSize(...) and replaced it with "CompilerType TypeSystem::GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size);"
- Fixed code in Type.h to not request the full type for a type for no good reason, just request the forward type and let the type expand as needed
llvm-svn: 247953
Diffstat (limited to 'lldb/source/DataFormatters')
| -rw-r--r-- | lldb/source/DataFormatters/FormatManager.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/DataFormatters/VectorType.cpp | 26 |
2 files changed, 14 insertions, 14 deletions
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index f0ddae2f320..7c241e196d8 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -229,7 +229,7 @@ FormatManager::GetPossibleMatches (ValueObject& valobj, if (non_ref_type.IsTypedefType()) { CompilerType deffed_referenced_type = non_ref_type.GetTypedefedType(); - deffed_referenced_type = is_rvalue_ref ? ClangASTContext::GetRValueReferenceType(deffed_referenced_type) : ClangASTContext::GetLValueReferenceType(deffed_referenced_type); + deffed_referenced_type = is_rvalue_ref ? deffed_referenced_type.GetRValueReferenceType() : deffed_referenced_type.GetLValueReferenceType(); GetPossibleMatches(valobj, deffed_referenced_type, reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs, diff --git a/lldb/source/DataFormatters/VectorType.cpp b/lldb/source/DataFormatters/VectorType.cpp index 56ca3ceac2a..1b62d81de02 100644 --- a/lldb/source/DataFormatters/VectorType.cpp +++ b/lldb/source/DataFormatters/VectorType.cpp @@ -31,7 +31,7 @@ GetCompilerTypeForFormat (lldb::Format format, { case lldb::eFormatAddressInfo: case lldb::eFormatPointer: - return type_system->GetIntTypeFromBitSize(8*type_system->GetPointerByteSize(), false); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 8*type_system->GetPointerByteSize()); case lldb::eFormatBoolean: return type_system->GetBasicTypeFromAST(lldb::eBasicTypeBool); @@ -70,37 +70,37 @@ GetCompilerTypeForFormat (lldb::Format format, return type_system->GetBasicTypeFromAST(lldb::eBasicTypeChar); case lldb::eFormatVectorOfFloat32: - return type_system->GetFloatTypeFromBitSize(32); + return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingIEEE754, 32); case lldb::eFormatVectorOfFloat64: - return type_system->GetFloatTypeFromBitSize(64); + return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingIEEE754, 64); case lldb::eFormatVectorOfSInt16: - return type_system->GetIntTypeFromBitSize(16, true); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingSint, 16); case lldb::eFormatVectorOfSInt32: - return type_system->GetIntTypeFromBitSize(32, true); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingSint, 32); case lldb::eFormatVectorOfSInt64: - return type_system->GetIntTypeFromBitSize(64, true); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingSint, 64); case lldb::eFormatVectorOfSInt8: - return type_system->GetIntTypeFromBitSize(8, true); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingSint, 8); case lldb::eFormatVectorOfUInt128: - return type_system->GetIntTypeFromBitSize(128, false); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 128); case lldb::eFormatVectorOfUInt16: - return type_system->GetIntTypeFromBitSize(16, false); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 16); case lldb::eFormatVectorOfUInt32: - return type_system->GetIntTypeFromBitSize(32, false); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 32); case lldb::eFormatVectorOfUInt64: - return type_system->GetIntTypeFromBitSize(64, false); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 64); case lldb::eFormatVectorOfUInt8: - return type_system->GetIntTypeFromBitSize(8, false); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 8); case lldb::eFormatDefault: return element_type; @@ -113,7 +113,7 @@ GetCompilerTypeForFormat (lldb::Format format, case lldb::eFormatOSType: case lldb::eFormatVoid: default: - return type_system->GetIntTypeFromBitSize(8, false); + return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 8); } } |

