diff options
author | Shafik Yaghmour <syaghmour@apple.com> | 2018-11-08 18:42:00 +0000 |
---|---|---|
committer | Shafik Yaghmour <syaghmour@apple.com> | 2018-11-08 18:42:00 +0000 |
commit | 8c5ec1ff4653ff4011c5228f8fbdc800ebe35456 (patch) | |
tree | bfce6fb0f380e8553093573b1ea12d363425af0d /lldb/packages/Python/lldbsuite/test | |
parent | 7a44fe956a249585187cd5f82a0683dc117e0ae8 (diff) | |
download | bcm5719-llvm-8c5ec1ff4653ff4011c5228f8fbdc800ebe35456.tar.gz bcm5719-llvm-8c5ec1ff4653ff4011c5228f8fbdc800ebe35456.zip |
Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter.
rdar://problem/43822994
Differential Revision: https://reviews.llvm.org/D54003
llvm-svn: 346428
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
3 files changed, 66 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile b/lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile new file mode 100644 index 00000000000..83b24da17b4 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile @@ -0,0 +1,6 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp +CXXFLAGS += -std=c++11 + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py b/lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py new file mode 100644 index 00000000000..c900ba7979b --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py @@ -0,0 +1,44 @@ +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ExprXValuePrintingTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def test(self): + self.build() + + self.main_source = "main.cpp" + self.main_source_spec = lldb.SBFileSpec(self.main_source) + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + '// Set break point at this line.', self.main_source_spec) + frame = thread.GetFrameAtIndex(0) + + self.expect("expr f == Foo::FooBar", + substrs=['(bool) $0 = true']) + + value = frame.EvaluateExpression("f == Foo::FooBar") + self.assertTrue(value.IsValid()) + self.assertTrue(value.GetError().Success()) + self.assertEqual(value.GetValueAsUnsigned(), 1) + + value = frame.EvaluateExpression("b == BarBar") + self.assertTrue(value.IsValid()) + self.assertTrue(value.GetError().Success()) + self.assertEqual(value.GetValueAsUnsigned(), 1) + + ## b is not a Foo + value = frame.EvaluateExpression("b == Foo::FooBar") + self.assertTrue(value.IsValid()) + self.assertFalse(value.GetError().Success()) + + ## integral is not implicitly convertible to a scoped enum + value = frame.EvaluateExpression("1 == Foo::FooBar") + self.assertTrue(value.IsValid()) + self.assertFalse(value.GetError().Success()) diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp b/lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp new file mode 100644 index 00000000000..b0d67d23dc5 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp @@ -0,0 +1,16 @@ +enum class Foo { + FooBar = 42 +}; + +enum Bar { + BarBar = 3, + BarBarBar = 42 +}; + +int main(int argc, const char **argv) { + Foo f = Foo::FooBar; + Bar b = BarBar; + bool b1 = f == Foo::FooBar; + bool b2 = b == BarBar; + return 0; // Set break point at this line. +} |