Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit '60bb2707f53c' from swift/release/5.4 into swift/main
- Loading branch information
Showing
17 changed files
with
266 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ands/expression/import-std-module/forward_decl_from_module/root/usr/include/c++/v1/vector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include "libc_header.h" | ||
#include "stdio.h" | ||
|
||
namespace std { | ||
inline namespace __1 { | ||
|
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
lldb/test/API/commands/expression/import-std-module/missing-module-sources/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# We don't have any standard include directories, so we can't | ||
# parse the test_common.h header we usually inject as it includes | ||
# system headers. | ||
NO_TEST_COMMON_H := 1 | ||
|
||
# Take the libc++ from the build directory (which will be later deleted). | ||
CXXFLAGS_EXTRAS = -I $(BUILDDIR)/root/usr/include/c++/v1/ -I $(BUILDDIR)/root/usr/include/ -nostdinc -nostdinc++ | ||
CXX_SOURCES := main.cpp | ||
|
||
include Makefile.rules |
60 changes: 60 additions & 0 deletions
60
...mmands/expression/import-std-module/missing-module-sources/TestStdModuleSourcesMissing.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
""" | ||
Check that missing module source files are correctly handled by LLDB. | ||
""" | ||
|
||
from lldbsuite.test.decorators import * | ||
from lldbsuite.test.lldbtest import * | ||
from lldbsuite.test import lldbutil | ||
import os | ||
import shutil | ||
|
||
|
||
class TestCase(TestBase): | ||
|
||
mydir = TestBase.compute_mydir(__file__) | ||
|
||
# We only emulate a fake libc++ in this test and don't use the real libc++, | ||
# but we still add the libc++ category so that this test is only run in | ||
# test configurations where libc++ is actually supposed to be tested. | ||
@add_test_categories(["libc++"]) | ||
@skipIf(compiler=no_match("clang")) | ||
def test(self): | ||
# The path to our temporary target root that contains the temporary | ||
# module sources. | ||
target_sysroot = self.getBuildArtifact("root") | ||
|
||
# Copy the sources to the root. | ||
shutil.copytree(self.getSourcePath("root"), target_sysroot) | ||
# Build the binary with the copied sources. | ||
self.build() | ||
# Delete the copied sources so that they are now unavailable. | ||
shutil.rmtree(target_sysroot) | ||
|
||
# Set the sysroot where our dummy libc++ used to exist. Just to make | ||
# sure we don't find some existing headers on the system that could | ||
# XPASS this test. | ||
self.runCmd("platform select --sysroot '" + target_sysroot + "' host") | ||
|
||
lldbutil.run_to_source_breakpoint(self, | ||
"// Set break point at this line.", | ||
lldb.SBFileSpec("main.cpp")) | ||
|
||
# Import the std C++ module and run an expression. | ||
# As we deleted the sources, LLDB should refuse the load the module | ||
# and just print the normal error we get from the expression. | ||
self.runCmd("settings set target.import-std-module true") | ||
self.expect("expr v.unknown_identifier", error=True, | ||
substrs=["no member named 'unknown_identifier'"]) | ||
# Check that there is no confusing error about failing to build the | ||
# module. | ||
self.expect("expr v.unknown_identifier", error=True, matching=False, | ||
substrs=["could not build module 'std'"]) | ||
|
||
# Test the fallback mode. It should also just print the normal | ||
# error but not mention a failed module build. | ||
self.runCmd("settings set target.import-std-module fallback") | ||
|
||
self.expect("expr v.unknown_identifier", error=True, | ||
substrs=["no member named 'unknown_identifier'"]) | ||
self.expect("expr v.unknown_identifier", error=True, matching=False, | ||
substrs=["could not build module 'std'"]) |
8 changes: 8 additions & 0 deletions
8
lldb/test/API/commands/expression/import-std-module/missing-module-sources/main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <vector> | ||
|
||
int main(int argc, char **argv) { | ||
// Makes sure we have the mock libc headers in the debug information. | ||
libc_struct s; | ||
std::vector<int> v; | ||
return 0; // Set break point at this line. | ||
} |
3 changes: 3 additions & 0 deletions
3
...ression/import-std-module/missing-module-sources/root/usr/include/c++/v1/module.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module std { | ||
module "vector" { header "vector" export * } | ||
} |
9 changes: 9 additions & 0 deletions
9
...mmands/expression/import-std-module/missing-module-sources/root/usr/include/c++/v1/vector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "stdio.h" | ||
|
||
namespace std { | ||
inline namespace __1 { | ||
template<typename T> | ||
struct vector { | ||
}; | ||
} | ||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../test/API/commands/expression/import-std-module/sysroot/root/usr/include/c++/v1/algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
1 change: 1 addition & 0 deletions
1
lldb/test/API/commands/expression/import-std-module/sysroot/root/usr/include/stdio.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
struct libc_struct {}; |
Oops, something went wrong.