diff options
author | Sean Callanan <scallanan@apple.com> | 2011-11-18 03:28:09 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2011-11-18 03:28:09 +0000 |
commit | 00f43622e17752f756b216da1c976e0dc2d95722 (patch) | |
tree | fb1885154cea14d62e9482a77865b1b93c5a38f0 /lldb/source/Expression/IRForTarget.cpp | |
parent | 1ec141d0f9e434136b2d901efd0104c9283a2747 (diff) | |
download | bcm5719-llvm-00f43622e17752f756b216da1c976e0dc2d95722.tar.gz bcm5719-llvm-00f43622e17752f756b216da1c976e0dc2d95722.zip |
This commit completes the rearchitecting of ClangASTSource
to allow variables in the persistent variable store to know
how to complete themselves from debug information. That
fixes a variety of bugs during dematerialization of
expression results and also makes persistent variable and
result variables ($foo, $4, ...) more useful.
I have also added logging improvements that make it much
easier to figure out how types are moving from place to
place, and made some checking a little more aggressive.
The commit includes patches to Clang which are currently being
integrated into Clang proper; once these fixes are in Clang
top-of-tree, these patches will be removed. The patches don't
fix API; rather, they fix some internal bugs in Clang's
ASTImporter that were exposed when LLDB was moving types from
place to place multiple times.
llvm-svn: 144969
Diffstat (limited to 'lldb/source/Expression/IRForTarget.cpp')
-rw-r--r-- | lldb/source/Expression/IRForTarget.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index ba8df143246..ef3fa767614 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -647,12 +647,25 @@ IRForTarget::CreateResultVariable (llvm::Function &llvm_function) clang::QualType element_qual_type = pointer_pointertype->getPointeeType(); m_result_type = lldb_private::TypeFromParser(element_qual_type.getAsOpaquePtr(), - &result_decl->getASTContext()); + &result_decl->getASTContext()); } else { m_result_type = lldb_private::TypeFromParser(result_var->getType().getAsOpaquePtr(), - &result_decl->getASTContext()); + &result_decl->getASTContext()); + } + + if (m_result_type.GetClangTypeBitWidth() == 0) + { + lldb_private::StreamString type_desc_stream; + m_result_type.DumpTypeDescription(&type_desc_stream); + + if (log) + log->Printf("Result type has size 0"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Result type '%s' has invalid size\n", + type_desc_stream.GetData()); } if (log) @@ -660,13 +673,15 @@ IRForTarget::CreateResultVariable (llvm::Function &llvm_function) lldb_private::StreamString type_desc_stream; m_result_type.DumpTypeDescription(&type_desc_stream); - log->Printf("Result decl type: \"%s\"", type_desc_stream.GetString().c_str()); + log->Printf("Result decl type: \"%s\"", type_desc_stream.GetData()); } m_result_name = m_decl_map->GetPersistentResultName(); if (log) - log->Printf("Creating a new result global: \"%s\"", m_result_name.GetCString()); + log->Printf("Creating a new result global: \"%s\" with size 0x%x", + m_result_name.GetCString(), + m_result_type.GetClangTypeBitWidth() / 8); // Construct a new result global and set up its metadata @@ -755,11 +770,12 @@ IRForTarget::CreateResultVariable (llvm::Function &llvm_function) } if (!m_const_result) - m_decl_map->AddPersistentVariable(result_decl, - m_result_name, - m_result_type, - true, - m_result_is_pointer); + if (!m_decl_map->AddPersistentVariable(result_decl, + m_result_name, + m_result_type, + true, + m_result_is_pointer)) + return false; result_global->eraseFromParent(); |