[clang] [Clang] Fix a regression introduced by #140576 (PR #140859)
https://github.com/frederick-vs-ja edited https://github.com/llvm/llvm-project/pull/140859 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Fix a regression introduced by #140576 (PR #140859)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `openmp-offload-amdgpu-runtime-2` running on `rocm-worker-hw-02` while building `clang` at step 6 "test-openmp". Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/5754 Here is the relevant piece of the build log for the reference ``` Step 6 (test-openmp) failure: test (failure) TEST 'libarcher :: races/critical-unrelated.c' FAILED Exit Code: 1 Command Output (stdout): -- # RUN: at line 13 /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/./bin/clang -fopenmp -gdwarf-4 -O1 -fsanitize=thread -I /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/openmp/tools/archer/tests -I /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/runtime/src /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/openmp/tools/archer/tests/races/critical-unrelated.c -o /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/tools/archer/tests/races/Output/critical-unrelated.c.tmp -latomic && env TSAN_OPTIONS='ignore_noninstrumented_modules=0:ignore_noninstrumented_modules=1' /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/openmp/tools/archer/tests/deflake.bash /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/tools/archer/tests/races/Output/critical-unrelated.c.tmp 2>&1 | tee /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/tools/archer/tests/races/Output/critical-unrelated.c.tmp.log | /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/./bin/FileCheck /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/openmp/tools/archer/tests/races/critical-unrelated.c # executed command: /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/./bin/clang -fopenmp -gdwarf-4 -O1 -fsanitize=thread -I /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/openmp/tools/archer/tests -I /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/runtime/src /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/openmp/tools/archer/tests/races/critical-unrelated.c -o /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/tools/archer/tests/races/Output/critical-unrelated.c.tmp -latomic # note: command had no output on stdout or stderr # executed command: env TSAN_OPTIONS=ignore_noninstrumented_modules=0:ignore_noninstrumented_modules=1 /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/openmp/tools/archer/tests/deflake.bash /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/tools/archer/tests/races/Output/critical-unrelated.c.tmp # note: command had no output on stdout or stderr # executed command: tee /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/tools/archer/tests/races/Output/critical-unrelated.c.tmp.log # note: command had no output on stdout or stderr # executed command: /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/./bin/FileCheck /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/openmp/tools/archer/tests/races/critical-unrelated.c # note: command had no output on stdout or stderr # RUN: at line 14 /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/./bin/clang -fopenmp -gdwarf-4 -O1 -fsanitize=thread -I /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/openmp/tools/archer/tests -I /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/runtime/src /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/openmp/tools/archer/tests/races/critical-unrelated.c -o /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/openmp/tools/archer/tests/races/Output/critical-unrelated.c.tmp -latomic && env ARCHER_OPTIONS="ignore_serial=1 report_data_leak=1" env TSAN_OPTIONS='ignore_noninstrumented_modules=0:ignore_noninstrumented_modules=1' /home/botworker/builds/ope
[clang] [Clang] Fix a regression introduced by #140576 (PR #140859)
https://github.com/cor3ntin closed https://github.com/llvm/llvm-project/pull/140859 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Fix a regression introduced by #140576 (PR #140859)
zmodem wrote: Ours too :-) https://github.com/llvm/llvm-project/pull/140859 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Fix a regression introduced by #140576 (PR #140859)
BertalanD wrote: Thank you; this fixes our build! https://github.com/llvm/llvm-project/pull/140859 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Fix a regression introduced by #140576 (PR #140859)
https://github.com/cor3ntin updated
https://github.com/llvm/llvm-project/pull/140859
>From 1e7330b89327ea02271d54349ab3b01b8a495805 Mon Sep 17 00:00:00 2001
From: Corentin Jabot
Date: Wed, 21 May 2025 09:12:52 +0200
Subject: [PATCH] [Clang] Fix a regression introduced by #140576
Lambda bodies should not be treated as subexpressions of the
enclosing scope.
---
clang/lib/Sema/SemaExpr.cpp | 6 ++
clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp | 8
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index b18e83b605e4f..66dac21bf5818 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1,15 +1,13 @@ void Sema::PushExpressionEvaluationContextForFunction(
Current.InImmediateEscalatingFunctionContext =
getLangOpts().CPlusPlus20 && FD->isImmediateEscalating();
-if (isLambdaMethod(FD)) {
- Current.InDiscardedStatement = Parent.isDiscardedStatementContext();
+if (isLambdaMethod(FD))
Current.InImmediateFunctionContext =
FD->isConsteval() ||
(isLambdaMethod(FD) && (Parent.isConstantEvaluated() ||
Parent.isImmediateFunctionContext()));
-} else {
+else
Current.InImmediateFunctionContext = FD->isConsteval();
-}
}
}
diff --git a/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
b/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
index 20125cc5d4a9c..ac21e36daf870 100644
--- a/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
+++ b/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
@@ -208,6 +208,14 @@ void test() {
}
}
+
+void regression() {
+ if constexpr (false) {
+auto lam = []() { return 0; };
+1 | lam(); // expected-warning {{unused}}
+ }
+}
+
}
#endif
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Fix a regression introduced by #140576 (PR #140859)
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: cor3ntin (cor3ntin)
Changes
Lambda bodies should not be treated as subexpressions of the enclosing scope.
---
Full diff: https://github.com/llvm/llvm-project/pull/140859.diff
2 Files Affected:
- (modified) clang/lib/Sema/SemaExpr.cpp (+2-3)
- (modified) clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp (+8)
``diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index b18e83b605e4f..5e06c4bf89766 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1,13 +1,12 @@ void Sema::PushExpressionEvaluationContextForFunction(
Current.InImmediateEscalatingFunctionContext =
getLangOpts().CPlusPlus20 && FD->isImmediateEscalating();
-if (isLambdaMethod(FD)) {
- Current.InDiscardedStatement = Parent.isDiscardedStatementContext();
+if (isLambdaMethod(FD))
Current.InImmediateFunctionContext =
FD->isConsteval() ||
(isLambdaMethod(FD) && (Parent.isConstantEvaluated() ||
Parent.isImmediateFunctionContext()));
-} else {
+else
Current.InImmediateFunctionContext = FD->isConsteval();
}
}
diff --git a/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
b/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
index 20125cc5d4a9c..054defc3470e7 100644
--- a/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
+++ b/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
@@ -208,6 +208,14 @@ void test() {
}
}
+
+void regression() {
+ if constexpr (false) {
+auto lam = []() { return 0; };
+1 | lam();
+ }
+}
+
}
#endif
``
https://github.com/llvm/llvm-project/pull/140859
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Fix a regression introduced by #140576 (PR #140859)
https://github.com/cor3ntin created
https://github.com/llvm/llvm-project/pull/140859
Lambda bodies should not be treated as subexpressions of the enclosing scope.
>From f5e126d72bf6516ed36cfddce862af858968310f Mon Sep 17 00:00:00 2001
From: Corentin Jabot
Date: Wed, 21 May 2025 09:12:52 +0200
Subject: [PATCH] [Clang] Fix a regression introduced by #140576
Lambda bodies should not be treated as subexpressions of the
enclosing scope.
---
clang/lib/Sema/SemaExpr.cpp | 5 ++---
clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp | 8
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index b18e83b605e4f..5e06c4bf89766 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1,13 +1,12 @@ void Sema::PushExpressionEvaluationContextForFunction(
Current.InImmediateEscalatingFunctionContext =
getLangOpts().CPlusPlus20 && FD->isImmediateEscalating();
-if (isLambdaMethod(FD)) {
- Current.InDiscardedStatement = Parent.isDiscardedStatementContext();
+if (isLambdaMethod(FD))
Current.InImmediateFunctionContext =
FD->isConsteval() ||
(isLambdaMethod(FD) && (Parent.isConstantEvaluated() ||
Parent.isImmediateFunctionContext()));
-} else {
+else
Current.InImmediateFunctionContext = FD->isConsteval();
}
}
diff --git a/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
b/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
index 20125cc5d4a9c..054defc3470e7 100644
--- a/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
+++ b/clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
@@ -208,6 +208,14 @@ void test() {
}
}
+
+void regression() {
+ if constexpr (false) {
+auto lam = []() { return 0; };
+1 | lam();
+ }
+}
+
}
#endif
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
