Re-commit "[clang][Interp] Unify visiting variable declarations"
authorTimm Bäder <tbaeder@redhat.com>
Fri, 20 Jan 2023 14:07:25 +0000 (15:07 +0100)
committerTimm Bäder <tbaeder@redhat.com>
Sat, 21 Jan 2023 09:23:53 +0000 (10:23 +0100)
commit3665da3d0091ab765d54ce643bd82d353c040631
tree3188c2f2bd8e880b8be3f94b5eb717b3fab15687
parent171e7b83122734788c6329d8a699877415cc9a48
Re-commit "[clang][Interp] Unify visiting variable declarations"

We often visit the same variable multiple times, e.g. once when checking
its initializer and later when compiling the function. Unify both of
those in visitVarDecl() and do the returning of the value in
visitDecl().

This time, use a VariableScope instead of a DeclScope for local
variables. This way, we don't emit Destroy ops for the local variables
immediately after creating them.

Differential Revision: https://reviews.llvm.org/D136815
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/lib/AST/Interp/ByteCodeExprGen.h
clang/lib/AST/Interp/ByteCodeStmtGen.cpp
clang/lib/AST/Interp/ByteCodeStmtGen.h
clang/lib/AST/Interp/Program.cpp
clang/lib/AST/Interp/Program.h