Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,13 @@ bool ClangModulesDeclVendorImpl::AddModule(const SourceModule &module,
}
}

// If we didn't make the submodule visible here, Clang wouldn't allow LLDB to
// pick any of the decls in the submodules during C++ name lookup.
if (submodule)
m_compiler_instance->makeModuleVisible(
submodule, clang::Module::NameVisibilityKind::AllVisible,
/*ImportLoc=*/{});

clang::Module *requested_module = DoGetModule(clang_path, true);

if (requested_module != nullptr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@
class DeclFromSubmoduleTestCase(TestBase):
# Requires DWARF debug info which is not retained when linking with link.exe.
@skipIfWindows
# Lookup for decls in submodules fails in Linux
@expectedFailureAll(oslist=["linux"])
def test_expr(self):
self.build()
lldbutil.run_to_source_breakpoint(self, "return 0", lldb.SBFileSpec("main.cpp"))

# FIXME: LLDB finds the decl for 'func' in the submodules correctly and hands it to Clang
# but Sema rejects using the decl during name lookup because it is not marked "Visible".
# However, this assertions still ensures that we at least don't fail to compile the
# submodule (which would cause other errors to appear before the expression error, hence
# we use "startstr").
self.expect(
"expr func(1, 2)",
error=True,
startstr="error: <user expression 0>:1:1: 'func' has unknown return type",
)
self.expect_expr("func(1, 2)", result_type="int", result_value="3")
self.expect_expr("func(1)", result_type="int", result_value="1")