-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang][bytecode] Avoid revisiting decomposition decl in visitDeclRef #144226
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
Conversation
|
@llvm/pr-subscribers-clang Author: Sirui Mu (Lancern) ChangesThis simple patch removes the code to revisit Full diff: https://github.com/llvm/llvm-project/pull/144226.diff 2 Files Affected:
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index bf38b2e5d537d..9fe4803ce98ec 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -6591,10 +6591,6 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
return T->isReferenceType();
};
- // DecompositionDecls are just proxies for us.
- if (isa<DecompositionDecl>(VD))
- return revisit(VD);
-
if ((VD->hasGlobalStorage() || VD->isStaticDataMember()) &&
typeShouldBeVisited(VD->getType())) {
if (const Expr *Init = VD->getAnyInitializer();
diff --git a/clang/test/AST/ByteCode/structured-binding.cpp b/clang/test/AST/ByteCode/structured-binding.cpp
new file mode 100644
index 0000000000000..63eaad8448249
--- /dev/null
+++ b/clang/test/AST/ByteCode/structured-binding.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -std=c++17 -verify %s -fexperimental-new-constant-interpreter
+// RUN: %clang_cc1 -std=c++17 -verify %s
+
+void f1() {
+ int arr[2] = {};
+ auto [a, b] = arr;
+ static_assert(&a != &b); // expected-no-diagnostics
+}
|
50afed7 to
8046031
Compare
8046031 to
72b99e6
Compare
clang/test/AST/ByteCode/cxx17.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot the namespace name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that... Updated.
72b99e6 to
c9649ce
Compare
tbaederr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
|
I'll merge it once the CI is green. |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/9465 Here is the relevant piece of the build log for the reference |
…llvm#144226) This simple patch removes the code to revisit `DecompositionDecl` in `visitDeclRef`. The revisit will try to emit the initializer of the `DecompositionDecl`, which could result in evaluation errors if the `DecompositionDecl` is not within a constexpr context.
This simple patch removes the code to revisit
DecompositionDeclinvisitDeclRef. The revisit will try to emit the initializer of theDecompositionDecl, which could result in evaluation errors if theDecompositionDeclis not within a constexpr context.