summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-08-03 14:33:06 +0000
committerpatrick <patrick@openbsd.org>2020-08-03 14:33:06 +0000
commit061da546b983eb767bad15e67af1174fb0bcf31c (patch)
tree83c78b820819d70aa40c36d90447978b300078c5 /gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto
parentImport LLVM 10.0.0 release including clang, lld and lldb. (diff)
downloadwireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.tar.xz
wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.zip
Import LLVM 10.0.0 release including clang, lld and lldb.
ok hackroom tested by plenty
Diffstat (limited to 'gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto')
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile3
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py41
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp20
3 files changed, 64 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
new file mode 100644
index 00000000000..99998b20bcb
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
new file mode 100644
index 00000000000..fe3a8324348
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
@@ -0,0 +1,41 @@
+"""
+Tests that auto types work
+"""
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class CPPAutoTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @expectedFailureAll(
+ compiler="gcc",
+ bugnumber="GCC generates incomplete debug info")
+ @expectedFailureAll(oslist=['windows'], bugnumber="llvm.org/pr26339")
+ @expectedFailureNetBSD
+ def test_with_run_command(self):
+ """Test that auto types work in the expression parser"""
+ self.build()
+ self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
+
+ line = line_number('main.cpp', '// break here')
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
+
+ self.runCmd("process launch", RUN_SUCCEEDED)
+
+ self.expect('expr auto f = 123456; f', substrs=['int', '123456'])
+ self.expect(
+ 'expr struct Test { int x; int y; Test() : x(123), y(456) {} }; auto t = Test(); t',
+ substrs=[
+ 'Test',
+ '123',
+ '456'])
+ self.expect(
+ 'expr auto s = helloworld; s',
+ substrs=[
+ 'string',
+ 'hello world'])
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp
new file mode 100644
index 00000000000..d411af67911
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp
@@ -0,0 +1,20 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <string>
+
+int main()
+{
+ std::string helloworld("hello world");
+
+ // Ensure std::string copy constructor is present in the binary, as we will
+ // use it in an expression.
+ std::string other = helloworld;
+
+ return 0; // break here
+}