Skip to content

Commit

Permalink
Revert "[clang][Interp] Fix init chain in local initializers"
Browse files Browse the repository at this point in the history
This reverts commit 86187ed.

Seems like this breaks buildbots:
https://lab.llvm.org/buildbot/#/builders/56/builds/1638
  • Loading branch information
tbaederr committed Jul 4, 2024
1 parent 0ad6ac8 commit 2dda8a2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
4 changes: 1 addition & 3 deletions clang/lib/AST/Interp/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 0 additions & 12 deletions clang/test/AST/Interp/records.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, "");
}

0 comments on commit 2dda8a2

Please sign in to comment.