[Lldb-commits] [lldb] r247953 - TypeSystem is now a plugin interface and removed any "ClangASTContext &Class::GetClangASTContext()" functions.
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 17 15:23:36 PDT 2015
Author: gclayton
Date: Thu Sep 17 17:23:34 2015
New Revision: 247953
URL: http://llvm.org/viewvc/llvm-project?rev=247953&view=rev
Log:
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
Modified:
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Core/PluginManager.h
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/CompilerType.h
lldb/trunk/include/lldb/Symbol/GoASTContext.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/include/lldb/lldb-private-interfaces.h
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBType.cpp
lldb/trunk/source/API/SystemInitializerFull.cpp
lldb/trunk/source/Commands/CommandObjectArgs.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
lldb/trunk/source/Core/ValueObjectRegister.cpp
lldb/trunk/source/DataFormatters/FormatManager.cpp
lldb/trunk/source/DataFormatters/VectorType.cpp
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Expression/ClangExpressionParser.cpp
lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerType.cpp
lldb/trunk/source/Symbol/GoASTContext.cpp
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/source/Symbol/Type.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp
lldb/trunk/source/Symbol/Variable.cpp
lldb/trunk/source/Target/ThreadPlanTracer.cpp
Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Thu Sep 17 17:23:34 2015
@@ -944,9 +944,6 @@ public:
bool
GetIsDynamicLinkEditor ();
- ClangASTContext &
- GetClangASTContext ();
-
TypeSystem *
GetTypeSystemForLanguage (lldb::LanguageType language);
@@ -1101,6 +1098,7 @@ public:
bool &match_name_after_lookup);
protected:
+ typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> TypeSystemMap;
//------------------------------------------------------------------
// Member Variables
//------------------------------------------------------------------
@@ -1119,15 +1117,13 @@ protected:
lldb::SymbolVendorUP m_symfile_ap; ///< A pointer to the symbol vendor for this module.
std::vector<lldb::SymbolVendorUP> m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and changes the symbol file,
///< we need to keep all old symbol files around in case anyone has type references to them
- lldb::ClangASTContextUP m_ast; ///< The Clang AST context for this module.
- lldb::GoASTContextUP m_go_ast; ///< The Go AST context for this module.
+ TypeSystemMap m_type_system_map; ///< A map of any type systems associated with this module
PathMappingList m_source_mappings; ///< Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are
lldb::SectionListUP m_sections_ap; ///< Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info
std::atomic<bool> m_did_load_objfile;
std::atomic<bool> m_did_load_symbol_vendor;
std::atomic<bool> m_did_parse_uuid;
- std::atomic<bool> m_did_init_ast;
mutable bool m_file_has_changed:1,
m_first_file_changed_log:1; /// See if the module was modified after it was initially opened.
Modified: lldb/trunk/include/lldb/Core/PluginManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginManager.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/PluginManager.h (original)
+++ lldb/trunk/include/lldb/Core/PluginManager.h Thu Sep 17 17:23:34 2015
@@ -419,6 +419,22 @@ public:
static InstrumentationRuntimeCreateInstance
GetInstrumentationRuntimeCreateCallbackForPluginName (const ConstString &name);
+ //------------------------------------------------------------------
+ // TypeSystem
+ //------------------------------------------------------------------
+ static bool
+ RegisterPlugin (const ConstString &name,
+ const char *description,
+ TypeSystemCreateInstance create_callback);
+
+ static bool
+ UnregisterPlugin (TypeSystemCreateInstance create_callback);
+
+ static TypeSystemCreateInstance
+ GetTypeSystemCreateCallbackAtIndex (uint32_t idx);
+
+ static TypeSystemCreateInstance
+ GetTypeSystemCreateCallbackForPluginName (const ConstString &name);
//------------------------------------------------------------------
// Some plug-ins might register a DebuggerInitializeCallback
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Sep 17 17:23:34 2015
@@ -55,7 +55,28 @@ public:
ClangASTContext (const char *triple = NULL);
~ClangASTContext() override;
-
+
+ //------------------------------------------------------------------
+ // PluginInterface functions
+ //------------------------------------------------------------------
+ ConstString
+ GetPluginName() override;
+
+ uint32_t
+ GetPluginVersion() override;
+
+ static ConstString
+ GetPluginNameStatic ();
+
+ static lldb::TypeSystemSP
+ CreateInstance (lldb::LanguageType language, const lldb_private::ArchSpec &arch);
+
+ static void
+ Initialize ();
+
+ static void
+ Terminate ();
+
static ClangASTContext*
GetASTContext (clang::ASTContext* ast_ctx);
@@ -153,7 +174,7 @@ public:
//------------------------------------------------------------------
CompilerType
GetBuiltinTypeForEncodingAndBitSize (lldb::Encoding encoding,
- uint32_t bit_size);
+ size_t bit_size) override;
static CompilerType
GetBuiltinTypeForEncodingAndBitSize (clang::ASTContext *ast,
@@ -448,13 +469,7 @@ public:
//------------------------------------------------------------------
// Integer type functions
//------------------------------------------------------------------
-
- CompilerType
- GetIntTypeFromBitSize (size_t bit_size, bool is_signed) override
- {
- return GetIntTypeFromBitSize (getASTContext(), bit_size, is_signed);
- }
-
+
static CompilerType
GetIntTypeFromBitSize (clang::ASTContext *ast,
size_t bit_size, bool is_signed);
@@ -471,12 +486,6 @@ public:
//------------------------------------------------------------------
// Floating point functions
//------------------------------------------------------------------
-
- CompilerType
- GetFloatTypeFromBitSize (size_t bit_size) override
- {
- return GetFloatTypeFromBitSize (getASTContext(), bit_size);
- }
static CompilerType
GetFloatTypeFromBitSize (clang::ASTContext *ast,
@@ -673,7 +682,10 @@ public:
bool
IsVoidType (void *type) override;
-
+
+ bool
+ SupportsLanguage (lldb::LanguageType language) override;
+
static bool
GetCXXClassName (const CompilerType& type, std::string &class_name);
@@ -710,15 +722,6 @@ public:
// Creating related types
//----------------------------------------------------------------------
- static CompilerType
- AddConstModifier (const CompilerType& type);
-
- static CompilerType
- AddRestrictModifier (const CompilerType& type);
-
- static CompilerType
- AddVolatileModifier (const CompilerType& type);
-
// Using the current type, create a new typedef to that type using "typedef_name"
// as the name and "decl_ctx" as the decl context.
static CompilerType
@@ -752,9 +755,6 @@ public:
TypeMemberFunctionImpl
GetMemberFunctionAtIndex (void *type, size_t idx) override;
- static CompilerType
- GetLValueReferenceType (const CompilerType& type);
-
CompilerType
GetNonReferenceType (void *type) override;
@@ -763,10 +763,25 @@ public:
CompilerType
GetPointerType (void *type) override;
-
- static CompilerType
- GetRValueReferenceType (const CompilerType& type);
-
+
+ CompilerType
+ GetLValueReferenceType (void *type) override;
+
+ CompilerType
+ GetRValueReferenceType (void *type) override;
+
+ CompilerType
+ AddConstModifier (void *type) override;
+
+ CompilerType
+ AddVolatileModifier (void *type) override;
+
+ CompilerType
+ AddRestrictModifier (void *type) override;
+
+ CompilerType
+ CreateTypedef (void *type, const char *name, const CompilerDeclContext &decl_ctx) override;
+
// If the current object represents a typedef type, get the underlying type
CompilerType
GetTypedefedType (void *type) override;
@@ -804,7 +819,10 @@ public:
uint32_t
GetNumChildren (void *type, bool omit_empty_base_classes) override;
-
+
+ CompilerType
+ GetBuiltinTypeByName (const ConstString &name) override;
+
lldb::BasicType
GetBasicTypeEnumeration (void *type) override;
Modified: lldb/trunk/include/lldb/Symbol/CompilerType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerType.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompilerType.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h Thu Sep 17 17:23:34 2015
@@ -272,15 +272,75 @@ public:
TypeMemberFunctionImpl
GetMemberFunctionAtIndex (size_t idx);
+ //----------------------------------------------------------------------
+ // If this type is a reference to a type (L value or R value reference),
+ // return a new type with the reference removed, else return the current
+ // type itself.
+ //----------------------------------------------------------------------
CompilerType
GetNonReferenceType () const;
+ //----------------------------------------------------------------------
+ // If this type is a pointer type, return the type that the pointer
+ // points to, else return an invalid type.
+ //----------------------------------------------------------------------
CompilerType
GetPointeeType () const;
+ //----------------------------------------------------------------------
+ // Return a new CompilerType that is a pointer to this type
+ //----------------------------------------------------------------------
CompilerType
GetPointerType () const;
+ //----------------------------------------------------------------------
+ // 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;
+
// If the current object represents a typedef type, get the underlying type
CompilerType
GetTypedefedType () const;
Modified: lldb/trunk/include/lldb/Symbol/GoASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/GoASTContext.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/GoASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/GoASTContext.h Thu Sep 17 17:23:34 2015
@@ -27,6 +27,28 @@ class GoASTContext : public TypeSystem
GoASTContext();
~GoASTContext();
+ //------------------------------------------------------------------
+ // PluginInterface functions
+ //------------------------------------------------------------------
+ ConstString
+ GetPluginName() override;
+
+ uint32_t
+ GetPluginVersion() override;
+
+ static ConstString
+ GetPluginNameStatic ();
+
+ static lldb::TypeSystemSP
+ CreateInstance (lldb::LanguageType language, const lldb_private::ArchSpec &arch);
+
+ static void
+ Initialize ();
+
+ static void
+ Terminate ();
+
+
DWARFASTParser *GetDWARFParser() override;
void
@@ -101,7 +123,7 @@ class GoASTContext : public TypeSystem
CompilerType CreateBaseType(int go_kind, const ConstString &type_name_const_str, uint64_t byte_size);
// For interface, map, chan.
- CompilerType CreateTypedef(int kind, const ConstString &name, CompilerType impl);
+ CompilerType CreateTypedefType(int kind, const ConstString &name, CompilerType impl);
CompilerType CreateVoidType(const ConstString &name);
CompilerType CreateFunctionType(const lldb_private::ConstString &name, CompilerType *params, size_t params_count,
@@ -124,37 +146,39 @@ class GoASTContext : public TypeSystem
static bool IsDirectIface(uint8_t kind);
static bool IsPointerKind(uint8_t kind);
- virtual bool IsArrayType(void *type, CompilerType *element_type, uint64_t *size, bool *is_incomplete) override;
+ bool IsArrayType(void *type, CompilerType *element_type, uint64_t *size, bool *is_incomplete) override;
- virtual bool IsAggregateType(void *type) override;
+ bool IsAggregateType(void *type) override;
- virtual bool IsCharType(void *type) override;
+ bool IsCharType(void *type) override;
- virtual bool IsCompleteType(void *type) override;
+ bool IsCompleteType(void *type) override;
- virtual bool IsDefined(void *type) override;
+ bool IsDefined(void *type) override;
- virtual bool IsFloatingPointType(void *type, uint32_t &count, bool &is_complex) override;
+ bool IsFloatingPointType(void *type, uint32_t &count, bool &is_complex) override;
- virtual bool IsFunctionType(void *type, bool *is_variadic_ptr = NULL) override;
+ bool IsFunctionType(void *type, bool *is_variadic_ptr = NULL) override;
- virtual size_t GetNumberOfFunctionArguments(void *type) override;
+ size_t GetNumberOfFunctionArguments(void *type) override;
- virtual CompilerType GetFunctionArgumentAtIndex(void *type, const size_t index) override;
+ CompilerType GetFunctionArgumentAtIndex(void *type, const size_t index) override;
- virtual bool IsFunctionPointerType(void *type) override;
+ bool IsFunctionPointerType(void *type) override;
- virtual bool IsIntegerType(void *type, bool &is_signed) override;
+ bool IsIntegerType(void *type, bool &is_signed) override;
- virtual bool IsPossibleDynamicType(void *type,
+ bool IsPossibleDynamicType(void *type,
CompilerType *target_type, // Can pass NULL
bool check_cplusplus, bool check_objc) override;
- virtual bool IsPointerType(void *type, CompilerType *pointee_type = NULL) override;
+ bool IsPointerType(void *type, CompilerType *pointee_type = NULL) override;
+
+ bool IsScalarType(void *type) override;
- virtual bool IsScalarType(void *type) override;
+ bool IsVoidType(void *type) override;
- virtual bool IsVoidType(void *type) override;
+ bool SupportsLanguage (lldb::LanguageType language) override;
//----------------------------------------------------------------------
// Type Completion
@@ -217,9 +241,9 @@ class GoASTContext : public TypeSystem
virtual uint32_t GetNumChildren(void *type, bool omit_empty_base_classes) override;
virtual lldb::BasicType GetBasicTypeEnumeration(void *type) override;
- virtual CompilerType GetIntTypeFromBitSize (size_t bit_size, bool is_signed) override;
- virtual CompilerType GetFloatTypeFromBitSize (size_t bit_size) override;
+ virtual CompilerType GetBuiltinTypeForEncodingAndBitSize (lldb::Encoding encoding,
+ size_t bit_size) override;
virtual uint32_t GetNumFields(void *type) override;
Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Thu Sep 17 17:23:34 2015
@@ -147,8 +147,6 @@ public:
virtual size_t GetTypes (lldb_private::SymbolContextScope *sc_scope,
uint32_t type_mask,
lldb_private::TypeList &type_list) = 0;
- virtual ClangASTContext &
- GetClangASTContext ();
virtual lldb_private::TypeSystem *
GetTypeSystemForLanguage (lldb::LanguageType language);
Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Thu Sep 17 17:23:34 2015
@@ -14,7 +14,6 @@
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/UserID.h"
-#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Declaration.h"
@@ -254,9 +253,6 @@ public:
CompilerType
GetForwardCompilerType ();
- ClangASTContext &
- GetClangASTContext ();
-
static int
Compare(const Type &a, const Type &b);
@@ -422,7 +418,7 @@ public:
GetPointerType () const
{
if (type_sp)
- return type_sp->GetLayoutCompilerType ().GetPointerType();
+ return type_sp->GetForwardCompilerType().GetPointerType();
return clang_type.GetPointerType();
}
@@ -430,7 +426,7 @@ public:
GetPointeeType () const
{
if (type_sp)
- return type_sp->GetFullCompilerType ().GetPointeeType();
+ return type_sp->GetForwardCompilerType ().GetPointeeType();
return clang_type.GetPointeeType();
}
@@ -438,39 +434,43 @@ public:
GetReferenceType () const
{
if (type_sp)
- return ClangASTContext::GetLValueReferenceType(type_sp->GetLayoutCompilerType ());
- return ClangASTContext::GetLValueReferenceType(clang_type);
+ return type_sp->GetForwardCompilerType ().GetLValueReferenceType();
+ else
+ return clang_type.GetLValueReferenceType();
}
CompilerType
GetTypedefedType () const
{
if (type_sp)
- return type_sp->GetFullCompilerType ().GetTypedefedType();
- return clang_type.GetTypedefedType();
+ return type_sp->GetForwardCompilerType ().GetTypedefedType();
+ else
+ return clang_type.GetTypedefedType();
}
CompilerType
GetDereferencedType () const
{
if (type_sp)
- return type_sp->GetFullCompilerType ().GetNonReferenceType();
- return clang_type.GetNonReferenceType();
+ return type_sp->GetForwardCompilerType ().GetNonReferenceType();
+ else
+ return clang_type.GetNonReferenceType();
}
CompilerType
GetUnqualifiedType () const
{
if (type_sp)
- return type_sp->GetLayoutCompilerType ().GetFullyUnqualifiedType();
- return clang_type.GetFullyUnqualifiedType();
+ return type_sp->GetForwardCompilerType ().GetFullyUnqualifiedType();
+ else
+ return clang_type.GetFullyUnqualifiedType();
}
CompilerType
GetCanonicalType () const
{
if (type_sp)
- return type_sp->GetFullCompilerType ().GetCanonicalType();
+ return type_sp->GetForwardCompilerType ().GetCanonicalType();
return clang_type.GetCanonicalType();
}
Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Thu Sep 17 17:23:34 2015
@@ -14,6 +14,7 @@
#include <string>
#include "lldb/lldb-private.h"
#include "lldb/Core/ClangForward.h"
+#include "lldb/Core/PluginInterface.h"
#include "lldb/Expression/Expression.h"
#include "lldb/Symbol/CompilerDeclContext.h"
#include "clang/AST/CharUnits.h"
@@ -28,7 +29,7 @@ namespace lldb_private {
//----------------------------------------------------------------------
// Interface for representing the Type Systems in different languages.
//----------------------------------------------------------------------
-class TypeSystem
+class TypeSystem : public PluginInterface
{
public:
//----------------------------------------------------------------------
@@ -71,6 +72,9 @@ public:
LLVMCastKind getKind() const { return m_kind; }
+ static lldb::TypeSystemSP
+ CreateInstance (lldb::LanguageType language, const lldb_private::ArchSpec &arch);
+
//----------------------------------------------------------------------
// Constructors and Destructors
//----------------------------------------------------------------------
@@ -182,7 +186,11 @@ public:
virtual bool
IsVoidType (void *type) = 0;
-
+
+ // TypeSystems can support more than one language
+ virtual bool
+ SupportsLanguage (lldb::LanguageType language) = 0;
+
//----------------------------------------------------------------------
// Type Completion
//----------------------------------------------------------------------
@@ -245,7 +253,25 @@ public:
virtual CompilerType
GetPointerType (void *type) = 0;
-
+
+ virtual CompilerType
+ GetLValueReferenceType (void *type);
+
+ virtual CompilerType
+ GetRValueReferenceType (void *type);
+
+ virtual CompilerType
+ AddConstModifier (void *type);
+
+ virtual CompilerType
+ AddVolatileModifier (void *type);
+
+ virtual CompilerType
+ AddRestrictModifier (void *type);
+
+ virtual CompilerType
+ CreateTypedef (void *type, const char *name, const CompilerDeclContext &decl_ctx);
+
//----------------------------------------------------------------------
// Exploring the type
//----------------------------------------------------------------------
@@ -261,7 +287,10 @@ public:
virtual uint32_t
GetNumChildren (void *type, bool omit_empty_base_classes) = 0;
-
+
+ virtual CompilerType
+ GetBuiltinTypeByName (const ConstString &name);
+
virtual lldb::BasicType
GetBasicTypeEnumeration (void *type) = 0;
@@ -417,10 +446,8 @@ public:
GetBasicTypeFromAST (lldb::BasicType basic_type) = 0;
virtual CompilerType
- GetIntTypeFromBitSize (size_t bit_size, bool is_signed) = 0;
-
- virtual CompilerType
- GetFloatTypeFromBitSize (size_t bit_size) = 0;
+ GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding,
+ size_t bit_size) = 0;
virtual bool
IsBeingDefined (void *type) = 0;
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Thu Sep 17 17:23:34 2015
@@ -426,6 +426,7 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::TypeMemberFunctionImpl> TypeMemberFunctionImplSP;
typedef std::shared_ptr<lldb_private::TypeEnumMemberImpl> TypeEnumMemberImplSP;
typedef std::shared_ptr<lldb_private::TypeFilterImpl> TypeFilterImplSP;
+ typedef std::shared_ptr<lldb_private::TypeSystem> TypeSystemSP;
typedef std::shared_ptr<lldb_private::TypeFormatImpl> TypeFormatImplSP;
typedef std::shared_ptr<lldb_private::TypeNameSpecifierImpl> TypeNameSpecifierImplSP;
typedef std::shared_ptr<lldb_private::TypeSummaryImpl> TypeSummaryImplSP;
Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-interfaces.h (original)
+++ lldb/trunk/include/lldb/lldb-private-interfaces.h Thu Sep 17 17:23:34 2015
@@ -46,6 +46,7 @@ namespace lldb_private
typedef lldb::MemoryHistorySP (*MemoryHistoryCreateInstance) (const lldb::ProcessSP &process_sp);
typedef lldb::InstrumentationRuntimeType (*InstrumentationRuntimeGetType) ();
typedef lldb::InstrumentationRuntimeSP (*InstrumentationRuntimeCreateInstance) (const lldb::ProcessSP &process_sp);
+ typedef lldb::TypeSystemSP (*TypeSystemCreateInstance) (lldb::LanguageType language, const lldb_private::ArchSpec &arch);
typedef int (*ComparisonFunction)(const void *, const void *);
typedef void (*DebuggerInitializeCallback)(Debugger &debugger);
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Thu Sep 17 17:23:34 2015
@@ -20,10 +20,10 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Core/ValueObjectVariable.h"
-#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Symtab.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/Target.h"
@@ -521,7 +521,11 @@ SBModule::FindFirstType (const char *nam
sb_type = SBType (module_sp->FindFirstType(sc, name, exact_match));
if (!sb_type.IsValid())
- sb_type = SBType (ClangASTContext::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name));
+ {
+ TypeSystem *type_system = module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
+ if (type_system)
+ sb_type = SBType (type_system->GetBuiltinTypeByName(name));
+ }
}
return sb_type;
}
@@ -531,7 +535,11 @@ SBModule::GetBasicType(lldb::BasicType t
{
ModuleSP module_sp (GetSP ());
if (module_sp)
- return SBType (ClangASTContext::GetBasicType (module_sp->GetClangASTContext().getASTContext(), type));
+ {
+ TypeSystem *type_system = module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
+ if (type_system)
+ return SBType (type_system->GetBasicTypeFromAST(type));
+ }
return SBType();
}
@@ -564,9 +572,13 @@ SBModule::FindTypes (const char *type)
}
else
{
- SBType sb_type(ClangASTContext::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name));
- if (sb_type.IsValid())
- retval.Append(sb_type);
+ TypeSystem *type_system = module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
+ if (type_system)
+ {
+ CompilerType compiler_type = type_system->GetBuiltinTypeByName(name);
+ if (compiler_type)
+ retval.Append(SBType(compiler_type));
+ }
}
}
Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Thu Sep 17 17:23:34 2015
@@ -16,6 +16,7 @@
#include "lldb/Core/Stream.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "llvm/ADT/APSInt.h"
#include "clang/AST/Decl.h"
Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Thu Sep 17 17:23:34 2015
@@ -24,6 +24,8 @@
#include "lldb/Host/Host.h"
#include "lldb/Initialization/SystemInitializerCommon.h"
#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/GoASTContext.h"
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
@@ -251,6 +253,9 @@ SystemInitializerFull::Initialize()
llvm::InitializeAllTargetMCs();
llvm::InitializeAllDisassemblers();
+ ClangASTContext::Initialize();
+ GoASTContext::Initialize();
+
ABIMacOSX_i386::Initialize();
ABIMacOSX_arm::Initialize();
ABIMacOSX_arm64::Initialize();
@@ -359,6 +364,10 @@ SystemInitializerFull::Terminate()
// Terminate and unload and loaded system or user LLDB plug-ins
PluginManager::Terminate();
+
+ ClangASTContext::Terminate();
+ GoASTContext::Terminate();
+
ABIMacOSX_i386::Terminate();
ABIMacOSX_arm::Terminate();
ABIMacOSX_arm64::Terminate();
Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Thu Sep 17 17:23:34 2015
@@ -146,8 +146,14 @@ CommandObjectArgs::DoExecute (Args& args
result.SetStatus (eReturnStatusFailed);
return false;
}
-
- ClangASTContext &ast_context = thread_module_sp->GetClangASTContext();
+
+ TypeSystem *type_system = thread_module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
+ if (type_system == nullptr)
+ {
+ result.AppendError ("Unable to create C type system.");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
ValueList value_list;
@@ -156,7 +162,7 @@ CommandObjectArgs::DoExecute (Args& args
const char *arg_type_cstr = args.GetArgumentAtIndex(arg_index);
Value value;
value.SetValueType(Value::eValueTypeScalar);
- CompilerType clang_type;
+ CompilerType compiler_type;
char *int_pos;
if ((int_pos = strstr (const_cast<char*>(arg_type_cstr), "int")))
@@ -198,10 +204,9 @@ CommandObjectArgs::DoExecute (Args& args
result.SetStatus (eReturnStatusFailed);
return false;
}
+ compiler_type = type_system->GetBuiltinTypeForEncodingAndBitSize(encoding, width);
- clang_type = ast_context.GetBuiltinTypeForEncodingAndBitSize(encoding, width);
-
- if (!clang_type.IsValid())
+ if (!compiler_type.IsValid())
{
result.AppendErrorWithFormat ("Couldn't get Clang type for format %s (%s integer, width %d).\n",
arg_type_cstr,
@@ -215,9 +220,9 @@ CommandObjectArgs::DoExecute (Args& args
else if (strchr (arg_type_cstr, '*'))
{
if (!strcmp (arg_type_cstr, "void*"))
- clang_type = ast_context.GetBasicType(eBasicTypeVoid).GetPointerType();
+ compiler_type = type_system->GetBasicTypeFromAST(eBasicTypeVoid).GetPointerType();
else if (!strcmp (arg_type_cstr, "char*"))
- clang_type = ast_context.GetCStringType (false);
+ compiler_type = type_system->GetBasicTypeFromAST(eBasicTypeChar).GetPointerType();
else
{
result.AppendErrorWithFormat ("Invalid format: %s.\n", arg_type_cstr);
@@ -232,7 +237,7 @@ CommandObjectArgs::DoExecute (Args& args
return false;
}
- value.SetCompilerType (clang_type);
+ value.SetCompilerType (compiler_type);
value_list.PushValue(value);
}
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Thu Sep 17 17:23:34 2015
@@ -15,6 +15,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamString.h"
@@ -23,17 +24,16 @@
#include "lldb/Host/Symbols.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompileUnit.h"
-#include "lldb/Symbol/GoASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
-#include "lldb/Symbol/SymbolFile.h"
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "Plugins/Language/ObjC/ObjCLanguage.h"
@@ -148,14 +148,12 @@ Module::Module (const ModuleSpec &module
m_object_mod_time (),
m_objfile_sp (),
m_symfile_ap (),
- m_ast (new ClangASTContext),
- m_go_ast(),
+ m_type_system_map(),
m_source_mappings (),
m_sections_ap(),
m_did_load_objfile (false),
m_did_load_symbol_vendor (false),
m_did_parse_uuid (false),
- m_did_init_ast (false),
m_file_has_changed (false),
m_first_file_changed_log (false)
{
@@ -253,14 +251,12 @@ Module::Module(const FileSpec& file_spec
m_object_mod_time (),
m_objfile_sp (),
m_symfile_ap (),
- m_ast (new ClangASTContext),
- m_go_ast(),
+ m_type_system_map(),
m_source_mappings (),
m_sections_ap(),
m_did_load_objfile (false),
m_did_load_symbol_vendor (false),
m_did_parse_uuid (false),
- m_did_init_ast (false),
m_file_has_changed (false),
m_first_file_changed_log (false)
{
@@ -300,14 +296,12 @@ Module::Module () :
m_object_mod_time (),
m_objfile_sp (),
m_symfile_ap (),
- m_ast (new ClangASTContext),
- m_go_ast(),
+ m_type_system_map(),
m_source_mappings (),
m_sections_ap(),
m_did_load_objfile (false),
m_did_load_symbol_vendor (false),
m_did_parse_uuid (false),
- m_did_init_ast (false),
m_file_has_changed (false),
m_first_file_changed_log (false)
{
@@ -424,64 +418,26 @@ Module::GetUUID()
TypeSystem *
Module::GetTypeSystemForLanguage (LanguageType language)
{
- if (language == eLanguageTypeGo)
- {
- Mutex::Locker locker (m_mutex);
- if (!m_go_ast)
- {
- ObjectFile * objfile = GetObjectFile();
- ArchSpec object_arch;
- if (objfile && objfile->GetArchitecture(object_arch))
- {
- m_go_ast.reset(new GoASTContext);
- m_go_ast->SetAddressByteSize(object_arch.GetAddressByteSize());
- }
- }
- return m_go_ast.get();
- }
- else if (language != eLanguageTypeSwift)
- {
- // For now assume all languages except swift use the ClangASTContext for types
- return &GetClangASTContext();
- }
- return nullptr;
-}
+ Mutex::Locker locker (m_mutex);
+ TypeSystemMap::iterator pos = m_type_system_map.find(language);
+ if (pos != m_type_system_map.end())
+ return pos->second.get();
-ClangASTContext &
-Module::GetClangASTContext ()
-{
- if (m_did_init_ast.load() == false)
+ for (const auto &pair : m_type_system_map)
{
- Mutex::Locker locker (m_mutex);
- if (m_did_init_ast.load() == false)
+ if (pair.second && pair.second->SupportsLanguage(language))
{
- ObjectFile * objfile = GetObjectFile();
- ArchSpec object_arch;
- if (objfile && objfile->GetArchitecture(object_arch))
- {
- m_did_init_ast = true;
-
- // LLVM wants this to be set to iOS or MacOSX; if we're working on
- // a bare-boards type image, change the triple for llvm's benefit.
- if (object_arch.GetTriple().getVendor() == llvm::Triple::Apple
- && object_arch.GetTriple().getOS() == llvm::Triple::UnknownOS)
- {
- if (object_arch.GetTriple().getArch() == llvm::Triple::arm ||
- object_arch.GetTriple().getArch() == llvm::Triple::aarch64 ||
- object_arch.GetTriple().getArch() == llvm::Triple::thumb)
- {
- object_arch.GetTriple().setOS(llvm::Triple::IOS);
- }
- else
- {
- object_arch.GetTriple().setOS(llvm::Triple::MacOSX);
- }
- }
- m_ast->SetArchitecture (object_arch);
- }
+ // Add a new mapping for "language" to point to an already existing
+ // TypeSystem that supports this language
+ m_type_system_map[language] = pair.second;
+ return pair.second.get();
}
}
- return *m_ast;
+
+ // Cache even if we get a shared pointer that contains null type system back
+ lldb::TypeSystemSP type_system_sp = TypeSystem::CreateInstance (language, GetArchitecture());
+ m_type_system_map[language] = type_system_sp;
+ return type_system_sp.get();
}
void
Modified: lldb/trunk/source/Core/PluginManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/PluginManager.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Core/PluginManager.cpp (original)
+++ lldb/trunk/source/Core/PluginManager.cpp Thu Sep 17 17:23:34 2015
@@ -2516,6 +2516,108 @@ PluginManager::GetInstrumentationRuntime
return NULL;
}
+#pragma mark TypeSystem
+
+
+struct TypeSystemInstance
+{
+ TypeSystemInstance() :
+ name(),
+ description(),
+ create_callback(NULL)
+ {
+ }
+
+ ConstString name;
+ std::string description;
+ TypeSystemCreateInstance create_callback;
+};
+
+typedef std::vector<TypeSystemInstance> TypeSystemInstances;
+
+static Mutex &
+GetTypeSystemMutex ()
+{
+ static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+ return g_instances_mutex;
+}
+
+static TypeSystemInstances &
+GetTypeSystemInstances ()
+{
+ static TypeSystemInstances g_instances;
+ return g_instances;
+}
+
+bool
+PluginManager::RegisterPlugin (const ConstString &name,
+ const char *description,
+ TypeSystemCreateInstance create_callback)
+{
+ if (create_callback)
+ {
+ TypeSystemInstance instance;
+ assert ((bool)name);
+ instance.name = name;
+ if (description && description[0])
+ instance.description = description;
+ instance.create_callback = create_callback;
+ Mutex::Locker locker (GetTypeSystemMutex ());
+ GetTypeSystemInstances ().push_back (instance);
+ }
+ return false;
+}
+
+bool
+PluginManager::UnregisterPlugin (TypeSystemCreateInstance create_callback)
+{
+ if (create_callback)
+ {
+ Mutex::Locker locker (GetTypeSystemMutex ());
+ TypeSystemInstances &instances = GetTypeSystemInstances ();
+
+ TypeSystemInstances::iterator pos, end = instances.end();
+ for (pos = instances.begin(); pos != end; ++ pos)
+ {
+ if (pos->create_callback == create_callback)
+ {
+ instances.erase(pos);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+TypeSystemCreateInstance
+PluginManager::GetTypeSystemCreateCallbackAtIndex (uint32_t idx)
+{
+ Mutex::Locker locker (GetTypeSystemMutex ());
+ TypeSystemInstances &instances = GetTypeSystemInstances ();
+ if (idx < instances.size())
+ return instances[idx].create_callback;
+ return NULL;
+}
+
+TypeSystemCreateInstance
+PluginManager::GetTypeSystemCreateCallbackForPluginName (const ConstString &name)
+{
+ if (name)
+ {
+ Mutex::Locker locker (GetTypeSystemMutex ());
+ TypeSystemInstances &instances = GetTypeSystemInstances ();
+
+ TypeSystemInstances::iterator pos, end = instances.end();
+ for (pos = instances.begin(); pos != end; ++ pos)
+ {
+ if (name == pos->name)
+ return pos->create_callback;
+ }
+ }
+ return NULL;
+}
+
+
#pragma mark PluginManager
void
Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Thu Sep 17 17:23:34 2015
@@ -154,7 +154,7 @@ FixupTypeAndOrName (const TypeAndOrName&
if (parent.IsPointerType())
corrected_type = orig_type.GetPointerType ();
else if (parent.IsPointerOrReferenceType())
- corrected_type = ClangASTContext::GetLValueReferenceType(orig_type);
+ corrected_type = orig_type.GetLValueReferenceType();
ret.SetCompilerType(corrected_type);
}
else /*if (m_dynamic_type_info.HasName())*/
Modified: lldb/trunk/source/Core/ValueObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectRegister.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectRegister.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectRegister.cpp Thu Sep 17 17:23:34 2015
@@ -319,8 +319,10 @@ ValueObjectRegister::GetCompilerTypeImpl
Module *exe_module = target->GetExecutableModulePointer();
if (exe_module)
{
- m_clang_type = exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize (m_reg_info.encoding,
- m_reg_info.byte_size * 8);
+ TypeSystem *type_system = exe_module->GetTypeSystemForLanguage (eLanguageTypeC);
+ if (type_system)
+ m_clang_type = type_system->GetBuiltinTypeForEncodingAndBitSize (m_reg_info.encoding,
+ m_reg_info.byte_size * 8);
}
}
}
Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Thu Sep 17 17:23:34 2015
@@ -229,7 +229,7 @@ FormatManager::GetPossibleMatches (Value
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,
Modified: lldb/trunk/source/DataFormatters/VectorType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/VectorType.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/VectorType.cpp (original)
+++ lldb/trunk/source/DataFormatters/VectorType.cpp Thu Sep 17 17:23:34 2015
@@ -31,7 +31,7 @@ GetCompilerTypeForFormat (lldb::Format f
{
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 f
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 f
case lldb::eFormatOSType:
case lldb::eFormatVoid:
default:
- return type_system->GetIntTypeFromBitSize(8, false);
+ return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 8);
}
}
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Sep 17 17:23:34 2015
@@ -1678,7 +1678,17 @@ ClangExpressionDeclMap::GetVariableValue
return false;
}
- ASTContext *ast = var_type->GetClangASTContext().getASTContext();
+ ClangASTContext *clang_ast = llvm::dyn_cast_or_null<ClangASTContext>(var_type->GetForwardCompilerType().GetTypeSystem());
+
+ if (!clang_ast)
+ {
+ if (log)
+ log->PutCString("Skipped a definition because it has no Clang AST");
+ return false;
+ }
+
+
+ ASTContext *ast = clang_ast->getASTContext();
if (!ast)
{
@@ -1785,7 +1795,7 @@ ClangExpressionDeclMap::AddOneVariable (
if (is_reference)
var_decl = context.AddVarDecl(pt);
else
- var_decl = context.AddVarDecl(ClangASTContext::GetLValueReferenceType(pt));
+ var_decl = context.AddVarDecl(pt.GetLValueReferenceType());
std::string decl_name(context.m_decl_name.getAsString());
ConstString entity_name(decl_name.c_str());
@@ -1829,7 +1839,7 @@ ClangExpressionDeclMap::AddOneVariable(N
return;
}
- NamedDecl *var_decl = context.AddVarDecl(ClangASTContext::GetLValueReferenceType(parser_type));
+ NamedDecl *var_decl = context.AddVarDecl(parser_type.GetLValueReferenceType());
llvm::cast<ClangExpressionVariable>(pvar_sp.get())->EnableParserVars(GetParserID());
ClangExpressionVariable::ParserVars *parser_vars = llvm::cast<ClangExpressionVariable>(pvar_sp.get())->GetParserVars(GetParserID());
@@ -1861,8 +1871,8 @@ ClangExpressionDeclMap::AddOneGenericVar
ASTContext *scratch_ast_context = target->GetScratchClangASTContext()->getASTContext();
- TypeFromUser user_type (ClangASTContext::GetLValueReferenceType(ClangASTContext::GetBasicType(scratch_ast_context, eBasicTypeVoid).GetPointerType()));
- TypeFromParser parser_type (ClangASTContext::GetLValueReferenceType(ClangASTContext::GetBasicType(m_ast_context, eBasicTypeVoid).GetPointerType()));
+ TypeFromUser user_type (ClangASTContext::GetBasicType(scratch_ast_context, eBasicTypeVoid).GetPointerType().GetLValueReferenceType());
+ TypeFromParser parser_type (ClangASTContext::GetBasicType(m_ast_context, eBasicTypeVoid).GetPointerType().GetLValueReferenceType());
NamedDecl *var_decl = context.AddVarDecl(parser_type);
std::string decl_name(context.m_decl_name.getAsString());
Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Thu Sep 17 17:23:34 2015
@@ -28,6 +28,7 @@
#include "lldb/Expression/IRInterpreter.h"
#include "lldb/Host/File.h"
#include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
Modified: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemInitializerCommon.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp (original)
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp Thu Sep 17 17:23:34 2015
@@ -13,7 +13,8 @@
#include "lldb/Host/HostInfo.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Timer.h"
-
+#include "lldb/Symbol/GoASTContext.h"
+#include "lldb/Symbol/ClangASTContext.h"
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
@@ -103,6 +104,9 @@ SystemInitializerCommon::Initialize()
process_gdb_remote::ProcessGDBRemoteLog::Initialize();
// Initialize plug-ins
+ ClangASTContext::Initialize();
+ GoASTContext::Initialize();
+
ObjectContainerBSDArchive::Initialize();
ObjectFileELF::Initialize();
ObjectFilePECOFF::Initialize();
@@ -166,6 +170,9 @@ SystemInitializerCommon::Terminate()
PlatformRemoteiOS::Terminate();
PlatformiOSSimulator::Terminate();
+ ClangASTContext::Terminate();
+ GoASTContext::Terminate();
+
EmulateInstructionARM::Terminate();
EmulateInstructionMIPS::Terminate();
EmulateInstructionMIPS64::Terminate();
Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Thu Sep 17 17:23:34 2015
@@ -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},
Modified: lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp Thu Sep 17 17:23:34 2015
@@ -30,8 +30,8 @@ lldb_private::formatters::CMTimeSummaryP
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));
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp Thu Sep 17 17:23:34 2015
@@ -177,7 +177,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
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;
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Sep 17 17:23:34 2015
@@ -495,15 +495,6 @@ SymbolFileDWARF::GetUniqueDWARFASTTypeMa
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::DeclContextMatchesThisS
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...
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Thu Sep 17 17:23:34 2015
@@ -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;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Thu Sep 17 17:23:34 2015
@@ -297,9 +297,6 @@ SymbolFileDWARFDebugMap::~SymbolFileDWAR
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
Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Thu Sep 17 17:23:34 2015
@@ -79,14 +79,6 @@ SymbolFileSymtab::~SymbolFileSymtab()
{
}
-ClangASTContext &
-SymbolFileSymtab::GetClangASTContext ()
-{
- ClangASTContext &ast = m_obj_file->GetModule()->GetClangASTContext();
-
- return ast;
-}
-
uint32_t
SymbolFileSymtab::CalculateAbilities ()
{
Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h Thu Sep 17 17:23:34 2015
@@ -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);
Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp Thu Sep 17 17:23:34 2015
@@ -444,7 +444,7 @@ SystemRuntimeMacOSX::ReadLibdispatchTSDI
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);
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Sep 17 17:23:34 2015
@@ -64,6 +64,8 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Flags.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/ThreadSafeDenseMap.h"
@@ -77,9 +79,11 @@
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangExternalASTSourceCallbacks.h"
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
+#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/VerifyDecl.h"
#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
@@ -95,6 +99,17 @@ using namespace lldb_private;
using namespace llvm;
using namespace clang;
+namespace
+{
+ static inline bool ClangASTContextSupportsLanguage (lldb::LanguageType language)
+ {
+ return language == eLanguageTypeUnknown || // Clang is the default type system
+ Language::LanguageIsC (language) ||
+ Language::LanguageIsCPlusPlus (language) ||
+ Language::LanguageIsObjC (language);
+ }
+}
+
typedef lldb_private::ThreadSafeDenseMap<clang::ASTContext *, ClangASTContext*> ClangASTMap;
static ClangASTMap &
@@ -336,6 +351,74 @@ ClangASTContext::~ClangASTContext()
m_ast_ap.reset();
}
+ConstString
+ClangASTContext::GetPluginNameStatic()
+{
+ return ConstString("clang");
+}
+
+ConstString
+ClangASTContext::GetPluginName()
+{
+ return ClangASTContext::GetPluginNameStatic();
+}
+
+uint32_t
+ClangASTContext::GetPluginVersion()
+{
+ return 1;
+}
+
+lldb::TypeSystemSP
+ClangASTContext::CreateInstance (lldb::LanguageType language, const lldb_private::ArchSpec &arch)
+{
+ if (ClangASTContextSupportsLanguage(language))
+ {
+ std::shared_ptr<ClangASTContext> ast_sp(new ClangASTContext);
+ if (ast_sp)
+ {
+ if (arch.IsValid())
+ {
+ ArchSpec fixed_arch = arch;
+ // LLVM wants this to be set to iOS or MacOSX; if we're working on
+ // a bare-boards type image, change the triple for llvm's benefit.
+ if (fixed_arch.GetTriple().getVendor() == llvm::Triple::Apple &&
+ fixed_arch.GetTriple().getOS() == llvm::Triple::UnknownOS)
+ {
+ if (fixed_arch.GetTriple().getArch() == llvm::Triple::arm ||
+ fixed_arch.GetTriple().getArch() == llvm::Triple::aarch64 ||
+ fixed_arch.GetTriple().getArch() == llvm::Triple::thumb)
+ {
+ fixed_arch.GetTriple().setOS(llvm::Triple::IOS);
+ }
+ else
+ {
+ fixed_arch.GetTriple().setOS(llvm::Triple::MacOSX);
+ }
+ }
+ ast_sp->SetArchitecture (fixed_arch);
+ }
+ }
+ return ast_sp;
+ }
+ return lldb::TypeSystemSP();
+}
+
+
+void
+ClangASTContext::Initialize()
+{
+ PluginManager::RegisterPlugin (GetPluginNameStatic(),
+ "clang base AST context plug-in",
+ CreateInstance);
+}
+
+void
+ClangASTContext::Terminate()
+{
+ PluginManager::UnregisterPlugin (CreateInstance);
+}
+
void
ClangASTContext::Clear()
@@ -595,8 +678,9 @@ QualTypeMatchesBitSize(const uint64_t bi
return true;
return false;
}
+
CompilerType
-ClangASTContext::GetBuiltinTypeForEncodingAndBitSize (Encoding encoding, uint32_t bit_size)
+ClangASTContext::GetBuiltinTypeForEncodingAndBitSize (Encoding encoding, size_t bit_size)
{
return ClangASTContext::GetBuiltinTypeForEncodingAndBitSize (getASTContext(), encoding, bit_size);
}
@@ -2132,24 +2216,6 @@ ClangASTContext::GetPointerSizedIntType
return CompilerType();
}
-CompilerType
-ClangASTContext::GetFloatTypeFromBitSize (clang::ASTContext *ast,
- size_t bit_size)
-{
- if (ast)
- {
- if (bit_size == ast->getTypeSize(ast->FloatTy))
- return CompilerType(ast, ast->FloatTy);
- else if (bit_size == ast->getTypeSize(ast->DoubleTy))
- return CompilerType(ast, ast->DoubleTy);
- else if (bit_size == ast->getTypeSize(ast->LongDoubleTy))
- return CompilerType(ast, ast->LongDoubleTy);
- else if (bit_size == ast->getTypeSize(ast->HalfTy))
- return CompilerType(ast, ast->HalfTy);
- }
- return CompilerType();
-}
-
bool
ClangASTContext::GetCompleteDecl (clang::ASTContext *ast,
clang::Decl *decl)
@@ -3302,6 +3368,12 @@ ClangASTContext::IsVoidType (void* type)
}
bool
+ClangASTContext::SupportsLanguage (lldb::LanguageType language)
+{
+ return ClangASTContextSupportsLanguage(language);
+}
+
+bool
ClangASTContext::GetCXXClassName (const CompilerType& type, std::string &class_name)
{
if (type)
@@ -3788,44 +3860,6 @@ ClangASTContext::GetTypeQualifiers(void*
//----------------------------------------------------------------------
CompilerType
-ClangASTContext::AddConstModifier (const CompilerType& type)
-{
- if (IsClangType(type))
- {
- // Make sure this type is a clang AST type
- clang::QualType result(GetQualType(type));
- result.addConst();
- return CompilerType (type.GetTypeSystem(), result.getAsOpaquePtr());
- }
-
- return CompilerType();
-}
-
-CompilerType
-ClangASTContext::AddRestrictModifier (const CompilerType& type)
-{
- if (IsClangType(type))
- {
- clang::QualType result(GetQualType(type));
- result.getQualifiers().setRestrict (true);
- return CompilerType (type.GetTypeSystem(), result.getAsOpaquePtr());
- }
- return CompilerType();
-}
-
-CompilerType
-ClangASTContext::AddVolatileModifier (const CompilerType& type)
-{
- if (IsClangType(type))
- {
- clang::QualType result(GetQualType(type));
- result.getQualifiers().setVolatile (true);
- return CompilerType (type.GetTypeSystem(), result.getAsOpaquePtr());
- }
- return CompilerType();
-}
-
-CompilerType
ClangASTContext::GetArrayElementType (void* type, uint64_t *stride)
{
if (type)
@@ -4115,28 +4149,6 @@ ClangASTContext::GetMemberFunctionAtInde
}
CompilerType
-ClangASTContext::GetLValueReferenceType (const CompilerType& type)
-{
- if (IsClangType(type))
- {
- ClangASTContext *ast = llvm::dyn_cast<ClangASTContext>(type.GetTypeSystem());
- return CompilerType(ast->getASTContext(), ast->getASTContext()->getLValueReferenceType(GetQualType(type)));
- }
- return CompilerType();
-}
-
-CompilerType
-ClangASTContext::GetRValueReferenceType (const CompilerType& type)
-{
- if (IsClangType(type))
- {
- ClangASTContext *ast = llvm::dyn_cast<ClangASTContext>(type.GetTypeSystem());
- return CompilerType(ast->getASTContext(), ast->getASTContext()->getRValueReferenceType(GetQualType(type)));
- }
- return CompilerType();
-}
-
-CompilerType
ClangASTContext::GetNonReferenceType (void* type)
{
if (type)
@@ -4209,6 +4221,92 @@ ClangASTContext::GetPointerType (void* t
return CompilerType();
}
+
+CompilerType
+ClangASTContext::GetLValueReferenceType (void *type)
+{
+ if (type)
+ return CompilerType(this, getASTContext()->getLValueReferenceType(GetQualType(type)).getAsOpaquePtr());
+ else
+ return CompilerType();
+}
+
+CompilerType
+ClangASTContext::GetRValueReferenceType (void *type)
+{
+ if (type)
+ return CompilerType(this, getASTContext()->getRValueReferenceType(GetQualType(type)).getAsOpaquePtr());
+ else
+ return CompilerType();
+}
+
+CompilerType
+ClangASTContext::AddConstModifier (void *type)
+{
+ if (type)
+ {
+ clang::QualType result(GetQualType(type));
+ result.addConst();
+ return CompilerType (this, result.getAsOpaquePtr());
+ }
+ return CompilerType();
+}
+
+CompilerType
+ClangASTContext::AddVolatileModifier (void *type)
+{
+ if (type)
+ {
+ clang::QualType result(GetQualType(type));
+ result.addVolatile();
+ return CompilerType (this, result.getAsOpaquePtr());
+ }
+ return CompilerType();
+
+}
+
+CompilerType
+ClangASTContext::AddRestrictModifier (void *type)
+{
+ if (type)
+ {
+ clang::QualType result(GetQualType(type));
+ result.addRestrict();
+ return CompilerType (this, result.getAsOpaquePtr());
+ }
+ return CompilerType();
+
+}
+
+CompilerType
+ClangASTContext::CreateTypedef (void *type, const char *typedef_name, const CompilerDeclContext &compiler_decl_ctx)
+{
+ if (type)
+ {
+ clang::ASTContext* clang_ast = getASTContext();
+ clang::QualType qual_type (GetQualType(type));
+
+ clang::DeclContext *decl_ctx = ClangASTContext::DeclContextGetAsDeclContext(compiler_decl_ctx);
+ if (decl_ctx == nullptr)
+ decl_ctx = getASTContext()->getTranslationUnitDecl();
+
+ clang::TypedefDecl *decl = clang::TypedefDecl::Create (*clang_ast,
+ decl_ctx,
+ clang::SourceLocation(),
+ clang::SourceLocation(),
+ &clang_ast->Idents.get(typedef_name),
+ clang_ast->getTrivialTypeSourceInfo(qual_type));
+
+ decl->setAccess(clang::AS_public); // TODO respect proper access specifier
+
+ // Get a uniqued clang::QualType for the typedef decl type
+ return CompilerType (this, clang_ast->getTypedefType (decl).getAsOpaquePtr());
+
+ }
+ return CompilerType();
+
+}
+
CompilerType
ClangASTContext::GetTypedefedType (void* type)
{
@@ -4769,6 +4867,12 @@ ClangASTContext::GetNumChildren (void* t
return num_children;
}
+CompilerType
+ClangASTContext::GetBuiltinTypeByName (const ConstString &name)
+{
+ return GetBasicType (GetBasicTypeEnumeration (name));
+}
+
lldb::BasicType
ClangASTContext::GetBasicTypeEnumeration (void* type)
{
Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Thu Sep 17 17:23:34 2015
@@ -532,11 +532,66 @@ CompilerType::GetPointerType () const
}
CompilerType
+CompilerType::GetLValueReferenceType () const
+{
+ if (IsValid())
+ return m_type_system->GetLValueReferenceType(m_type);
+ else
+ return CompilerType();
+}
+
+CompilerType
+CompilerType::GetRValueReferenceType () const
+{
+ if (IsValid())
+ return m_type_system->GetRValueReferenceType(m_type);
+ else
+ return CompilerType();
+}
+
+CompilerType
+CompilerType::AddConstModifier () const
+{
+ if (IsValid())
+ return m_type_system->AddConstModifier(m_type);
+ else
+ return CompilerType();
+}
+
+CompilerType
+CompilerType::AddVolatileModifier () const
+{
+ if (IsValid())
+ return m_type_system->AddVolatileModifier(m_type);
+ else
+ return CompilerType();
+}
+
+CompilerType
+CompilerType::AddRestrictModifier () const
+{
+ if (IsValid())
+ return m_type_system->AddRestrictModifier(m_type);
+ else
+ return CompilerType();
+}
+
+CompilerType
+CompilerType::CreateTypedef (const char *name, const CompilerDeclContext &decl_ctx) const
+{
+ if (IsValid())
+ return m_type_system->CreateTypedef(m_type, name, decl_ctx);
+ else
+ return CompilerType();
+}
+
+CompilerType
CompilerType::GetTypedefedType () const
{
if (IsValid())
return m_type_system->GetTypedefedType(m_type);
- return CompilerType();
+ else
+ return CompilerType();
}
//----------------------------------------------------------------------
Modified: lldb/trunk/source/Symbol/GoASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/GoASTContext.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/GoASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/GoASTContext.cpp Thu Sep 17 17:23:34 2015
@@ -11,10 +11,13 @@
#include <utility>
#include <vector>
+#include "lldb/Core/Module.h"
+#include "lldb/Core/PluginManager.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/DataFormatters/StringPrinter.h"
#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/GoASTContext.h"
#include "lldb/Symbol/Type.h"
@@ -295,6 +298,59 @@ GoASTContext::~GoASTContext()
{
}
+//------------------------------------------------------------------
+// PluginInterface functions
+//------------------------------------------------------------------
+
+ConstString
+GoASTContext::GetPluginNameStatic()
+{
+ return ConstString("go");
+}
+
+ConstString
+GoASTContext::GetPluginName()
+{
+ return GoASTContext::GetPluginNameStatic();
+}
+
+uint32_t
+GoASTContext::GetPluginVersion()
+{
+ return 1;
+}
+
+lldb::TypeSystemSP
+GoASTContext::CreateInstance (lldb::LanguageType language, const lldb_private::ArchSpec &arch)
+{
+ if (language == eLanguageTypeGo)
+ {
+ if (arch.IsValid())
+ {
+ std::shared_ptr<GoASTContext> go_ast_sp(new GoASTContext);
+ go_ast_sp->SetAddressByteSize(arch.GetAddressByteSize());
+ return go_ast_sp;
+ }
+ }
+ return lldb::TypeSystemSP();
+}
+
+
+void
+GoASTContext::Initialize()
+{
+ PluginManager::RegisterPlugin (GetPluginNameStatic(),
+ "AST context plug-in",
+ CreateInstance);
+}
+
+void
+GoASTContext::Terminate()
+{
+ PluginManager::UnregisterPlugin (CreateInstance);
+}
+
+
//----------------------------------------------------------------------
// Tests
//----------------------------------------------------------------------
@@ -548,6 +604,12 @@ GoASTContext::IsVoidType(void *type)
return static_cast<GoType *>(type)->GetGoKind() == GoType::KIND_LLDB_VOID;
}
+bool
+GoASTContext::SupportsLanguage (lldb::LanguageType language)
+{
+ return language == eLanguageTypeGo;
+}
+
//----------------------------------------------------------------------
// Type Completion
//----------------------------------------------------------------------
@@ -829,11 +891,9 @@ GoASTContext::GetBasicTypeFromAST(lldb::
return CompilerType();
}
-CompilerType GoASTContext::GetIntTypeFromBitSize (size_t bit_size, bool is_signed)
-{
- return CompilerType();
-}
-CompilerType GoASTContext::GetFloatTypeFromBitSize (size_t bit_size)
+CompilerType
+GoASTContext::GetBuiltinTypeForEncodingAndBitSize (lldb::Encoding encoding,
+ size_t bit_size)
{
return CompilerType();
}
@@ -1306,7 +1366,7 @@ GoASTContext::CreateBaseType(int go_kind
}
CompilerType
-GoASTContext::CreateTypedef(int kind, const ConstString &name, CompilerType impl)
+GoASTContext::CreateTypedefType(int kind, const ConstString &name, CompilerType impl)
{
GoType *type = new GoElem(kind, name, impl);
(*m_types)[name].reset(type);
Modified: lldb/trunk/source/Symbol/SymbolFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolFile.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolFile.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolFile.cpp Thu Sep 17 17:23:34 2015
@@ -16,6 +16,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/TypeList.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Symbol/VariableList.h"
using namespace lldb_private;
@@ -84,12 +85,6 @@ SymbolFile::GetTypeList ()
return nullptr;
}
-ClangASTContext &
-SymbolFile::GetClangASTContext ()
-{
- return m_obj_file->GetModule()->GetClangASTContext();
-}
-
TypeSystem *
SymbolFile::GetTypeSystemForLanguage (lldb::LanguageType language)
{
Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Thu Sep 17 17:23:34 2015
@@ -16,13 +16,13 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/CompilerType.h"
-#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContextScope.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/TypeList.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
@@ -344,7 +344,11 @@ Type::GetByteSize()
case eEncodingIsPointerUID:
case eEncodingIsLValueReferenceUID:
case eEncodingIsRValueReferenceUID:
- m_byte_size = m_symbol_file->GetClangASTContext().GetPointerByteSize();
+ {
+ ArchSpec arch;
+ if (m_symbol_file->GetObjectFile()->GetArchitecture(arch))
+ m_byte_size = arch.GetAddressByteSize();
+ }
break;
}
}
@@ -512,21 +516,20 @@ Type::ResolveClangType (ResolveState cla
break;
case eEncodingIsConstUID:
- m_clang_type = ClangASTContext::AddConstModifier(encoding_type->GetForwardCompilerType ());
+ m_clang_type = encoding_type->GetForwardCompilerType ().AddConstModifier();
break;
case eEncodingIsRestrictUID:
- m_clang_type = ClangASTContext::AddRestrictModifier(encoding_type->GetForwardCompilerType ());
+ m_clang_type = encoding_type->GetForwardCompilerType ().AddRestrictModifier();
break;
case eEncodingIsVolatileUID:
- m_clang_type = ClangASTContext::AddVolatileModifier(encoding_type->GetForwardCompilerType ());
+ m_clang_type = encoding_type->GetForwardCompilerType ().AddVolatileModifier();
break;
case eEncodingIsTypedefUID:
- m_clang_type = ClangASTContext::CreateTypedefType (encoding_type->GetForwardCompilerType (),
- GetName().AsCString(),
- GetSymbolFile()->GetDeclContextContainingUID(GetID()));
+ m_clang_type = encoding_type->GetForwardCompilerType ().CreateTypedef(GetName().AsCString(),
+ GetSymbolFile()->GetDeclContextContainingUID(GetID()));
m_name.Clear();
break;
@@ -535,11 +538,11 @@ Type::ResolveClangType (ResolveState cla
break;
case eEncodingIsLValueReferenceUID:
- m_clang_type = ClangASTContext::GetLValueReferenceType(encoding_type->GetForwardCompilerType ());
+ m_clang_type = encoding_type->GetForwardCompilerType ().GetLValueReferenceType();
break;
case eEncodingIsRValueReferenceUID:
- m_clang_type = ClangASTContext::GetRValueReferenceType(encoding_type->GetForwardCompilerType ());
+ m_clang_type = encoding_type->GetForwardCompilerType ().GetRValueReferenceType();
break;
default:
@@ -550,7 +553,8 @@ Type::ResolveClangType (ResolveState cla
else
{
// We have no encoding type, return void?
- CompilerType void_clang_type (ClangASTContext::GetBasicType(GetClangASTContext().getASTContext(), eBasicTypeVoid));
+ TypeSystem *type_system = m_symbol_file->GetTypeSystemForLanguage(eLanguageTypeC);
+ CompilerType void_clang_type = type_system->GetBasicTypeFromAST(eBasicTypeVoid);
switch (m_encoding_uid_type)
{
case eEncodingIsUID:
@@ -558,21 +562,20 @@ Type::ResolveClangType (ResolveState cla
break;
case eEncodingIsConstUID:
- m_clang_type = ClangASTContext::AddConstModifier (void_clang_type);
+ m_clang_type = void_clang_type.AddConstModifier();
break;
case eEncodingIsRestrictUID:
- m_clang_type = ClangASTContext::AddRestrictModifier (void_clang_type);
+ m_clang_type = void_clang_type.AddRestrictModifier();
break;
case eEncodingIsVolatileUID:
- m_clang_type = ClangASTContext::AddVolatileModifier (void_clang_type);
+ m_clang_type = void_clang_type.AddVolatileModifier();
break;
case eEncodingIsTypedefUID:
- m_clang_type = ClangASTContext::CreateTypedefType (void_clang_type,
- GetName().AsCString(),
- GetSymbolFile()->GetDeclContextContainingUID(GetID()));
+ m_clang_type = void_clang_type.CreateTypedef(GetName().AsCString(),
+ GetSymbolFile()->GetDeclContextContainingUID(GetID()));
break;
case eEncodingIsPointerUID:
@@ -580,11 +583,11 @@ Type::ResolveClangType (ResolveState cla
break;
case eEncodingIsLValueReferenceUID:
- m_clang_type = ClangASTContext::GetLValueReferenceType(void_clang_type);
+ m_clang_type = void_clang_type.GetLValueReferenceType();
break;
case eEncodingIsRValueReferenceUID:
- m_clang_type = ClangASTContext::GetRValueReferenceType(void_clang_type);
+ m_clang_type = void_clang_type.GetRValueReferenceType();
break;
default:
@@ -676,12 +679,6 @@ Type::GetForwardCompilerType ()
return m_clang_type;
}
-ClangASTContext &
-Type::GetClangASTContext ()
-{
- return m_symbol_file->GetClangASTContext();
-}
-
int
Type::Compare(const Type &a, const Type &b)
{
@@ -1135,7 +1132,7 @@ TypeImpl::GetReferenceType () const
{
if (m_dynamic_type.IsValid())
{
- return TypeImpl(m_static_type.GetReferenceType(), ClangASTContext::GetLValueReferenceType(m_dynamic_type));
+ return TypeImpl(m_static_type.GetReferenceType(), m_dynamic_type.GetLValueReferenceType());
}
return TypeImpl(m_static_type.GetReferenceType());
}
Modified: lldb/trunk/source/Symbol/TypeSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeSystem.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/TypeSystem.cpp (original)
+++ lldb/trunk/source/Symbol/TypeSystem.cpp Thu Sep 17 17:23:34 2015
@@ -8,6 +8,9 @@
#include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Symbol/CompilerType.h"
+
using namespace lldb_private;
TypeSystem::TypeSystem(LLVMCastKind kind) :
@@ -19,3 +22,61 @@ TypeSystem::TypeSystem(LLVMCastKind kind
TypeSystem::~TypeSystem()
{
}
+
+lldb::TypeSystemSP
+TypeSystem::CreateInstance (lldb::LanguageType language, const lldb_private::ArchSpec &arch)
+{
+ uint32_t i = 0;
+ TypeSystemCreateInstance create_callback;
+ while ((create_callback = PluginManager::GetTypeSystemCreateCallbackAtIndex (i++)) != nullptr)
+ {
+ lldb::TypeSystemSP type_system_sp = create_callback(language, arch);
+ if (type_system_sp)
+ return type_system_sp;
+ }
+
+ return lldb::TypeSystemSP();
+}
+
+CompilerType
+TypeSystem::GetLValueReferenceType (void *type)
+{
+ return CompilerType();
+}
+
+CompilerType
+TypeSystem::GetRValueReferenceType (void *type)
+{
+ return CompilerType();
+}
+
+CompilerType
+TypeSystem::AddConstModifier (void *type)
+{
+ return CompilerType();
+}
+
+CompilerType
+TypeSystem::AddVolatileModifier (void *type)
+{
+ return CompilerType();
+}
+
+CompilerType
+TypeSystem::AddRestrictModifier (void *type)
+{
+ return CompilerType();
+}
+
+CompilerType
+TypeSystem::CreateTypedef (void *type, const char *name, const CompilerDeclContext &decl_ctx)
+{
+ return CompilerType();
+}
+
+CompilerType
+TypeSystem::GetBuiltinTypeByName (const ConstString &name)
+{
+ return CompilerType();
+}
+
Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Thu Sep 17 17:23:34 2015
@@ -22,6 +22,7 @@
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/Process.h"
@@ -36,20 +37,17 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// Variable constructor
//----------------------------------------------------------------------
-Variable::Variable
-(
- lldb::user_id_t uid,
- const char *name,
- const char *mangled, // The mangled or fully qualified name of the variable.
- const lldb::SymbolFileTypeSP &symfile_type_sp,
- ValueType scope,
- SymbolContextScope *context,
- Declaration* decl_ptr,
- const DWARFExpression& location,
- bool external,
- bool artificial,
- bool static_member
-) :
+Variable::Variable (lldb::user_id_t uid,
+ const char *name,
+ const char *mangled, // The mangled or fully qualified name of the variable.
+ const lldb::SymbolFileTypeSP &symfile_type_sp,
+ ValueType scope,
+ SymbolContextScope *context,
+ Declaration* decl_ptr,
+ const DWARFExpression& location,
+ bool external,
+ bool artificial,
+ bool static_member) :
UserID(uid),
m_name(name),
m_mangled (ConstString(mangled)),
Modified: lldb/trunk/source/Target/ThreadPlanTracer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTracer.cpp?rev=247953&r1=247952&r2=247953&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanTracer.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanTracer.cpp Thu Sep 17 17:23:34 2015
@@ -135,12 +135,9 @@ ThreadPlanAssemblyTracer::GetIntPointerT
TargetSP target_sp (m_thread.CalculateTarget());
if (target_sp)
{
- Module *exe_module = target_sp->GetExecutableModulePointer();
-
- if (exe_module)
- {
- m_intptr_type = TypeFromUser(exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, target_sp->GetArchitecture().GetAddressByteSize() * 8));
- }
+ TypeSystem *type_system = target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC);
+ if (type_system)
+ m_intptr_type = TypeFromUser(type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, target_sp->GetArchitecture().GetAddressByteSize() * 8));
}
}
return m_intptr_type;
More information about the lldb-commits
mailing list