summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Language/CPlusPlus
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-11-30 10:16:54 +0000
committerPavel Labath <labath@google.com>2017-11-30 10:16:54 +0000
commitf59056ff93e874b9dde711a26745b648c4d88bab (patch)
treefb1064bbcd97a623fc1a039bafa63ee5e78c0e42 /lldb/source/Plugins/Language/CPlusPlus
parentda34247a6aac509f994c57b727a60daf23023e29 (diff)
downloadbcm5719-llvm-f59056ff93e874b9dde711a26745b648c4d88bab.tar.gz
bcm5719-llvm-f59056ff93e874b9dde711a26745b648c4d88bab.zip
Fix assertion in ClangASTContext
Summary: llvm::APSInt(0) asserts because it creates an int with bit-width 0 and not (as I thought) a value 0. Theoretically it should be sufficient to change this to APSInt(1), as the intention there was that the value of the first argument should be ignored if the type is invalid, but that would look dodgy. Instead, I use llvm::Optional to denote an invalid value and use a special struct instead of a std::pair, to reduce typing and increase clarity. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D40615 llvm-svn: 319414
Diffstat (limited to 'lldb/source/Plugins/Language/CPlusPlus')
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
index 282a8de9cbb..0cdb0b26cf3 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
@@ -59,10 +59,8 @@ bool BitsetFrontEnd::Update() {
size_t capping_size = target_sp->GetMaximumNumberOfChildrenToDisplay();
size_t size = 0;
- auto value_and_type =
- m_backend.GetCompilerType().GetIntegralTemplateArgument(0);
- if (value_and_type.second)
- size = value_and_type.first.getLimitedValue(capping_size);
+ if (auto arg = m_backend.GetCompilerType().GetIntegralTemplateArgument(0))
+ size = arg->value.getLimitedValue(capping_size);
m_elements.assign(size, ValueObjectSP());
OpenPOWER on IntegriCloud