summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-08-04 01:02:13 +0000
committerSean Callanan <scallanan@apple.com>2010-08-04 01:02:13 +0000
commit5666b674f3df791d0ee8dc964e8c6a12e68a13b4 (patch)
tree2f32879db73f276d9760c756f3a2c147299e6b37 /lldb/source
parent66a8759400a96640b66b83f1acc53e37a7713fed (diff)
downloadbcm5719-llvm-5666b674f3df791d0ee8dc964e8c6a12e68a13b4.tar.gz
bcm5719-llvm-5666b674f3df791d0ee8dc964e8c6a12e68a13b4.zip
Added support for accessing members of C++ objects,
including superclass members. This involved ensuring that access control was ignored, and ensuring that the operands of BitCasts were properly scanned for variables that needed importing. Also laid the groundwork for declaring objects of custom types; however, this functionality is disabled for now because of a potential loop in ASTImporter. llvm-svn: 110174
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp19
-rw-r--r--lldb/source/Expression/ClangExpression.cpp1
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp19
-rw-r--r--lldb/source/Expression/IRForTarget.cpp6
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp11
5 files changed, 54 insertions, 2 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index 3f83acf4b8a..f914728898d 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -162,3 +162,22 @@ clang::NamedDecl *NameSearchContext::AddGenericFunDecl()
return AddFunDecl(generic_function_type.getAsOpaquePtr());
}
+
+clang::NamedDecl *NameSearchContext::AddTypeDecl(void *type)
+{
+ QualType QT = QualType::getFromOpaquePtr(type);
+ clang::Type *T = QT.getTypePtr();
+
+ if (TagType *tag_type = dyn_cast<clang::TagType>(T))
+ {
+ TagDecl *tag_decl = tag_type->getDecl();
+
+ Decls.push_back(tag_decl);
+
+ return tag_decl;
+ }
+ else
+ {
+ return NULL;
+ }
+}
diff --git a/lldb/source/Expression/ClangExpression.cpp b/lldb/source/Expression/ClangExpression.cpp
index 0ff4c38f2fc..0e103b65efb 100644
--- a/lldb/source/Expression/ClangExpression.cpp
+++ b/lldb/source/Expression/ClangExpression.cpp
@@ -238,6 +238,7 @@ ClangExpression::CreateCompilerInstance (bool &IsAST)
m_clang_ap->getLangOpts().CPlusPlus = true;
m_clang_ap->getLangOpts().ObjC1 = true;
m_clang_ap->getLangOpts().ThreadsafeStatics = false;
+ m_clang_ap->getLangOpts().AccessControl = false; // Debuggers get universal access
// Set CodeGen options
m_clang_ap->getCodeGenOpts().EmitDeclMetadata = true;
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index ff54250d9b7..60b23c8a24b 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -679,6 +679,13 @@ ClangExpressionDeclMap::GetDecls(NameSearchContext &context,
if (var)
AddOneVariable(context, var);
+
+ /* Commented out pending resolution of a loop when the TagType is imported
+ lldb::TypeSP type = m_sym_ctx->FindTypeByName(name_cs);
+
+ if (type.get())
+ AddOneType(context, type.get());
+ */
}
Value *
@@ -886,3 +893,15 @@ ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
if (log)
log->Printf("Found function %s, returned (NamedDecl)%p", context.Name.getAsString().c_str(), fun_decl);
}
+
+void
+ClangExpressionDeclMap::AddOneType(NameSearchContext &context,
+ Type *type)
+{
+ TypeFromUser ut(type->GetOpaqueClangQualType(),
+ type->GetClangAST());
+
+ void *copied_type = ClangASTContext::CopyType(context.GetASTContext(), ut.GetASTContext(), ut.GetOpaqueQualType());
+
+ context.AddTypeDecl(copied_type);
+}
diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp
index 63752e161b5..4f3a740e0bb 100644
--- a/lldb/source/Expression/IRForTarget.cpp
+++ b/lldb/source/Expression/IRForTarget.cpp
@@ -249,8 +249,12 @@ IRForTarget::MaybeHandleVariable(Module &M,
if (ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(V))
{
- if (constant_expr->getOpcode() == Instruction::GetElementPtr)
+ switch (constant_expr->getOpcode())
{
+ default:
+ break;
+ case Instruction::GetElementPtr:
+ case Instruction::BitCast:
Value *s = constant_expr->getOperand(0);
MaybeHandleVariable(M, s, Store);
}
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index a045d1849f7..ff2ce8738a1 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -403,9 +403,18 @@ SymbolContext::FindVariableByName (const char *name) const
}
lldb::TypeSP
-SymbolContext::FindTypeByName (const char *name) const
+SymbolContext::FindTypeByName (const ConstString &name) const
{
lldb::TypeSP return_value;
+
+ TypeList types;
+
+ if (module_sp && module_sp->FindTypes (*this, name, false, 1, types))
+ return types.GetTypeAtIndex(0);
+
+ if (!return_value.get() && target_sp && target_sp->GetImages().FindTypes (*this, name, false, 1, types))
+ return types.GetTypeAtIndex(0);
+
return return_value;
}
OpenPOWER on IntegriCloud