From 82a827de3ba5a907d72508758269eb075f533322 Mon Sep 17 00:00:00 2001 From: Marianne Mailhot-Sarrasin Date: Thu, 10 Mar 2016 22:10:59 +0000 Subject: [PATCH] Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union When the parent of an expression is anonymous, skip adding '.' or '->' before the expression name. Differential Revision: http://reviews.llvm.org/D18005 llvm-svn: 263166 --- .../lldbsuite/test/lang/c/anonymous/TestAnonymous.py | 11 +++++++++++ lldb/source/Core/ValueObject.cpp | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py b/lldb/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py index 2d1367c6ace4..e6f1092c702a 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py @@ -112,6 +112,17 @@ class AnonymousTestCase(TestBase): if not error.Success() or value != 0: self.fail ("failed to get the correct value for element a in n") + def test_nest_flat(self): + self.build() + self.common_setup(self.line2) + + # These should display correctly. + self.expect('frame variable n --flat', + substrs = ['n.a = 0', + 'n.b = 2', + 'n.foo.c = 0', + 'n.foo.d = 4']) + def setUp(self): # Call super's setUp(). TestBase.setUp(self) diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index ff033d66bf2f..075f031d4673 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -2536,7 +2536,7 @@ ValueObject::GetExpressionPath (Stream &s, bool qualify_cxx_base_classes, GetExp if (!is_deref_of_parent) { ValueObject *non_base_class_parent = GetNonBaseClassParent(); - if (non_base_class_parent) + if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty()) { CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType(); if (non_base_class_parent_compiler_type)