summaryrefslogtreecommitdiffstats
path: root/lldb/include/lldb
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-12-02 00:43:32 +0000
committerGreg Clayton <gclayton@apple.com>2015-12-02 00:43:32 +0000
commit5dfc4a4d0271e9b919702b7a638bb4ee624ec940 (patch)
treef5f58ea734c0d206886cfc43e24df14dc7fe8ae1 /lldb/include/lldb
parentf3be9d5c0ba0731a16797e2b823f2eddcb1e36a1 (diff)
downloadbcm5719-llvm-5dfc4a4d0271e9b919702b7a638bb4ee624ec940.tar.gz
bcm5719-llvm-5dfc4a4d0271e9b919702b7a638bb4ee624ec940.zip
Added support for -gmodule debugging when debug info is left in the .o files on Darwin.
This is done by finding the types that are forward declarations that come from a module, and loading that module's debug info in a separate lldb_private::Module, and copying the type over into the current module using a ClangASTImporter object. ClangASTImporter objects are already used to copy types from on clang::ASTContext to another for expressions so the type copying code has been around for a while. A new FindTypes variant was added to SymbolVendor and SymbolFile: size_t SymbolVendor::FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types); size_t SymbolVendor::FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types); The CompilerContext is a way to represent the exact context of a type and pass it through an agnostic API boundary so that we can find that exact context elsewhere in another file. This was required here because we can have a module that has submodules, both of which have a "foo" type. I am not able to add tests for this yet as we currently don't build our C/C++/ObjC binaries with the clang binary that we build. There are some driver issues where it can't find the header files for the C and C++ standard library which makes compiling these tests hard. We can't also guarantee that if we are building with clang that it supporst the exact format of -gmodule debugging that we are trying to test. We have had other versions of clang that had a different implementation of -gmodule debugging that we are no longer supporting, so we can't enable tests if we are building with clang without compiling something and looking at the structure of the DWARF that was generated to ensure that it is the format we can actually use. llvm-svn: 254476
Diffstat (limited to 'lldb/include/lldb')
-rw-r--r--lldb/include/lldb/Symbol/ClangASTContext.h31
-rw-r--r--lldb/include/lldb/Symbol/ClangASTImporter.h11
-rw-r--r--lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h5
-rw-r--r--lldb/include/lldb/Symbol/SymbolFile.h3
-rw-r--r--lldb/include/lldb/Symbol/SymbolVendor.h3
-rw-r--r--lldb/include/lldb/Symbol/Type.h28
-rw-r--r--lldb/include/lldb/lldb-forward.h1
-rw-r--r--lldb/include/lldb/lldb-private-enumerations.h19
8 files changed, 91 insertions, 10 deletions
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h
index 738d450a81d..c112c5e4a95 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -1006,10 +1006,18 @@ public:
lldb::AccessType access,
bool is_artificial);
- bool
+ static bool
SetHasExternalStorage (lldb::opaque_compiler_type_t type, bool has_extern);
-
+
+ static bool
+ CanImport (const CompilerType &type, lldb_private::ClangASTImporter &importer);
+
+ static bool
+ Import (const CompilerType &type, lldb_private::ClangASTImporter &importer);
+
+ static bool
+ GetHasExternalStorage (const CompilerType &type);
//------------------------------------------------------------------
// Tag Declarations
//------------------------------------------------------------------
@@ -1092,13 +1100,19 @@ public:
void
DumpTypeDescription (lldb::opaque_compiler_type_t type, Stream *s) override;
-
+
+ static void
+ DumpTypeName (const CompilerType &type);
+
static clang::EnumDecl *
GetAsEnumDecl (const CompilerType& type);
static clang::RecordDecl *
GetAsRecordDecl (const CompilerType& type);
-
+
+ static clang::TagDecl *
+ GetAsTagDecl (const CompilerType& type);
+
clang::CXXRecordDecl *
GetAsCXXRecordDecl (lldb::opaque_compiler_type_t type);
@@ -1109,9 +1123,12 @@ public:
GetQualType (const CompilerType& type)
{
// Make sure we have a clang type before making a clang::QualType
- ClangASTContext *ast = llvm::dyn_cast_or_null<ClangASTContext>(type.GetTypeSystem());
- if (ast)
- return clang::QualType::getFromOpaquePtr(type.GetOpaqueQualType());
+ if (type.GetOpaqueQualType())
+ {
+ ClangASTContext *ast = llvm::dyn_cast_or_null<ClangASTContext>(type.GetTypeSystem());
+ if (ast)
+ return clang::QualType::getFromOpaquePtr(type.GetOpaqueQualType());
+ }
return clang::QualType();
}
diff --git a/lldb/include/lldb/Symbol/ClangASTImporter.h b/lldb/include/lldb/Symbol/ClangASTImporter.h
index e5155023a10..8c3f8735c2e 100644
--- a/lldb/include/lldb/Symbol/ClangASTImporter.h
+++ b/lldb/include/lldb/Symbol/ClangASTImporter.h
@@ -107,7 +107,11 @@ public:
CopyType (clang::ASTContext *dst_ctx,
clang::ASTContext *src_ctx,
lldb::opaque_compiler_type_t type);
-
+
+ CompilerType
+ CopyType (ClangASTContext &dst,
+ const CompilerType &src_type);
+
clang::Decl *
CopyDecl (clang::ASTContext *dst_ctx,
clang::ASTContext *src_ctx,
@@ -134,7 +138,10 @@ public:
bool
CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl);
-
+
+ bool
+ CompleteAndFetchChildren (clang::QualType type);
+
bool
RequireCompleteType (clang::QualType type);
diff --git a/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
index bf2018fd48c..5a00aa0072a 100644
--- a/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
+++ b/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
@@ -97,6 +97,11 @@ public:
{
}
+ void
+ FindExternalLexicalDecls(const clang::DeclContext *DC,
+ llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
+ llvm::SmallVectorImpl<clang::Decl *> &Result) override;
+
bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName decl_name) override;
void CompleteType(clang::TagDecl *tag_decl) override;
diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h
index f6c3ac00bcd..3ead79d6fc4 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -15,7 +15,6 @@
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/CompilerDecl.h"
#include "lldb/Symbol/CompilerDeclContext.h"
-
#include "lldb/Symbol/Type.h"
namespace lldb_private {
@@ -142,6 +141,8 @@ public:
virtual uint32_t FindFunctions (const ConstString &name, const CompilerDeclContext *parent_decl_ctx, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list);
virtual uint32_t FindFunctions (const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list);
virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, TypeMap& types);
+ virtual size_t FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types);
+
// virtual uint32_t FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, TypeList& types) = 0;
virtual TypeList * GetTypeList ();
virtual size_t GetTypes (lldb_private::SymbolContextScope *sc_scope,
diff --git a/lldb/include/lldb/Symbol/SymbolVendor.h b/lldb/include/lldb/Symbol/SymbolVendor.h
index e57e8e3d050..c57ac8800c4 100644
--- a/lldb/include/lldb/Symbol/SymbolVendor.h
+++ b/lldb/include/lldb/Symbol/SymbolVendor.h
@@ -128,6 +128,9 @@ public:
size_t max_matches,
TypeMap& types);
+ virtual size_t
+ FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types);
+
virtual CompilerDeclContext
FindNamespace (const SymbolContext& sc,
const ConstString &name,
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index a96a8e2b0a1..224e0a112df 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -24,6 +24,31 @@
namespace lldb_private {
+//----------------------------------------------------------------------
+// CompilerContext allows an array of these items to be passed to
+// perform detailed lookups in SymbolVendor and SymbolFile functions.
+//----------------------------------------------------------------------
+struct CompilerContext
+{
+ CompilerContext (CompilerContextKind t, const ConstString &n) :
+ type(t),
+ name(n)
+ {
+ }
+
+ bool
+ operator == (const CompilerContext &rhs) const
+ {
+ return type == rhs.type && name == rhs.name;
+ }
+
+ void
+ Dump () const;
+
+ CompilerContextKind type;
+ ConstString name;
+};
+
class SymbolFileType :
public std::enable_shared_from_this<SymbolFileType>,
public UserID
@@ -35,6 +60,9 @@ class SymbolFileType :
{
}
+ SymbolFileType (SymbolFile &symbol_file, const lldb::TypeSP &type_sp);
+
+
~SymbolFileType ()
{
}
diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h
index e494b297d11..516f31911c2 100644
--- a/lldb/include/lldb/lldb-forward.h
+++ b/lldb/include/lldb/lldb-forward.h
@@ -62,6 +62,7 @@ class CommandObject;
class CommandReturnObject;
class Communication;
class CompactUnwindInfo;
+struct CompilerContext;
class CompilerDecl;
class CompilerDeclContext;
class CompilerType;
diff --git a/lldb/include/lldb/lldb-private-enumerations.h b/lldb/include/lldb/lldb-private-enumerations.h
index ef69fabd6f1..5f8f96c6da4 100644
--- a/lldb/include/lldb/lldb-private-enumerations.h
+++ b/lldb/include/lldb/lldb-private-enumerations.h
@@ -241,6 +241,25 @@ enum class TypeValidatorResult : bool {
Success = true,
Failure = false
};
+
+//----------------------------------------------------------------------
+// Enumerations that can be used to specify scopes types when looking up
+// types.
+//----------------------------------------------------------------------
+enum class CompilerContextKind
+{
+ Invalid = 0,
+ TranslationUnit,
+ Module,
+ Namespace,
+ Class,
+ Structure,
+ Union,
+ Function,
+ Variable,
+ Enumeration,
+ Typedef
+};
} // namespace lldb_private
OpenPOWER on IntegriCloud