Author: Timm Bäder
Date: 2024-07-04T08:50:14+02:00
New Revision: 2dda8a2650927e4b0fbb459507684455e196d9a9

URL: 
https://github.com/llvm/llvm-project/commit/2dda8a2650927e4b0fbb459507684455e196d9a9
DIFF: 
https://github.com/llvm/llvm-project/commit/2dda8a2650927e4b0fbb459507684455e196d9a9.diff

LOG: Revert "[clang][Interp] Fix init chain in local initializers"

This reverts commit 86187ed2998e43be62176c2c4a7b204cc52f6ce6.

Seems like this breaks buildbots:
https://lab.llvm.org/buildbot/#/builders/56/builds/1638

Added: 
    

Modified: 
    clang/lib/AST/Interp/Compiler.cpp
    clang/test/AST/Interp/records.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Compiler.cpp 
b/clang/lib/AST/Interp/Compiler.cpp
index 2af4c38c5ac3d..775cabf7f8c59 100644
--- a/clang/lib/AST/Interp/Compiler.cpp
+++ b/clang/lib/AST/Interp/Compiler.cpp
@@ -3577,7 +3577,6 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const 
VarDecl *VD, bool Topleve
     return !Init || (checkDecl() && initGlobal(*GlobalIndex));
   } else {
     VariableScope<Emitter> LocalScope(this, VD);
-    InitLinkScope<Emitter> ILS(this, InitLink::Decl(VD));
 
     if (VarT) {
       unsigned Offset = this->allocateLocalPrimitive(
@@ -3912,8 +3911,7 @@ bool Compiler<Emitter>::VisitCXXDefaultInitExpr(const 
CXXDefaultInitExpr *E) {
   SourceLocScope<Emitter> SLS(this, E);
 
   bool Old = InitStackActive;
-  InitStackActive =
-      !(E->getUsedContext()->getDeclKind() == Decl::CXXConstructor);
+  InitStackActive = !isa<FunctionDecl>(E->getUsedContext());
   bool Result = this->delegate(E->getExpr());
   InitStackActive = Old;
   return Result;

diff  --git a/clang/test/AST/Interp/records.cpp 
b/clang/test/AST/Interp/records.cpp
index 1554e54275598..9f341f5bc6d1d 100644
--- a/clang/test/AST/Interp/records.cpp
+++ b/clang/test/AST/Interp/records.cpp
@@ -1482,15 +1482,3 @@ namespace FloatAPValue {
   ClassTemplateArgRefTemplate<ClassTemplateArgObj.Arg> ClassTemplateArgRefObj;
 }
 #endif
-
-namespace LocalWithThisPtrInit {
-  struct S {
-    int i;
-    int *p = &i;
-  };
-  constexpr int foo() {
-    S s{2};
-    return *s.p;
-  }
-  static_assert(foo() == 2, "");
-}


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to