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
10 changes: 10 additions & 0 deletions lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,16 @@ ClangASTImporter::MapCompleter::~MapCompleter() = default;

llvm::Expected<Decl *>
ClangASTImporter::ASTImporterDelegate::ImportImpl(Decl *From) {
// FIXME: The Minimal import mode of clang::ASTImporter does not correctly
// import Lambda definitions. Work around this for now by not importing
// lambdas at all. This is most likely encountered when importing decls from
// the `std` module (not from debug-info), where lambdas can be defined in
// inline function bodies. Those will be imported by LLDB.
if (const auto *CXX = llvm::dyn_cast<clang::CXXRecordDecl>(From))
if (CXX->isLambda())
return llvm::make_error<ASTImportError>(
ASTImportError::UnsupportedConstruct);

if (m_std_handler) {
std::optional<Decl *> D = m_std_handler->Import(From);
if (D) {
Expand Down
10 changes: 9 additions & 1 deletion lldb/test/API/lang/cpp/lambdas/TestLambdas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators

lldbinline.MakeInlineTest(__file__, globals())
lldbinline.MakeInlineTest(
__file__,
globals(),
[
decorators.expectedFailureAll(
bugnumber="https://github.com/llvm/llvm-project/issues/149477"
)
],
)
26 changes: 26 additions & 0 deletions lldb/test/Shell/Expr/TestLambdaExprImport.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Test that we can successfully ASTImport clang::LambdaExpr nodes.
# Currently this is not supported in MinimalImport mode (which LLDB
# uses always).

# RUN: split-file %s %t
# RUN: %clang_host -g -gdwarf %t/main.cpp -o %t.out
# RUN: %lldb -o "settings set interpreter.stop-command-source-on-error false" \
# RUN: -x -b -s %t/commands.input %t.out 2>&1 \
# RUN: | FileCheck %s

#--- main.cpp

int main() {
__builtin_debugtrap();
}

#--- commands.input

run
expression --top-level -- void method(int x) { [x=x] { ; }; }
target dump typesystem

# CHECK: expression
# CHECK: target dump typesystem
# CHECK-NOT: FunctionDecl
# CHECK-NOT: LambdaExpr
Loading