diff options
author | Shafik Yaghmour <syaghmour@apple.com> | 2019-01-30 21:48:56 +0000 |
---|---|---|
committer | Shafik Yaghmour <syaghmour@apple.com> | 2019-01-30 21:48:56 +0000 |
commit | 1849dd4accb7ab87104c257da41e2638cf7fe71b (patch) | |
tree | 1ba2e08af0b66e86bdc933ffd13f00ad99525793 /lldb/packages/Python/lldbsuite/test | |
parent | ee7e4cf48f1798580f07033e5c6d207c1aba6b48 (diff) | |
download | bcm5719-llvm-1849dd4accb7ab87104c257da41e2638cf7fe71b.tar.gz bcm5719-llvm-1849dd4accb7ab87104c257da41e2638cf7fe71b.zip |
Fix handling of CreateTemplateParameterList when there is an empty pack
Summary:
When we are creating a ClassTemplateSpecializationDecl in ParseTypeFromDWARF(...) we are not handling the case where variadic pack is empty in the specialization. This patch handles that case and adds a test to prevent future regressions.
Differential Revision: https://reviews.llvm.org/D57363
llvm-svn: 352677
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
3 files changed, 37 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/Makefile b/lldb/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/Makefile new file mode 100644 index 00000000000..8a7102e347a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py b/lldb/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py new file mode 100644 index 00000000000..d1974d05a24 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py @@ -0,0 +1,23 @@ +""" +Test Expression Parser code gen for ClassTemplateSpecializationDecl to insure +that we generate a TemplateTypeParmDecl in the TemplateParameterList for empty +variadic packs. +""" + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class TestClassTemplateSpecializationParametersHandling(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def test_class_template_specialization(self): + self.build() + + lldbutil.run_to_source_breakpoint(self, '// break here', + lldb.SBFileSpec("main.cpp", False)) + + self.expect("expr -u 0 -- b.foo()", substrs=['$0 = 1']) diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/main.cpp b/lldb/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/main.cpp new file mode 100644 index 00000000000..bc831604aed --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/main.cpp @@ -0,0 +1,9 @@ +template <typename N, class... P> +struct A { + int foo() { return 1;} +}; + +int main() { + A<int> b; + return b.foo(); // break here +} |