diff options
author | Enrico Granata <egranata@apple.com> | 2015-12-18 22:41:25 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2015-12-18 22:41:25 +0000 |
commit | 36f51e4c9724715cceedffc68733345438b464f4 (patch) | |
tree | e6b51c2c59931df2496fe202f638196e011459d8 /lldb/packages/Python/lldbsuite/test | |
parent | be2cfb26d34f6e04eca71fe46126e15b1cfe0d71 (diff) | |
download | bcm5719-llvm-36f51e4c9724715cceedffc68733345438b464f4.tar.gz bcm5719-llvm-36f51e4c9724715cceedffc68733345438b464f4.zip |
Add support for seeing through clang::AutoType in ClangASTContext
This allows LLDB to deal correctly with expression result variables declared via the C++11 'auto' keyword
rdar://problem/23960490
llvm-svn: 256051
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
3 files changed, 45 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile new file mode 100644 index 00000000000..314f1cb2f07 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py new file mode 100644 index 00000000000..e3f7fb1618a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py @@ -0,0 +1,24 @@ +""" +Tests that auto types work +""" +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class CPPAutoTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def test_with_run_command(self): + """Test that auto types work in the expression parser""" + self.build() + self.runCmd("file 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/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp new file mode 100644 index 00000000000..76fb95e0a34 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp @@ -0,0 +1,16 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include <string> + +int main() +{ + std::string helloworld("hello world"); + return 0; // break here +} |