diff options
author | Adrian Prantl <aprantl@apple.com> | 2019-02-13 18:10:41 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2019-02-13 18:10:41 +0000 |
commit | 0f30a3b68fa8d687d041c8cd69ed8018d1ed0c84 (patch) | |
tree | 8f05ed72a0a93e11e3c6ccfbd601587680fe3273 /lldb/packages/Python/lldbsuite/test | |
parent | 7a290dfe301bd4f1a9d320223b27e46658f653c4 (diff) | |
download | bcm5719-llvm-0f30a3b68fa8d687d041c8cd69ed8018d1ed0c84.tar.gz bcm5719-llvm-0f30a3b68fa8d687d041c8cd69ed8018d1ed0c84.zip |
Deserialize Clang module search path from DWARF
This patch properly extracts the full submodule path as well as its
search paths from DWARF import decls and passes it on to the
ClangModulesDeclVendor.
rdar://problem/47970144
Differential Revision: https://reviews.llvm.org/D58090
llvm-svn: 353961
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
6 files changed, 53 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Bar.h b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Bar.h new file mode 100644 index 00000000000..3d9a88c024d --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Bar.h @@ -0,0 +1 @@ +struct Bar { int success; }; diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Foo.h b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Foo.h new file mode 100644 index 00000000000..1fe02e89786 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Foo.h @@ -0,0 +1 @@ +struct Foo {}; diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Makefile new file mode 100644 index 00000000000..796b4dc5ef3 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Makefile @@ -0,0 +1,6 @@ +LEVEL = ../../../make +CXX_SOURCES := main.cpp + +CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/TestCXXModulesImport.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/TestCXXModulesImport.py new file mode 100644 index 00000000000..9601db2586a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/TestCXXModulesImport.py @@ -0,0 +1,31 @@ +"""Test that importing modules in C++ works as expected.""" + +from __future__ import print_function + + +from distutils.version import StrictVersion +import unittest2 +import os +import time +import lldb +import platform + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class CXXModulesImportTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @skipUnlessDarwin + @skipIf(macos_version=["<", "10.12"]) + def test_expr(self): + self.build() + exe = self.getBuildArtifact("a.out") + target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( + self, 'break here', lldb.SBFileSpec('main.cpp')) + + self.expect("expr -- @import Bar") + self.expect("expr -- Bar()", substrs = ["success"]) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/main.cpp new file mode 100644 index 00000000000..a6acf9a1a69 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/main.cpp @@ -0,0 +1,7 @@ +#include "Foo.h" + +int main(int argc, char **argv) { + Foo foo; + // break here. + return 0; +} diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/module.modulemap b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/module.modulemap new file mode 100644 index 00000000000..4221d0f9134 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/module.modulemap @@ -0,0 +1,7 @@ +module Foo { + header "Foo.h" +} + +module Bar { + header "Bar.h" +} |