Skip to content

release/20.x: [clang][Interpreter] Disable part of lambda test on Windows #143851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion clang/lib/Interpreter/IncrementalParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void IncrementalParser::CleanUpPTU(TranslationUnitDecl *MostRecentTU) {
// FIXME: We should de-allocate MostRecentTU
for (Decl *D : MostRecentTU->decls()) {
auto *ND = dyn_cast<NamedDecl>(D);
if (!ND)
if (!ND || ND->getDeclName().isEmpty())
continue;
// Check if we need to clean up the IdResolver chain.
if (ND->getDeclName().getFETokenInfo() && !D->getLangOpts().ObjC &&
Expand Down
17 changes: 15 additions & 2 deletions clang/test/Interpreter/lambda.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// REQUIRES: host-supports-jit
// UNSUPPORTED: system-aix
// RUN: cat %s | clang-repl | FileCheck %s
// RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s
// At -O2, somehow "x = 42" appears first when piped into FileCheck,
// see https://github.com/llvm/llvm-project/issues/143547.
// RUN: %if !system-windows %{ cat %s | clang-repl -Xcc -Xclang -Xcc -verify -Xcc -O2 | FileCheck %s %}

extern "C" int printf(const char *, ...);

auto l1 = []() { printf("ONE\n"); return 42; };
Expand All @@ -14,4 +17,14 @@ auto r2 = l2();
auto r3 = l2();
// CHECK: TWO

%quit
// Verify non-local lambda capture error is correctly reported
int x = 42;

// expected-error {{non-local lambda expression cannot have a capture-default}}
auto capture = [&]() { return x * 2; };

// Ensure interpreter continues and x is still valid
printf("x = %d\n", x);
// CHECK: x = 42

%quit
Loading