summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-09-17 22:23:34 +0000
committerGreg Clayton <gclayton@apple.com>2015-09-17 22:23:34 +0000
commit56939cb31061d24ae3d1fc62da38b57e78bb2556 (patch)
treeaa2b9fa60158abf0548d6b0f51ec5d2e1adf47d1 /lldb/source/Plugins
parent6a51dbdb3c163bea935462519f663df3dda34070 (diff)
downloadbcm5719-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/Plugins')
-rw-r--r--lldb/source/Plugins/Language/ObjC/Cocoa.cpp2
-rw-r--r--lldb/source/Plugins/Language/ObjC/CoreMedia.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp19
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp3
-rw-r--r--lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp8
-rw-r--r--lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h3
-rw-r--r--lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp2
9 files changed, 8 insertions, 38 deletions
diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
index 891f1d94b30..e808393b444 100644
--- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -763,7 +763,7 @@ GetNSPathStore2Type (Target &target)
return CompilerType();
CompilerType voidstar = ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType();
- CompilerType uint32 = ast_ctx->GetIntTypeFromBitSize(32, false);
+ CompilerType uint32 = ast_ctx->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 32);
return ast_ctx->GetOrCreateStructForIdentifier(g_type_name, {
{"isa",voidstar},
diff --git a/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp b/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp
index 14123af27ca..af7b0cef393 100644
--- a/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp
+++ b/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp
@@ -30,8 +30,8 @@ lldb_private::formatters::CMTimeSummaryProvider (ValueObject& valobj, Stream& st
return false;
// fetch children by offset to compensate for potential lack of debug info
- auto int64_ty = type_system->GetIntTypeFromBitSize(64, true);
- auto int32_ty = type_system->GetIntTypeFromBitSize(32, true);
+ auto int64_ty = type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 64);
+ auto int32_ty = type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 32);
auto value_sp(valobj.GetSyntheticChildAtOffset(0, int64_ty, true));
auto timescale_sp(valobj.GetSyntheticChildAtOffset(8, int32_ty, true));
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
index e0dc042ca97..bb1798cda52 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
@@ -177,7 +177,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(const lldb_private::SymbolContext &sc, cons
return type->shared_from_this();
}
impl = type->GetForwardCompilerType();
- clang_type = m_ast.CreateTypedef(go_kind, type_name_const_str, impl);
+ clang_type = m_ast.CreateTypedefType (go_kind, type_name_const_str, impl);
}
break;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index b654f2690da..66117ae332b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -495,15 +495,6 @@ SymbolFileDWARF::GetUniqueDWARFASTTypeMap ()
return m_unique_ast_type_map;
}
-ClangASTContext &
-SymbolFileDWARF::GetClangASTContext ()
-{
- if (GetDebugMapSymfile ())
- return m_debug_map_symfile->GetClangASTContext ();
- else
- return m_obj_file->GetModule()->GetClangASTContext();
-}
-
TypeSystem *
SymbolFileDWARF::GetTypeSystemForLanguage (LanguageType language)
{
@@ -575,12 +566,6 @@ SymbolFileDWARF::InitializeObject()
else
m_apple_objc_ap.reset();
}
-
- // Set the symbol file to this file if we don't have a debug map symbol
- // file as our main symbol file. This allows the clang ASTContext to complete
- // types using this symbol file when it needs to complete classes and structures.
- if (GetDebugMapSymfile () == nullptr)
- GetClangASTContext().SetSymbolFile(this);
}
bool
@@ -2098,7 +2083,9 @@ SymbolFileDWARF::DeclContextMatchesThisSymbolFile (const lldb_private::CompilerD
return true;
}
- if ((TypeSystem *)&GetClangASTContext() == decl_ctx->GetTypeSystem())
+ TypeSystem *decl_ctx_type_system = decl_ctx->GetTypeSystem();
+ TypeSystem *type_system = GetTypeSystemForLanguage(decl_ctx_type_system->GetMinimumLanguage(nullptr));
+ if (decl_ctx_type_system == type_system)
return true; // The type systems match, return true
// The namespace AST was valid, and it does not match...
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 3530e35afd3..39bb368e231 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -221,9 +221,6 @@ public:
uint32_t type_mask,
lldb_private::TypeList &type_list) override;
- lldb_private::ClangASTContext &
- GetClangASTContext () override;
-
lldb_private::TypeSystem *
GetTypeSystemForLanguage (lldb::LanguageType language) override;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 0bdfd853def..6d33d6cb4f5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -297,9 +297,6 @@ SymbolFileDWARFDebugMap::~SymbolFileDWARFDebugMap()
void
SymbolFileDWARFDebugMap::InitializeObject()
{
- // Set the symbol file to this file. This allows the clang ASTContext to complete
- // types using this symbol file when it needs to complete classes and structures.
- GetClangASTContext().SetSymbolFile(this);
}
void
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index edbe7379a86..9d7b6399d9c 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -79,14 +79,6 @@ SymbolFileSymtab::~SymbolFileSymtab()
{
}
-ClangASTContext &
-SymbolFileSymtab::GetClangASTContext ()
-{
- ClangASTContext &ast = m_obj_file->GetModule()->GetClangASTContext();
-
- return ast;
-}
-
uint32_t
SymbolFileSymtab::CalculateAbilities ()
{
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
index 624bf40914e..f130cdb07f3 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -110,9 +110,6 @@ protected:
lldb_private::Symtab::IndexCollection m_data_indexes;
lldb_private::Symtab::NameToIndexMap m_objc_class_name_to_index;
TypeMap m_objc_class_types;
-
- lldb_private::ClangASTContext &
- GetClangASTContext ();
private:
DISALLOW_COPY_AND_ASSIGN (SymbolFileSymtab);
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
index 11b47df87d0..2e0466cc1bc 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
@@ -444,7 +444,7 @@ SystemRuntimeMacOSX::ReadLibdispatchTSDIndexes ()
ClangASTContext *ast_ctx = m_process->GetTarget().GetScratchClangASTContext();
if (ast_ctx->getASTContext() && m_dispatch_tsd_indexes_addr != LLDB_INVALID_ADDRESS)
{
- CompilerType uint16 = ast_ctx->GetIntTypeFromBitSize(16, false);
+ CompilerType uint16 = ast_ctx->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 16);
CompilerType dispatch_tsd_indexes_s = ast_ctx->CreateRecordType(nullptr, lldb::eAccessPublic, "__lldb_dispatch_tsd_indexes_s", clang::TTK_Struct, lldb::eLanguageTypeC);
ClangASTContext::StartTagDeclarationDefinition(dispatch_tsd_indexes_s);
OpenPOWER on IntegriCloud