diff options
| author | Greg Clayton <gclayton@apple.com> | 2011-07-09 20:12:33 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2011-07-09 20:12:33 +0000 |
| commit | daf515fc8ac69bdb1f964bbe61291b99b104222b (patch) | |
| tree | d10993dd6eebe90155db15fce4306ea975f0ed03 /lldb/source/Symbol/ClangASTContext.cpp | |
| parent | d8d3c1b8f3f35ab6e693ad994b926236abd3bf82 (diff) | |
| download | bcm5719-llvm-daf515fc8ac69bdb1f964bbe61291b99b104222b.tar.gz bcm5719-llvm-daf515fc8ac69bdb1f964bbe61291b99b104222b.zip | |
Fixed the global and static variables to always be in scope.
Made it so that you can create synthetic children of array
value objects. This is for creating array members when the
array index is out of range. This comes in handy when you have
a structure definition like:
struct Collection
{
uint32_t count;
Item array[0];
};
"array" has 1 item, but many times in practice there are more
items in "item_array".
This allows you to do:
(lldb) target variable g_collection.array[3]
To implement this, the get child at index has been modified
to have a "ignore_array_bounds" boolean that can be set to true.
llvm-svn: 134846
Diffstat (limited to 'lldb/source/Symbol/ClangASTContext.cpp')
| -rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 88a3d86a770..6e3a83e162c 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -2460,6 +2460,7 @@ ClangASTContext::GetChildClangTypeAtIndex uint32_t idx, bool transparent_pointers, bool omit_empty_base_classes, + bool ignore_array_bounds, std::string& child_name, uint32_t &child_byte_size, int32_t &child_byte_offset, @@ -2478,6 +2479,7 @@ ClangASTContext::GetChildClangTypeAtIndex idx, transparent_pointers, omit_empty_base_classes, + ignore_array_bounds, child_name, child_byte_size, child_byte_offset, @@ -2498,6 +2500,7 @@ ClangASTContext::GetChildClangTypeAtIndex uint32_t idx, bool transparent_pointers, bool omit_empty_base_classes, + bool ignore_array_bounds, std::string& child_name, uint32_t &child_byte_size, int32_t &child_byte_offset, @@ -2736,6 +2739,7 @@ ClangASTContext::GetChildClangTypeAtIndex idx, transparent_pointers, omit_empty_base_classes, + ignore_array_bounds, child_name, child_byte_size, child_byte_offset, @@ -2771,7 +2775,7 @@ ClangASTContext::GetChildClangTypeAtIndex const ConstantArrayType *array = cast<ConstantArrayType>(parent_qual_type.getTypePtr()); const uint64_t element_count = array->getSize().getLimitedValue(); - if (idx < element_count) + if (ignore_array_bounds || idx < element_count) { if (GetCompleteQualType (ast, array->getElementType())) { @@ -2783,7 +2787,7 @@ ClangASTContext::GetChildClangTypeAtIndex child_name.assign(element_name); assert(field_type_info.first % 8 == 0); child_byte_size = field_type_info.first / 8; - child_byte_offset = idx * child_byte_size; + child_byte_offset = (int32_t)idx * (int32_t)child_byte_size; return array->getElementType().getAsOpaquePtr(); } } @@ -2810,6 +2814,7 @@ ClangASTContext::GetChildClangTypeAtIndex idx, transparent_pointers, omit_empty_base_classes, + ignore_array_bounds, child_name, child_byte_size, child_byte_offset, @@ -2858,6 +2863,7 @@ ClangASTContext::GetChildClangTypeAtIndex idx, transparent_pointers, omit_empty_base_classes, + ignore_array_bounds, child_name, child_byte_size, child_byte_offset, @@ -2895,6 +2901,7 @@ ClangASTContext::GetChildClangTypeAtIndex idx, transparent_pointers, omit_empty_base_classes, + ignore_array_bounds, child_name, child_byte_size, child_byte_offset, |

